GClasses
|
Represents a single node in a DOM.
#include <GDom.h>
Public Types |
Public Member Functions | |
GDomNode * | addField (GDom *pDoc, const char *szName, GDomNode *pNode) |
Adds a field with the specified name to this object. Throws if this is not an object type Returns pNode. (Yes, it returns the same node that you pass in. This is useful for writing compact marshalling code.) More... | |
GDomNode * | addItem (GDom *pDoc, GDomNode *pNode) |
Adds an item to a list node. Returns a pointer to the item passed in (pNode). More... | |
bool | asBool () const |
Returns the boolean value stored by this node. Throws if this is not a bool type. More... | |
double | asDouble () const |
Returns the double value stored by this node. Throws if this is not a double type. More... | |
long long | asInt () const |
Returns the 64-bit integer value stored by this node. Throws if this is not an integer type. More... | |
const char * | asString () const |
Returns the string value stored by this node. Throws if this is not a string type. More... | |
GDomNode * | field (const char *szName) const |
Returns the node with the specified field name. Throws if this is not an object type. Throws if there is no field with the name specified by szName. More... | |
GDomNode * | fieldIfExists (const char *szName) const |
Returns the node with the specified field name. Throws if this is not an object type. Returns NULL if this is an object type, but there is no field with the specified name. More... | |
void | saveJson (const char *filename) const |
Writes this node to a JSON file. More... | |
nodetype | type () const |
Returns the type of this node. More... | |
void | writeJson (std::ostream &stream) const |
Writes this node in JSON format. More... | |
size_t | writeJsonCpp (std::ostream &stream, size_t col) const |
Writes this node in JSON format, escaped in a manner suitable for hard-coding in a C/C++ string. More... | |
void | writeJsonPretty (std::ostream &stream, size_t indents) const |
Writes this node in JSON format indented in a manner suitable for human readability. More... | |
void | writeXml (std::ostream &stream, const char *szLabel) const |
Writes this node as XML. More... | |
Protected Member Functions | |
size_t | reverseFieldOrder () const |
Reverses the order of the fiels in the object and returns the number of fields. Assumes this GDomNode is a object node. Behavior is undefined if it is not an object node. More... | |
size_t | reverseItemOrder () const |
Reverses the order of the items in the list and returns the number of items in the list. Assumes this GDomNode is a list node. Behavior is undefined if it is not a list node. More... | |
void | writeXmlInlineValue (std::ostream &stream) |
Friends | |
class | GDom |
class | GDomListIterator |
Adds a field with the specified name to this object. Throws if this is not an object type Returns pNode. (Yes, it returns the same node that you pass in. This is useful for writing compact marshalling code.)
Adds an item to a list node. Returns a pointer to the item passed in (pNode).
|
inline |
Returns the boolean value stored by this node. Throws if this is not a bool type.
|
inline |
Returns the double value stored by this node. Throws if this is not a double type.
|
inline |
Returns the 64-bit integer value stored by this node. Throws if this is not an integer type.
|
inline |
Returns the string value stored by this node. Throws if this is not a string type.
|
inline |
Returns the node with the specified field name. Throws if this is not an object type. Throws if there is no field with the name specified by szName.
GDomNode* GClasses::GDomNode::fieldIfExists | ( | const char * | szName | ) | const |
Returns the node with the specified field name. Throws if this is not an object type. Returns NULL if this is an object type, but there is no field with the specified name.
|
protected |
Reverses the order of the fiels in the object and returns the number of fields. Assumes this GDomNode is a object node. Behavior is undefined if it is not an object node.
|
protected |
Reverses the order of the items in the list and returns the number of items in the list. Assumes this GDomNode is a list node. Behavior is undefined if it is not a list node.
void GClasses::GDomNode::saveJson | ( | const char * | filename | ) | const |
Writes this node to a JSON file.
|
inline |
Returns the type of this node.
void GClasses::GDomNode::writeJson | ( | std::ostream & | stream | ) | const |
Writes this node in JSON format.
size_t GClasses::GDomNode::writeJsonCpp | ( | std::ostream & | stream, |
size_t | col | ||
) | const |
Writes this node in JSON format, escaped in a manner suitable for hard-coding in a C/C++ string.
void GClasses::GDomNode::writeJsonPretty | ( | std::ostream & | stream, |
size_t | indents | ||
) | const |
Writes this node in JSON format indented in a manner suitable for human readability.
void GClasses::GDomNode::writeXml | ( | std::ostream & | stream, |
const char * | szLabel | ||
) | const |
Writes this node as XML.
|
protected |
|
friend |
|
friend |
bool GClasses::GDomNode::m_bool |
double GClasses::GDomNode::m_double |
long long GClasses::GDomNode::m_int |
GDomObjField* GClasses::GDomNode::m_pLastField |
GDomListItem* GClasses::GDomNode::m_pLastItem |
char GClasses::GDomNode::m_string[8] |