|
|
1.1 ! root 1: /* ! 2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. ! 3: ! 4: Governed by the TrueCrypt License 2.4 the full text of which is contained ! 5: in the file License.txt included in TrueCrypt binary and source code ! 6: distribution packages. ! 7: */ ! 8: ! 9: #ifndef TC_HEADER_Main_Xml ! 10: #define TC_HEADER_Main_Xml ! 11: ! 12: #include "System.h" ! 13: #include "Main.h" ! 14: ! 15: namespace TrueCrypt ! 16: { ! 17: struct XmlNode; ! 18: typedef list <XmlNode> XmlNodeList; ! 19: ! 20: struct XmlNode ! 21: { ! 22: XmlNode () { } ! 23: XmlNode (const wxString &name) : Name (name) { } ! 24: XmlNode (const wxString &name, const wxString &innerText) : InnerText (innerText), Name (name) { } ! 25: XmlNode (const wxString &name, const XmlNodeList &innerNodes) : InnerNodes (innerNodes), Name (name) { } ! 26: ! 27: map <wxString, wxString> Attributes; ! 28: XmlNodeList InnerNodes; ! 29: wxString InnerText; ! 30: wxString Name; ! 31: }; ! 32: ! 33: class XmlParser ! 34: { ! 35: public: ! 36: XmlParser (const FilePath &fileName); ! 37: XmlParser (const string &xmlTextUtf8) : XmlText (wxString::FromUTF8 (xmlTextUtf8.c_str())) { } ! 38: XmlParser (const wxString &xmlText) : XmlText (xmlText) { } ! 39: virtual ~XmlParser () { } ! 40: ! 41: wxString ConvertEscapedChars (wxString xmlString) const; ! 42: XmlNodeList GetNodes (const wxString &nodeName) const; ! 43: ! 44: protected: ! 45: wxString XmlText; ! 46: ! 47: private: ! 48: XmlParser (const XmlParser &); ! 49: XmlParser &operator= (const XmlParser &); ! 50: }; ! 51: ! 52: class XmlWriter ! 53: { ! 54: public: ! 55: XmlWriter (const FilePath &fileName); ! 56: virtual ~XmlWriter (); ! 57: ! 58: void Close(); ! 59: wxString EscapeChars (wxString rawString) const; ! 60: void WriteNode (const XmlNode &xmlNode); ! 61: void WriteNodes (const XmlNodeList &xmlNodes); ! 62: ! 63: protected: ! 64: int CurrentIndentLevel; ! 65: auto_ptr <wxMemoryOutputStream> MemOutStream; ! 66: auto_ptr <wxTextOutputStream> TextOutStream; ! 67: File OutFile; ! 68: ! 69: private: ! 70: XmlWriter (const XmlWriter &); ! 71: XmlWriter &operator= (const XmlWriter &); ! 72: }; ! 73: } ! 74: ! 75: #endif // TC_HEADER_Main_Xml
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.