GClasses

GClasses::GDomNode Class Reference

Represents a single node in a DOM. More...

#include <GDom.h>

List of all members.

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.
GDomNodefieldIfExists (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.
GDomNodefield (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.
GDomNodeaddField (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.)
GDomNodeaddItem (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

Detailed Description

Represents a single node in a DOM.


Member Enumeration Documentation

Enumerator:
type_obj 
type_list 
type_bool 
type_int 
type_double 
type_string 
type_null 

Member Function Documentation

GDomNode* GClasses::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* GClasses::GDomNode::addItem ( GDom pDoc,
GDomNode pNode 
)

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.

Returns:
The number of items in the list
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]

Friends And Related Function Documentation

friend class GDom [friend]
friend class GDomListIterator [friend]

Member Data Documentation