diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-05-01 17:11:04 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-05-01 17:11:04 +0000 |
commit | f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54 (patch) | |
tree | 53cec4864776e07950e3c72f2a990a1017d08045 /src/xmlfilewriter.h | |
download | libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.gz libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.bz2 libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.xz libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.zip |
libbu++ is finally laid out the way it should be, trunk, branches, and tags.
Diffstat (limited to '')
-rw-r--r-- | src/xmlfilewriter.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/xmlfilewriter.h b/src/xmlfilewriter.h new file mode 100644 index 0000000..97b3e00 --- /dev/null +++ b/src/xmlfilewriter.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef XML_FILE_WRITER | ||
2 | #define XML_FILE_WRITER | ||
3 | |||
4 | #include "xmlnode.h" | ||
5 | #include "xmlwriter.h" | ||
6 | |||
7 | /** | ||
8 | * Implements xml writing in the XML standard format. Also allows you to | ||
9 | * break that format and auto-indent your exported xml data for ease of | ||
10 | * reading. The auto-indenting will only be applied to sections that | ||
11 | * have no content of their own already. This means that except for | ||
12 | * whitespace all of your data will be preserved perfectly. | ||
13 | * You can create an XmlWriter object around a file, or access the static | ||
14 | * write function directly and just hand it a filename and a root XmlNode. | ||
15 | * When using an XmlWriter object the interface is identicle to that of | ||
16 | * the XmlDocument class, so reference that class for API info. However | ||
17 | * when the initial (or root) node is closed, and the document is finished | ||
18 | * the file will be created and written to automatically. The user can | ||
19 | * check to see if this is actually true by calling the isFinished | ||
20 | * function in the XmlDocument class. | ||
21 | *@author Mike Buland | ||
22 | */ | ||
23 | class XmlFileWriter : public XmlWriter | ||
24 | { | ||
25 | public: | ||
26 | /** | ||
27 | * Construct a file writer around a given file. | ||
28 | *@param sFileName The file to create or overwrite and write XML into. | ||
29 | *@param sIndent The indent text to use, if any. | ||
30 | */ | ||
31 | XmlFileWriter( const char *sFileName, const char *sIndent=NULL, XmlNode *pRoot=NULL ); | ||
32 | |||
33 | /** | ||
34 | * Destroy the writer. | ||
35 | */ | ||
36 | ~XmlFileWriter(); | ||
37 | |||
38 | private: | ||
39 | void writeString( const char *sString ); | ||
40 | std::string sFileName; /**< The filename to write to. */ | ||
41 | FILE *fh; /**< The file handle to the open file. */ | ||
42 | }; | ||
43 | |||
44 | #endif | ||