diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
commit | ac517a2b7625e0aa0862679e961c6349f859ea3b (patch) | |
tree | e3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/old/xmlfilereader.h | |
parent | f8d4301e9fa4f3709258505941e37fab2eadadc6 (diff) | |
parent | bd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff) | |
download | libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2 libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip |
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to 'src/old/xmlfilereader.h')
-rw-r--r-- | src/old/xmlfilereader.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/old/xmlfilereader.h b/src/old/xmlfilereader.h new file mode 100644 index 0000000..e3e02c2 --- /dev/null +++ b/src/old/xmlfilereader.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef XMLFILEREADER | ||
2 | #define XMLFILEREADER | ||
3 | |||
4 | #include <stdio.h> | ||
5 | #include "xmlreader.h" | ||
6 | #include "flexbuf.h" | ||
7 | |||
8 | /** | ||
9 | * Takes care of reading in xml formatted data from a file. This could/should | ||
10 | * be made more arbitrary in the future so that we can read the data from any | ||
11 | * source. This is actually made quite simple already since all data read in | ||
12 | * is handled by one single helper function and then palced into a FlexBuf for | ||
13 | * easy access by the other functions. The FlexBuf also allows for block | ||
14 | * reading from disk, which improves speed by a noticable amount. | ||
15 | * <br> | ||
16 | * There are also some extra features implemented that allow you to break the | ||
17 | * standard XML reader specs and eliminate leading and trailing whitespace in | ||
18 | * all read content. This is useful in situations where you allow additional | ||
19 | * whitespace in the files to make them easily human readable. The resturned | ||
20 | * content will be NULL in sitautions where all content between nodes was | ||
21 | * stripped. | ||
22 | *@author Mike Buland | ||
23 | */ | ||
24 | class XmlFileReader : public XmlReader | ||
25 | { | ||
26 | public: | ||
27 | /** | ||
28 | * Construct an XmlReader around an xml file on your file system. | ||
29 | *@param sFile The file to read. | ||
30 | *@param bStrip Set to true to strip out leading and trailing whitespace in | ||
31 | * node contents. | ||
32 | */ | ||
33 | XmlFileReader( const char *sFile, bool bStrip=false ); | ||
34 | |||
35 | /** | ||
36 | * Destroy the reader and cleanup. | ||
37 | */ | ||
38 | virtual ~XmlFileReader(); | ||
39 | |||
40 | private: | ||
41 | char getChar( int nIndex = 0 ); | ||
42 | void usedChar( int nAmnt = 1 ); | ||
43 | FILE *fh; /**< The file handle. */ | ||
44 | FlexBuf fbDataIn; /**< The input buffer. */ | ||
45 | }; | ||
46 | |||
47 | #endif | ||