Rudiments
|
#include <inidom.h>
Protected Member Functions | |
virtual bool | whitespaceStart () |
virtual bool | whitespace (const char *w) |
virtual bool | whitespaceEnd () |
virtual bool | semicolonCommentStart () |
virtual bool | semicolonComment (const char *c) |
virtual bool | semicolonCommentEnd () |
virtual bool | poundCommentStart () |
virtual bool | poundComment (const char *c) |
virtual bool | poundCommentEnd () |
virtual bool | sectionStart () |
virtual bool | section (const char *s) |
virtual bool | sectionEnd () |
virtual bool | keyStart () |
virtual bool | key (const char *k) |
virtual bool | keyEnd () |
virtual bool | valueStart () |
virtual bool | value (const char *v) |
virtual bool | valueEnd () |
The inidom class implements a minimal INI DOM parser.
It parses a file or string of INI-formatted data and produces a dom tree representing the data. It creates "s" elements for each section, "k" elements for each key, "p" elements for each pound-delimited comment, and "c" elements for each semicolon-delimited comments. It adds a "v" attribute to each element, containing the value. For each "k" element, it also adds a "k" attribute, containing the name of the key. Text dom nodes (nodes of type TEXT_DOMNODETYPE) are used to preserve whitespace.
For example, the following INI:
[section 1] #pound comment ;semicolon comment key1=value1 key2=value2
[section 2] key 1=value 1 key 2=value 2 #pound comment ;semicolon comment
would produce the following dom tree:
<k k="key1" v="value1"> <k k="key2" v="value2">
<k k="key 1" v="value 1"> <k k="key 2" v="value 2">
(Note the blank line of text between the sections. This is the text domnode, used to preserve the whitespace.)
inidom::inidom | ( | ) |
Creates a new instance of the inidom class.
inidom::inidom | ( | bool | stringcacheenabled | ) |
Creates a new instance of the inidom class, allowing the user to enable or disable the "string cache" for this instance.
By default, as each domnode is added to the inidom tree, tag and attribute names and values are stored in a string cache and pointers into the cache are assigned to each node. Reference counters are kept and the string is removed from the cache when no more nodes are using it. If the data is highly repetitive this conserves memory at the cost of speed.
If the string cache is disabled then memory is allocated in each domnode for names and values and freed when the domnode is freed. This is faster but uses much more memory.
|
virtual |
Deletes this instance of the inidom class.
|
virtual |
Creates a new root node. This is useful for building a tree from scratch.
Reimplemented from dom.
Gets called when a key name is parsed.
Reimplemented from inisax.
Gets called when the end of a key is encountered.
Reimplemented from inisax.
Gets called when the start of a key is encountered.
Reimplemented from inisax.
Parses generic input "in" and generates a DOM tree.
Reimplemented from sax.
Parses file "filename" and generates a DOM tree.
Reimplemented from sax.
Parses string "string" and generates a DOM tree.
Reimplemented from sax.
Gets called when a pound-delimited comment is parsed.
Reimplemented from inisax.
Gets called when the end of a pound-delimited comment is encountered.
Reimplemented from inisax.
Gets called when the start of a pound-delimited comment is encountered.
Reimplemented from inisax.
Gets called when the name of a section is parsed.
Reimplemented from inisax.
Gets called when the end of a section is encountered.
Reimplemented from inisax.
Gets called when the start of a section is encountered.
Reimplemented from inisax.
Gets called when a semicolon-delimited comment is parsed.
Reimplemented from inisax.
Gets called when the end of a semicolon-delimited comment is encountered.
Reimplemented from inisax.
Gets called when the start of a semicolon-delimited comment is encountered.
Reimplemented from inisax.
Gets called when a value name is parsed.
Reimplemented from inisax.
Gets called when the end of a value is encountered.
Reimplemented from inisax.
Gets called when the start of a value is encountered.
Reimplemented from inisax.
Gets called when whitespace (outside of a comment, section name, key, or value) is parsed.
Reimplemented from inisax.
Gets called when the end of whitespace (outside of a comment, section name, key, or value) is encountered.
Reimplemented from inisax.