The following functions are useful during loading of files and
creation of the XML tree.
config4gnu::CfgObject addContainer( | $parent, | |
| $childTag, | |
| $childName) ; | |
config4gnu::CfgObject | $parent - The parent container to add the new child to; |
string | $childTag - The XML tag to use for the child being added; |
string | $childName - The name of the child being added (optional); |
Creates a new container element (property or section), appends it to $parent, sets its name to $childName if provided, and returns a pointer to it. This function should normally only be called via CFGXML::Parser's functions.
string | $data - The comment to add to the current config4gnu::CfgObject; |
Adds $data to the current config4gnu::CfgObject using the appropriate XML tags. Any trailing newline is trimmed, and $data is added regardless of whether it is empty.
void addEndComment( | $data) ; | |
string | $data - The end comment to add to the current config4gnu::CfgObject; |
Adds $data to the current config4gnu::CfgObject using the appropriate XML tags. Any trailing newline is trimmed, and if $data is empty after trimming, it is not added. Note that Parser::endFile should be used to add the ending comments of a file and terminate it.
void addCloseComment( | $data) ; | |
string | $data - The close comment to add to the current config4gnu::CfgObject; |
Adds $data to the current config4gnu::CfgObject using the appropriate XML tags. Any trailing newline is trimmed, and if $data is empty after trimming, it is not added.
void addRightcomment( | $data) ; | |
string | $data - The right comment to add to the current config4gnu::CfgObject; |
Adds $data to the current config4gnu::CfgObject using the appropriate XML tags. Any trailing newline is trimmed, and if $data is empty after trimming, it is not added.
void addWhitespace( | $data) ; | |
string | $data - The whitespace to add to the current config4gnu::CfgObject; |
Adds $data to the current config4gnu::CfgObject using the appropriate XML tags. Any trailing newline is trimmed, and if $data is empty after trimming, it is not added.
void _addDataTag( | $data, | |
| $tag, | |
| $attr) ; | |
string | $data - The data to add to the current config4gnu::CfgObject; |
string | $tag - The tag to use for the added data element; |
string | $attr - The type attribute of the tag to be created to hold the data (optional); |
Adds $data to the current config4gnu::CfgObject using $tag for the XML tag. If $attr is given, the type attribute of the XML tag is set to its value. Any trailing newline from $data is trimmed, and if $data is empty after trimming, it is not added unless $tag is comment. You should not normally call this function directly.
The following functions are useful during saving of files and
reading of the XML tree.
config4gnu::CfgObjectVector getChildren(
)
;
Returns all children (properties, sections, and data tags) of the current element.
config4gnu::CfgObjectVector getElementsByTagList( | $tagList) ; | |
string{} | $tagList - The list of tags to try to match; |
Returns all immediate children whose tags are found in $tagList in the order they are found in the XML document.
config4gnu::CfgObjectVector getComments(
)
;
Returns a list of all immediate comment children of the current element.
string getCommentString(
)
;
Returns a string representation of all immediate comment children of the current element. A newline character is inserted at the end of each comment found. If no comments are found, an empty string is returned.
config4gnu::CfgObjectVector getRightComments( | ) ; | |
Returns a list of all immediate right comment children of the current element.
string getRightCommentString(
)
;
Returns a string representation of all immediate right comment children of the current element. Nothing is inserted between, before, or after each right comment. If no right comments are found, an empty string is returned.
config4gnu::CfgObjectVector getEndComments( | ) ; | |
Returns a list of all immediate end comment children of the current element.
string getEndCommentString(
)
;
Returns a string representation of all immediate end comment children of the current element. Nothing is inserted between, before, or after each right comment. If no end commends are found, an empty string is returned.
config4gnu::CfgObjectVector getCloseComments( | ) ; | |
Returns a list of all immediate close comment children of the current element.
string getCloseCommentString(
)
;
Returns a string representation of all immediate close comment children of the current element. Nothing is inserted between, before, or after each right comment. If no close commends are found, an empty string is returned.
config4gnu::CfgObjectVector getWhitespaces( | ) ; | |
Returns a list of all immediate whitespace children of the current element.
string getWhitespaceString(
)
;
Returns a string representation of all immediate whitespaceent children of the current element. Nothing is inserted between, before, or after each right comment. If no whitespaces are found, an empty string is returned.
string getName(
)
;
Returns the name of the current element if it has one, otherwise its XML tag name is returned.
string get_property_tagname(
)
;
Returns the XML tag of the current element.
string getData(
)
;
Returns the string data contained in the current element, or an empty string if no data is found.