GXmlTag Class Reference

#include <GXmlTree.h>

Inheritance diagram for GXmlTag:

GDom

List of all members.

Public Member Functions

 GXmlTag (const char *tag=0, GXmlAlloc *alloc=0)
 Construct the object.
 GXmlTag (const GXmlTag &t)
 Construct the object.
bool Dump (int Depth=0)
 For debugging.
void Empty (bool Deep)
 Free any memory owned by this object.
void EmptyAttributes ()
 Free all attributes.
void EmptyChildren ()
 Frees all child tags.
bool IsTag (const char *s)
char * GetAttr (const char *Name)
 Get the string value of a named attribute.
int GetAsInt (const char *Name)
 Get the value of a named attribute as an int.
bool SetAttr (const char *Name, const char *Value)
 Set the value of a named attribute to a string.
bool SetAttr (const char *Name, int Value)
 Set the value of a named attribute to an int.
bool DelAttr (const char *Name)
 Deletes an attribute.
bool SerializeAttr (const char *Attr, int &Int)
 Read/write a native C integer into an attribute.
bool SerializeAttr (const char *Attr, char *&Str)
 Read/write a native C dynamically allocated string into an attribute.
bool SerializeAttr (const char *Attr, double &Dbl)
 Read/write a native C double into an attribute.
virtual bool Serialize ()
 Read/write all your native types in here.
GXmlTagGetTag (const char *Name, bool Create=false)
 Returns a pointer to a child tag if present, or NULL if not.
GXmlTagCreateTag (const char *Name, char *Content=0)
 Creates a sub tag if it doesn't already exist.
virtual void InsertTag (GXmlTag *t)
 Inserts a child tag.
virtual void RemoveTag ()
 Removes this tag from the DOM heirarchy.
GXmlTagoperator= (GXmlTag &t)
 Copy operator, doesn't effect children.
bool Copy (GXmlTag &t, bool Deep=false)
 Copy method, deep option copies all child elements as well.

Public Attributes

char * Tag
char * Content
 Any content following the tag.
GXmlTagParent
 The parent element/tag.
GArray< GXmlAttrAttr
 A list of attributes that this tag has.
List< GXmlTagChildren

Friends

class GXmlTree


Detailed Description

An XML element or tag. Contains optionally sub tags and a list of attributes. C++ applications can inherit from this and have native member types mapped to attributes using the SerializeAttr methods. All you have to do is override the virtual member function Serialize and call SerializeAttr on each of your native member variables. When loading and saving the attributes will be mapped to and from your native types.

Constructor & Destructor Documentation

GXmlTag::GXmlTag ( const char *  tag = 0,
GXmlAlloc *  alloc = 0 
)

Construct the object.

Parameters:
tag  [Optional] Start with this name
alloc  [Optional] Use this allocator

References Content, Parent, and Tag.

Referenced by GetTag().


Member Function Documentation

bool GXmlTag::IsTag ( const char *  s  )  [inline]

Returns:
true if the tag is 's'


Member Data Documentation

char* GXmlTag::Tag

The name of the tag/element. This can be NULL in the case that the element is purely content.

Referenced by GXmlToUi::Convert(), Copy(), Dump(), Empty(), GXmlTag(), GXmlTree::Read(), and GApp::SetConfig().

A list of child tags. Don't edit this list yourself, use the InsertTag and RemoveTag methods.

Referenced by GXmlToUi::Convert(), Copy(), Dump(), EmptyChildren(), GetTag(), InsertTag(), GXmlTree::Read(), and RemoveTag().


The documentation for this class was generated from the following files:

Generated on Wed May 11 07:51:59 2011 for Lgi by  doxygen 1.5.6