Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

plist::ArrayBase Class Reference

Inheritance diagram for plist::ArrayBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

Definition at line 273 of file plistCollections.h.

Public Types

typedef std::vector< ObjectBase * > storage_t
 shorthand for the type of the storage
typedef storage_t::iterator iterator
 shorthand for iterators to be returned
typedef storage_t::const_iterator const_iterator
 shorthand for iterators to be returned
typedef AllValueConversions<
PrimitiveBase
FlatConversion
typedef AllValueConversions<
ObjectBase
AnyConversion

Public Member Functions

virtual void removeEntry (size_t index)
 remove the entry at position index, which must exist (no range checking)
ObjectBasegetEntry (size_t index) const
 return the value at position index, which must exist (no range checking)
ObjectBaseoperator[] (size_t index) const
 return the value at position index, which must exist (no range checking, equivalent to getEntry(index))
virtual ObjectBaseresolveEntry (const std::string &path) const
 recursively resolves path interpreted as a series of collection entry names separated by '.', returns NULL if it doesn't exist
virtual void clear ()
 remove all entries in one fell swoop
const_iterator begin () const
 return an STL const_iterator to the first entry
const_iterator end () const
 return the one-past-end const_iterator
virtual size_t size () const
 return the size of the array
virtual void setComment (size_t index, const std::string &comment)
 replaces previous comment for name, or adds it if it doesn't already exist (can preceed actual entry!)
virtual const std::string & getComment (size_t index) const
 returns comment retrieved from loaded file, or any subsequent call to setComment
virtual void loadXML (xmlNode *node)
 From the name of node, will instantiate a new ObjectBase subclass to load it.
virtual void saveXML (xmlNode *node) const
 subclasses are expected to provide a working implementation
virtual std::string toString () const
 return current value as a string
virtual unsigned int getLongestKeyLen () const
 return the length of the longest key for formatting purposes

Protected Types

typedef std::map< size_t,
std::string > 
comments_t
 shorthand for the type of comments

Protected Member Functions

 ArrayBase (bool growable)
 constructor
 ArrayBase (const ArrayBase &d)
 copy constructor
ArrayBaseoperator= (const ArrayBase &d)
 assignment; subclass should call fireEntriesChanged after calling this (and updating its own storage)
 ~ArrayBase ()
 destructor
virtual void takeObject (size_t index, ObjectBase *obj)
 indicates that the storage implementation should mark this as an externally supplied heap reference, which needs to be deleted on removal/destruction
virtual void fireEntryRemoved (ObjectBase &val)
 run through collectionListeners, calling CollectionListener::plistCollectionEntryRemoved(*this,val)
iterator getSubEntry (const std::string &name, std::string::size_type &seppos)
 returns an entry matching just the prefix
const_iterator getSubEntry (const std::string &name, std::string::size_type &seppos) const
 returns an entry matching just the prefix
virtual void cloneMyRef ()
 called after an assignment or copy to clone the objects in myRef to perform a deep copy
virtual bool loadXMLNode (size_t index, xmlNode *val, const std::string &comment)=0

Protected Attributes

storage_t arr
 storage of entries
std::set< ObjectBase * > myRef
 objects which have been handed over to the collection for eventual de-allocation
comments_t comments
 storage of entry comments -- mapping from keys to help text comments for manual editing or user feedback

Friends

std::ostream & operator<< (std::ostream &os, const ArrayBase &d)
 provides textual output

Classes

class  AllValueConversions
class  EntryConstraint
struct  NoValueConversions
class  StringConversion
class  StringConversionTo


Member Function Documentation

ArrayBase::const_iterator plist::ArrayBase::getSubEntry ( const std::string &  name,
std::string::size_type &  seppos 
) const [protected]

returns an entry matching just the prefix

Parameters:
[in] name the name being looked up
[out] seppos the position of the separator (sub-collections are separated by '.')
Returns:
iterator of the sub entry

Definition at line 793 of file plistCollections.cc.

ArrayBase::iterator plist::ArrayBase::getSubEntry ( const std::string &  name,
std::string::size_type &  seppos 
) [protected]

returns an entry matching just the prefix

Parameters:
[in] name the name being looked up
[out] seppos the position of the separator (sub-collections are separated by '.')
Returns:
iterator of the sub entry

Definition at line 779 of file plistCollections.cc.

Referenced by resolveEntry().

void plist::ArrayBase::loadXML ( xmlNode node  )  [virtual]

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

The mapping from node names to actual instantiated types is:

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

Reimplemented from plist::ObjectBase.

Definition at line 628 of file plistCollections.cc.


Member Data Documentation

storage of entry comments -- mapping from keys to help text comments for manual editing or user feedback

not every key necessarily has a comment!

Definition at line 430 of file plistCollections.h.

Referenced by getComment(), operator=(), saveXML(), and setComment().


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

Tekkotsu v3.0
Generated Fri May 11 20:09:08 2007 by Doxygen 1.4.7