Rudiments
Public Member Functions | Protected Member Functions | List of all members
inidom Class Reference

Inherits inisax, and dom.

Public Member Functions

 inidom ()
 
 inidom (bool stringcacheenabled)
 
virtual ~inidom ()
 
bool parseFile (const char *filename)
 
bool parseString (const char *string)
 
void createRootNode ()
 
virtual bool write (output *out) const
 
- Public Member Functions inherited from inisax
 inisax ()
 
virtual ~inisax ()
 
- Public Member Functions inherited from sax
 sax ()
 
virtual ~sax ()
 
const char * getError ()
 
- Public Member Functions inherited from dom
 dom ()
 
 dom (bool stringcacheenabled)
 
virtual ~dom ()
 
virtual domnodegetRootNode () const
 
virtual domnodegetNullNode () const
 
virtual bool writeFile (const char *filename, mode_t perms) const
 
virtual bool write (output *out, bool indent) const
 
bool stringCacheEnabled ()
 

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 ()
 

Detailed Description

The inidom class implements a minimal INI DOM parser.

Constructor & Destructor Documentation

◆ inidom() [1/2]

inidom::inidom ( )

Creates a new instance of the inidom class.

◆ inidom() [2/2]

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.

◆ ~inidom()

virtual inidom::~inidom ( )
virtual

Deletes this instance of the inidom class.

Member Function Documentation

◆ createRootNode()

void inidom::createRootNode ( )
virtual

Creates a new root node. This is useful for building a tree from scratch.

Reimplemented from dom.

◆ key()

virtual bool inidom::key ( const char *  k)
protectedvirtual

Gets called when a key name is parsed.

Reimplemented from inisax.

◆ keyEnd()

virtual bool inidom::keyEnd ( )
protectedvirtual

Gets called when the end of a key is encountered.

Reimplemented from inisax.

◆ keyStart()

virtual bool inidom::keyStart ( )
protectedvirtual

Gets called when the start of a key is encountered.

Reimplemented from inisax.

◆ parseFile()

bool inidom::parseFile ( const char *  filename)
virtual

Parses file "filename" and generates a DOM tree.

Implements dom.

◆ parseString()

bool inidom::parseString ( const char *  string)
virtual

Parses string "string" and generates a DOM tree.

Implements dom.

◆ poundComment()

virtual bool inidom::poundComment ( const char *  c)
protectedvirtual

Gets called when a pound-delimited comment is parsed.

Reimplemented from inisax.

◆ poundCommentEnd()

virtual bool inidom::poundCommentEnd ( )
protectedvirtual

Gets called when the end of a pound-delimited comment is encountered.

Reimplemented from inisax.

◆ poundCommentStart()

virtual bool inidom::poundCommentStart ( )
protectedvirtual

Gets called when the start of a pound-delimited comment is encountered.

Reimplemented from inisax.

◆ section()

virtual bool inidom::section ( const char *  s)
protectedvirtual

Gets called when the name of a section is parsed.

Reimplemented from inisax.

◆ sectionEnd()

virtual bool inidom::sectionEnd ( )
protectedvirtual

Gets called when the end of a section is encountered.

Reimplemented from inisax.

◆ sectionStart()

virtual bool inidom::sectionStart ( )
protectedvirtual

Gets called when the start of a section is encountered.

Reimplemented from inisax.

◆ semicolonComment()

virtual bool inidom::semicolonComment ( const char *  c)
protectedvirtual

Gets called when a semicolon-delimited comment is parsed.

Reimplemented from inisax.

◆ semicolonCommentEnd()

virtual bool inidom::semicolonCommentEnd ( )
protectedvirtual

Gets called when the end of a semicolon-delimited comment is encountered.

Reimplemented from inisax.

◆ semicolonCommentStart()

virtual bool inidom::semicolonCommentStart ( )
protectedvirtual

Gets called when the start of a semicolon-delimited comment is encountered.

Reimplemented from inisax.

◆ value()

virtual bool inidom::value ( const char *  v)
protectedvirtual

Gets called when a value name is parsed.

Reimplemented from inisax.

◆ valueEnd()

virtual bool inidom::valueEnd ( )
protectedvirtual

Gets called when the end of a value is encountered.

Reimplemented from inisax.

◆ valueStart()

virtual bool inidom::valueStart ( )
protectedvirtual

Gets called when the start of a value is encountered.

Reimplemented from inisax.

◆ whitespace()

virtual bool inidom::whitespace ( const char *  w)
protectedvirtual

Gets called when whitespace (outside of a comment, section name, key, or value) is parsed.

Reimplemented from inisax.

◆ whitespaceEnd()

virtual bool inidom::whitespaceEnd ( )
protectedvirtual

Gets called when the end of whitespace (outside of a comment, section name, key, or value) is encountered.

Reimplemented from inisax.

◆ whitespaceStart()

virtual bool inidom::whitespaceStart ( )
protectedvirtual

Gets called when the start of whitespace (outside of a comment, section name, key, or value) is encountered.

Reimplemented from inisax.

◆ write()

virtual bool inidom::write ( output out) const
virtual

Writes the current DOM tree to "out".

Reimplemented from dom.