Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

plist::ObjectBase Class Reference

#include <plistBase.h>

Inheritance diagram for plist::ObjectBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

This base class provides the root functionality for all plist entities -- Dictionary and the various templated subclasses of PrimitiveBase.

The subclasses may throw std::bad_format if the document is poorly structured or bad values are found.

Definition at line 119 of file plistBase.h.

Public Member Functions

 ObjectBase ()
 constructor
virtual ~ObjectBase ()=0
 destructor
virtual std::string toString () const =0
 return current value as a string
virtual void loadXML (xmlNode *node)=0
 subclasses are expected to provide a working implementation
virtual void saveXML (xmlNode *node) const =0
 subclasses are expected to provide a working implementation
virtual ObjectBaseclone () const __attribute__((warn_unused_result))=0
 allows a copy to be made of an event, supporting polymorphism

Protected Member Functions

Inherited from XMLLoadSave
virtual void setParseTree (xmlDoc *doc) const
 assigns a parse tree which you have obtained from some other source
virtual xmlNodeFindRootXMLElement (xmlDoc *doc) const
 returns the root element of the xml document

Static Protected Member Functions

static bool matchTrue (const std::string &str)
 returns true if str is some form of affirmative (e.g. "true" or "yes")
static bool matchFalse (const std::string &str)
 returns true if str is some form of negative (e.g. "false" or "no")
libxml Forwards
Provides accessor functions to struct fields without having to include libxml.h everywhere

static bool xNodeHasName (xmlNode *node, const char *name)
 returns true if the name of node matches name
static const xmlCharxNodeGetName (xmlNode *node)
 returns name of node (not a libxml function)
static xmlNodexNodeGetChildren (xmlNode *node)
 returns children of node (not a libxml function)
static xmlNodexNodeGetNextNode (xmlNode *node)
 returns next node (sibling) after node (not a libxml function)
static xmlNodexNodeGetParent (xmlNode *node)
 returns parent node of node (not a libxml function)
static xmlDocxNodeGetDoc (xmlNode *node)
 returns document node of node (not a libxml function)

Friends

ObjectBaseloadXML (xmlNode *node)
 From the name of node, will instantiate a new ObjectBase subclass to load it.


Constructor & Destructor Documentation

plist::ObjectBase::ObjectBase (  ) 

constructor

Definition at line 10 of file plistBase.cc.

plist::ObjectBase::~ObjectBase (  )  [pure virtual]

destructor

Definition at line 14 of file plistBase.cc.


Member Function Documentation

virtual ObjectBase* plist::ObjectBase::clone (  )  const [pure virtual]

xmlNode * plist::ObjectBase::FindRootXMLElement ( xmlDoc doc  )  const [protected, virtual]

returns the root element of the xml document

Reimplemented from XMLLoadSave.

Definition at line 26 of file plistBase.cc.

virtual void plist::ObjectBase::loadXML ( xmlNode node  )  [pure virtual]

subclasses are expected to provide a working implementation

Implements XMLLoadSave.

Implemented in plist::Dictionary, plist::Array, plist::Primitive< char >, plist::Primitive< unsigned char >, plist::Primitive< std::string >, and plist::NamedEnumeration< T >.

static bool plist::ObjectBase::matchFalse ( const std::string &  str  )  [inline, static, protected]

returns true if str is some form of negative (e.g. "false" or "no")

Definition at line 155 of file plistBase.h.

Referenced by plist::Primitive< unsigned char >::set(), and plist::Primitive< char >::set().

static bool plist::ObjectBase::matchTrue ( const std::string &  str  )  [inline, static, protected]

returns true if str is some form of affirmative (e.g. "true" or "yes")

Definition at line 153 of file plistBase.h.

Referenced by plist::Primitive< unsigned char >::set(), and plist::Primitive< char >::set().

virtual void plist::ObjectBase::saveXML ( xmlNode node  )  const [pure virtual]

subclasses are expected to provide a working implementation

Implements XMLLoadSave.

Implemented in plist::Dictionary, plist::Array, plist::Primitive< char >, plist::Primitive< unsigned char >, plist::Primitive< std::string >, and plist::NamedEnumeration< T >.

void plist::ObjectBase::setParseTree ( xmlDoc doc  )  const [protected, virtual]

assigns a parse tree which you have obtained from some other source

This doesn't update the contents of the subclass's values. The values in doc will be overwritten by those in the subclass on the next Save. If you wish to have the subclass's values updated from doc, call readParseTree() after calling this.

Reimplemented from XMLLoadSave.

Definition at line 16 of file plistBase.cc.

virtual std::string plist::ObjectBase::toString (  )  const [pure virtual]

return current value as a string

Implemented in plist::PrimitiveBase, plist::Dictionary, and plist::Array.

Referenced by plist::operator<<().

xmlNode * plist::ObjectBase::xNodeGetChildren ( xmlNode node  )  [static, protected]

returns children of node (not a libxml function)

Definition at line 67 of file plistBase.cc.

xmlDoc * plist::ObjectBase::xNodeGetDoc ( xmlNode node  )  [static, protected]

returns document node of node (not a libxml function)

Definition at line 76 of file plistBase.cc.

const xmlChar * plist::ObjectBase::xNodeGetName ( xmlNode node  )  [static, protected]

returns name of node (not a libxml function)

Definition at line 64 of file plistBase.cc.

Referenced by plist::NamedEnumeration< T >::loadXML(), and plist::Primitive< std::string >::loadXML().

xmlNode * plist::ObjectBase::xNodeGetNextNode ( xmlNode node  )  [static, protected]

returns next node (sibling) after node (not a libxml function)

Definition at line 70 of file plistBase.cc.

Referenced by plist::Array::saveXML(), and plist::Dictionary::saveXML().

xmlNode * plist::ObjectBase::xNodeGetParent ( xmlNode node  )  [static, protected]

returns parent node of node (not a libxml function)

Definition at line 73 of file plistBase.cc.

bool plist::ObjectBase::xNodeHasName ( xmlNode node,
const char *  name 
) [static, protected]


Friends And Related Function Documentation

ObjectBase* loadXML ( xmlNode node  )  [friend]

From the name of node, will instantiate a new ObjectBase subclass to load it.

The mapping from node names to actual instantiated types is:

  • 'array' -> Vector
  • 'dict' -> Map
  • 'real' -> Primitive<double>
  • 'integer' -> Primitive<long>
  • 'string' -> Primitive<std::string>
  • 'true', 'false' -> Primitive<bool>

If successful, returns a pointer to a newly allocated region, which the caller is responsible for freeing. If an error occurs, NULL is returned.

Implements XMLLoadSave.

Reimplemented in plist::Dictionary, plist::Array, plist::Primitive< char >, plist::Primitive< unsigned char >, plist::Primitive< std::string >, and plist::NamedEnumeration< T >.

Definition at line 7 of file plist.cc.

Referenced by plist::loadXML().


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

Tekkotsu v3.0
Generated Wed Oct 4 00:05:22 2006 by Doxygen 1.4.7