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/xmlstringreader.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/xmlstringreader.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/xmlstringreader.h b/src/xmlstringreader.h new file mode 100644 index 0000000..07da83c --- /dev/null +++ b/src/xmlstringreader.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef XMLSTRINGREADER | ||
2 | #define XMLSTRINGREADER | ||
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 XmlStringReader : public XmlReader | ||
25 | { | ||
26 | public: | ||
27 | /** | ||
28 | * Create a new string reader around an already created and formatted | ||
29 | * null-terminated string. | ||
30 | *@param sString A pointer to the string data that will be used. This data | ||
31 | * is not changed during processing. | ||
32 | *@param bStrip Strip out leading and trailing whitespace. | ||
33 | */ | ||
34 | XmlStringReader( const char *sString, bool bStrip=false ); | ||
35 | |||
36 | /** | ||
37 | * Destroy this string reader. | ||
38 | */ | ||
39 | ~XmlStringReader(); | ||
40 | |||
41 | private: | ||
42 | char getChar( int nIndex = 0 ); | ||
43 | void usedChar(); | ||
44 | const char *sString; /**< Internal pointer to the input string. */ | ||
45 | int nIndex; /**< Our index into the string */ | ||
46 | int nLength; /**< The computed length of the string */ | ||
47 | }; | ||
48 | |||
49 | #endif | ||