GClasses
|
Represents a single node in a DOM. More...
#include <GDom.h>
Public Types | |
enum | nodetype { type_obj = 0, type_list, type_bool, type_int, type_double, type_string, type_null } |
Public Member Functions | |
nodetype | type () |
Returns the type of this node. | |
bool | asBool () |
Returns the boolean value stored by this node. Throws if this is not a bool type. | |
long long | asInt () |
Returns the 64-bit integer value stored by this node. Throws if this is not an integer type. | |
double | asDouble () |
Returns the double value stored by this node. Throws if this is not a double type. | |
const char * | asString () |
Returns the string value stored by this node. Throws if this is not a string type. | |
GDomNode * | fieldIfExists (const char *szName) |
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. | |
GDomNode * | field (const char *szName) |
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 * | 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.) | |
GDomNode * | addItem (GDom *pDoc, GDomNode *pNode) |
Adds an item to a list node. Returns a pointer to the item passed in (pNode). | |
Protected Member Functions | |
size_t | reverseFieldOrder () |
size_t | reverseItemOrder () |
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 | writeJson (std::ostream &stream) |
size_t | writeJsonCpp (std::ostream &stream, size_t col) |
void | writeXmlInlineValue (std::ostream &stream) |
void | writeXml (std::ostream &stream, const char *szLabel) |
Friends | |
class | GDom |
class | GDomListIterator |
Represents a single node in a DOM.
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).
bool GClasses::GDomNode::asBool | ( | ) | [inline] |
Returns the boolean value stored by this node. Throws if this is not a bool type.
double GClasses::GDomNode::asDouble | ( | ) | [inline] |
Returns the double value stored by this node. Throws if this is not a double type.
long long GClasses::GDomNode::asInt | ( | ) | [inline] |
Returns the 64-bit integer value stored by this node. Throws if this is not an integer type.
const char* GClasses::GDomNode::asString | ( | ) | [inline] |
Returns the string value stored by this node. Throws if this is not a string type.
GDomNode* GClasses::GDomNode::field | ( | const char * | szName | ) | [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 | ) |
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.
size_t GClasses::GDomNode::reverseFieldOrder | ( | ) | [protected] |
size_t GClasses::GDomNode::reverseItemOrder | ( | ) | [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.
nodetype GClasses::GDomNode::type | ( | ) | [inline] |
Returns the type of this node.
void GClasses::GDomNode::writeJson | ( | std::ostream & | stream | ) | [protected] |
size_t GClasses::GDomNode::writeJsonCpp | ( | std::ostream & | stream, |
size_t | col | ||
) | [protected] |
void GClasses::GDomNode::writeXml | ( | std::ostream & | stream, |
const char * | szLabel | ||
) | [protected] |
void GClasses::GDomNode::writeXmlInlineValue | ( | std::ostream & | stream | ) | [protected] |
friend class GDom [friend] |
friend class GDomListIterator [friend] |
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] |