00001
00002 #ifndef XSIL_XWRITER_HH
00003 #define XSIL_XWRITER_HH
00004
00005 #include <time.h>
00006 #include <iostream>
00007 #include <string>
00008
00009 namespace xsil {
00010
00018 class Xwriter {
00019 public:
00024 Xwriter(std::ostream& ostr);
00025
00029 ~Xwriter(void);
00030
00035 void text(const std::string& data);
00036
00039 void endLine(void);
00040
00045 bool getIndentEnable(void) const;
00046
00051 void setIndentEnable(bool torf);
00052
00063 void Tag(const char* tagname, int nattr=0, const char** attr=0,
00064 const char** value=0);
00065
00076 void TagNData(const char* tagname, int nattr=0, const char** attr=0,
00077 const char** value=0);
00078
00083 void Integer(int N);
00084
00091 void endTag(const char* tagname);
00092
00097 void sync(void);
00098
00102 void setDocType(const std::string& doc);
00103
00107 void writeHeader(void);
00108
00112 void defineLigoLW(void);
00113
00114 private:
00115 void indent(void);
00116
00117 private:
00118 static const int MAXDEPTH=128;
00122 std::ostream* mStream;
00123
00127 int mDepth;
00128
00132 int mCursor;
00133
00137 const char* mNest[MAXDEPTH];
00138
00141 std::string mDocType;
00142
00145 bool mHeaderOK;
00146
00149 bool mIndentEbl;
00150
00151
00152 };
00153
00154 inline bool
00155 xsil::Xwriter::getIndentEnable(void) const {
00156 return mIndentEbl;
00157 }
00158
00159
00160 }
00161
00162 #endif // XSIL_XWRITER_HH