Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
plist::Collection Class Reference#include <plistCollections.h>
Inheritance diagram for plist::Collection:
![]() Detailed DescriptionProvides a common base class for the collection-oriented primitives, Dictionary and Array.When a collection, you can call addEntry() or setEntry() you can either:
This class supports callbacks upon modification through the use of the CollectionListener interface. Note that we only store a pointer to the listener list, which is typically unallocated when no listeners are active. This should ensure minimal memory usage per object, as well as support safe storage of plist objects in inter-process shared memory regions. If you are using these in a shared memory region, just be sure that only the process with listeners does any and all modifications, and that it unsubscribes before detaching from the region (or else destroys the region itself) There isn't a callback if entries themselves are modified, only when new entries are added, or old ones removed. If you want to know any time any aspect of any entry is modified, listen for the add and remove callbacks, and then add yourself as a listener to each entry individually. Definition at line 41 of file plistCollections.h.
Member Enumeration Documentationused to define values for LoadSavePolicy values so we can test a bit out of the policy value
Definition at line 47 of file plistCollections.h. Arguments for setLoadPolicy() and setSavePolicy(), specifies how to handle orphaned entries when loading or saving. An entry is considered "orphaned" if you are loading or saving into a pre-existing file, and an entry exists in one location (the collection or the file), but not the other. The results look like this... (add/remove refer to the destination i.e. collection if loading, file if saving):
Commonly, you'll want to use SYNC (the default) to support dynamic storage, and FIXED load/SYNC save for configuration settings (or perhaps FIXED load and UNION save to keep 'extra' values in the file...)
Definition at line 67 of file plistCollections.h.
Constructor & Destructor Documentation
Member Function Documentation
assignment (don't assign listeners); subclass should call fireEntriesChanged after calling this (and updating its own storage)
Definition at line 75 of file plistCollections.h. Referenced by plist::ArrayBase::operator=(), and plist::DictionaryBase::operator=().
recursively resolves path interpreted as a series of collection entry names separated by '.', returns NULL if it doesn't exist
Implemented in plist::DictionaryBase, and plist::ArrayBase. Referenced by ConfigurationEditor::refresh(), plist::ArrayBase::resolveEntry(), plist::DictionaryBase::resolveEntry(), and Config::setValue().
return the size of the collection
Implemented in plist::DictionaryBase, and plist::ArrayBase. Referenced by ConfigurationEditor::refresh().
get notified of changes; be sure to call removeCollectionListener() before destructing l!
Definition at line 16 of file plistCollections.cc.
no longer take notification of changes to this object's value
Definition at line 24 of file plistCollections.cc.
set warnUnused
Definition at line 94 of file plistCollections.h. Referenced by Config::behaviors_config::behaviors_config().
returns loadPolicy
Definition at line 97 of file plistCollections.h. Referenced by plist::ArrayBase::ArrayBase(), and plist::DictionaryBase::DictionaryBase().
returns savePolicy
Definition at line 98 of file plistCollections.h. Referenced by plist::ArrayBase::ArrayBase(), and plist::DictionaryBase::DictionaryBase().
assigns loadPolicy
Definition at line 99 of file plistCollections.h. Referenced by setLoadSavePolicy().
assigns savePolicy
Definition at line 100 of file plistCollections.h. Referenced by setLoadSavePolicy().
assigns loadPolicy and savePolicy respectively
Definition at line 101 of file plistCollections.h. Referenced by plist::ArrayBase::ArrayBase(), plist::DictionaryBase::DictionaryBase(), and plist::loadXML().
defines separator between sub-collections (defined as a function instead of just a constant member so there's no issues with initialization order) Definition at line 105 of file plistCollections.h. Referenced by plist::filteredDisplay(), plist::ArrayBase::getLongestKeyLen(), plist::DictionaryBase::getLongestKeyLen(), plist::ArrayBase::getSubEntry(), plist::DictionaryBase::getSubEntry(), and ConfigurationEditor::refresh().
returns longest key length which matches the regular expression
Implemented in plist::DictionaryBase, and plist::ArrayBase.
returns true if the Collection subclass allows storage of the argument
Implemented in plist::DictionaryOf< PO, Alloc >, plist::ArrayOf< PO, Alloc >, plist::DictionaryOf< ObjectBase >, and plist::ArrayOf< plist::Primitive< std::string > >. Referenced by ConfigurationEditor::AddCollectionEntry::refresh().
return current value as an (long) integer (throws std::runtime_error exception if incompatable, e.g. dictionary or array to value type)
Implements plist::ObjectBase. Definition at line 46 of file plistCollections.cc.
return current value as a double (throws std::runtime_error exception if incompatable, e.g. dictionary or array to value type)
Implements plist::ObjectBase. Definition at line 47 of file plistCollections.cc.
run through collectionListeners, calling CollectionListener::plistCollectionEntryAdded(*this,val)
Definition at line 49 of file plistCollections.cc. Referenced by plist::ArrayOf< PO, Alloc >::addEntry(), plist::ArrayOf< plist::Primitive< std::string > >::addEntry(), plist::DictionaryOf< PO, Alloc >::addEntry(), plist::ArrayOf< PO, Alloc >::setEntry(), and plist::DictionaryOf< PO, Alloc >::setEntry().
run through collectionListeners, calling CollectionListener::plistCollectionEntryRemoved(*this,val)
Reimplemented in plist::DictionaryBase, and plist::ArrayBase. Definition at line 61 of file plistCollections.cc. Referenced by plist::ArrayBase::fireEntryRemoved(), and plist::DictionaryBase::fireEntryRemoved().
run through collectionListeners, calling CollectionListener::plistCollectionEntriesChanged(*this)
Definition at line 73 of file plistCollections.cc. Referenced by plist::ArrayBase::clear(), plist::DictionaryBase::clear(), plist::DictionaryBase::renameEntry(), plist::ArrayOf< PO, Alloc >::setEntry(), and plist::DictionaryBase::swapEntry().
returns index corresponding to name, which should encode an integer value less than or equal to the current size
Definition at line 98 of file plistCollections.cc. Referenced by plist::ArrayBase::getSubEntry(), and plist::ArrayBase::resolveEntry().
returns a prefix for items within the collection
Definition at line 85 of file plistCollections.cc. Referenced by plist::ArrayBase::saveXML(), plist::DictionaryBase::saveXML(), OutputConfig< T >::saveXML(), and Config::saveXML().
when an empty string is needed for not found items (defined as a function instead of just a constant member so there's no issues with initialization order) Definition at line 144 of file plistCollections.h. Referenced by plist::ArrayBase::getComment(), and plist::DictionaryBase::getComment().
how much to indent each sub-collection (defined as a function instead of just a constant member so there's no issues with initialization order) Definition at line 150 of file plistCollections.h. Referenced by getIndentationPrefix(), plist::ArrayBase::saveXML(), plist::DictionaryBase::saveXML(), and OutputConfig< T >::saveXML().
Member Data Documentation
stores a list of the current listeners
Definition at line 134 of file plistCollections.h. Referenced by addCollectionListener(), fireEntriesChanged(), fireEntryAdded(), fireEntryRemoved(), isCollectionListener(), removeCollectionListener(), and ~Collection().
when saving comments to file, the key name will automatically be prepended to the comment, unless the key is found within this many characters from the beginning of the comment
Definition at line 155 of file plistCollections.h. Referenced by plist::DictionaryBase::saveOverXMLNode(), and plist::DictionaryBase::saveXMLNode().
if true (the default) loadXML will give warnings using FIXED policy and there are ignored entries in the source while loading or ignored entries in the destination while saving
Definition at line 158 of file plistCollections.h. Referenced by getUnusedWarning(), plist::ArrayOf< PO, Alloc >::loadXMLNode(), plist::DictionaryOf< PO, Alloc >::loadXMLNode(), plist::ArrayOf< PO, Alloc >::operator=(), plist::DictionaryOf< PO, Alloc >::operator=(), plist::ArrayBase::saveXML(), plist::DictionaryBase::saveXML(), plist::ArrayOf< PO, Alloc >::set(), plist::DictionaryOf< PO, Alloc >::set(), and setUnusedWarning().
specifies how to handle "orphaned" entries while loading
Definition at line 160 of file plistCollections.h. Referenced by getLoadPolicy(), plist::ArrayBase::loadXML(), plist::DictionaryBase::loadXML(), plist::ArrayOf< PO, Alloc >::loadXMLNode(), plist::DictionaryOf< PO, Alloc >::loadXMLNode(), plist::ArrayOf< PO, Alloc >::operator=(), plist::DictionaryOf< PO, Alloc >::operator=(), plist::ArrayOf< PO, Alloc >::set(), plist::DictionaryOf< PO, Alloc >::set(), and setLoadPolicy().
specifies how to handle "orphaned" entries while saving
Definition at line 162 of file plistCollections.h. Referenced by getSavePolicy(), plist::ArrayOf< PO, Alloc >::loadXMLNode(), plist::ArrayOf< PO, Alloc >::operator=(), plist::ArrayBase::saveXML(), plist::DictionaryBase::saveXML(), plist::ArrayOf< PO, Alloc >::set(), and setSavePolicy().
The documentation for this class was generated from the following files: |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:54 2007 by Doxygen 1.5.4 |