|
Public Types |
typedef std::map< std::string,
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
|
Public Member Functions |
|
| Dictionary () |
| | constructor
|
|
| Dictionary (bool growable) |
| | constructor
|
|
| Dictionary (const Dictionary &d) |
| | copy constructor (don't assign listeners)
|
|
Dictionary & | operator= (const Dictionary &d) |
| | assignment (don't assign listeners); subclass should call fireEntriesChanged after calling this (and updating its own storage)
|
|
| ~Dictionary () |
| | destructor
|
|
template<typename T> |
| void | setValue (const std::string &name, const T &val, bool warnExists=false) |
| | insert a new entry to the map; expects val to be either a primitive type, like int, float, etc., or one of the variable-sized Collection's, like Array
|
|
template<typename T> |
| void | addValue (const std::string &name, const T &val, const std::string &comment="", bool warnExists=true) |
| | insert a new entry to the map, and corresponding comment; expects val to be either a primitive type, like int, float, etc., or one of the variable-sized Collection's, like Array
|
|
virtual void | setValue (const std::string &name, const char val[], bool warnExists=false) |
| | "specialization" (actually just another override) for handling character arrays as strings
|
|
virtual void | addValue (const std::string &name, const char val[], const std::string &comment="") |
| | "specialization" (actually just another override) for handling character arrays as strings
|
|
virtual void | addValue (const std::string &name, const char val[], const std::string &comment, bool warnExists) |
| | "specialization" (actually just another override) for handling character arrays as strings
|
|
virtual void | setEntry (const std::string &name, ObjectBase &val, bool warnExists=false) |
| | insert a new entry to the dictionary, with key name and value val (replaces any previous entry by same name, but can give a warning)
|
|
virtual void | addEntry (const std::string &name, ObjectBase &val, const std::string &comment="") |
| | insert a new entry to the dictionary, with key name and value val (replaces any previous entry by same name, but can give a warning)
|
|
virtual void | addEntry (const std::string &name, ObjectBase &val, const std::string &comment, bool warnExists) |
| | insert a new entry to the dictionary, with key name and value val (replaces any previous entry by same name, but can give a warning)
|
|
virtual void | setEntry (const std::string &name, ObjectBase *val, bool warnExists=false) |
|
virtual void | addEntry (const std::string &name, ObjectBase *val, const std::string &comment="") |
|
virtual void | addEntry (const std::string &name, ObjectBase *val, const std::string &comment, bool warnExists) |
| | insert a new entry to the dictionary, with key name and value val (replaces any previous entry by same name, but can give a warning)
|
|
virtual void | removeEntry (const std::string &name) |
| | remove the entry with key name
|
|
virtual ObjectBase * | getEntry (const std::string &name) const |
| | return the value of the key name, or NULL if it doesn't exist
|
|
virtual ObjectBase * | operator[] (const std::string &name) |
|
virtual ObjectBase * | resolveEntry (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 iterator | findEntry (const std::string &name) |
| | returns an iterator to an entry in the current dictionary
|
|
virtual const_iterator | findEntry (const std::string &name) const |
| | returns an iterator to an entry in the current dictionary
|
|
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 dictionary
|
|
void | setComment (const std::string &name, const std::string &comment) |
| | replaces previous comment for name, or adds it if it doesn't already exist (can preceed actual entry!)
|
|
const std::string & | getComment (const std::string &name) 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 void | saveXML (xmlNode *node, bool onlyOverwrite, std::set< std::string > &seen) const |
| | saves the dictionary into the specified node
|
|
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
|
|
virtual bool | canContain (const ObjectBase &) |
| | returns true if the Collection subclass allows storage of the argument
|
|
virtual Dictionary * | clone () const __attribute__((warn_unused_result)) |
| | implements the clone function for Dictionaries
|
|
template<> |
| void | setValue (const std::string &name, const char *const &val, bool warnExists) |
| | specialization of Dictionary::setValue() for char* strings
|
|
template<> |
| void | addValue (const std::string &name, const char *const &val, const std::string &comment, bool warnExists) |
| | specialization of Dictionary::addValue() for char* strings
|
|
template<> |
| void | setValue (const std::string &name, char *const &val, bool warnExists) |
| | specialization of Dictionary::setValue() for char* strings
|
|
template<> |
| void | addValue (const std::string &name, char *const &val, const std::string &comment, bool warnExists) |
| | specialization of Dictionary::addValue() for char* strings
|
Protected Types |
typedef std::map< std::string,
std::string > | comments_t |
| | shorthand for the type of comments
|
Protected Member Functions |
|
virtual void | fireEntryRemoved (ObjectBase &val) |
| | run through collectionListeners, calling CollectionListener::plistCollectionEntryRemoved(*this,val)
|
|
virtual void | takeObject (const std::string &name, 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 bool | loadXMLNode (const std::string &key, xmlNode *val, const std::string &comment) |
| | called with each node being loaded so subclass can handle appropriately
|
|
virtual bool | saveOverXMLNode (xmlNode *k, xmlNode *val, const std::string &key, std::string comment, const std::string &indentStr, std::set< std::string > &seen) const |
| | called with each node being saved so subclass can handle appropriately, return true if successful and reset key if changed
|
|
virtual void | saveXMLNode (xmlNode *node, const std::string &key, const ObjectBase *val, const std::string &indentStr) const |
| | called with each node being saved so subclass can handle appropriately, return true if successful and set key
|
| 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
|
Protected Attributes |
|
storage_t | dict |
| | storage of entries -- mapping from keys to value pointers
|
|
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 Dictionary &d) |
| | provides textual output
|