|
BlueBerry
A modular, cross-platform, C++ application framework
|
#include <berryIMemento.h>
Inheritance diagram for berry::IMemento:
Collaboration diagram for berry::IMemento:Public Member Functions | |
| virtual berryInterfaceMacro(IMemento, berry) static const std IMemento::Pointer | CreateChild (const std::string &type)=0 |
| virtual IMemento::Pointer | CreateChild (const std::string &type, const std::string &id)=0 |
| virtual IMemento::Pointer | GetChild (const std::string &type) const =0 |
| virtual std::vector < IMemento::Pointer > | GetChildren (const std::string &type) const =0 |
| virtual bool | GetFloat (const std::string &key, double &value) const =0 |
| virtual bool | GetInteger (const std::string &key, int &value) const =0 |
| virtual bool | GetString (const std::string &key, std::string &value) const =0 |
| virtual bool | GetBoolean (const std::string &key, bool &value) const =0 |
| virtual const std::string & | GetTextData () const =0 |
| virtual std::vector< std::string > | GetAttributeKeys () const =0 |
| virtual std::string | GetType () const =0 |
| virtual std::string | GetID () const =0 |
| virtual void | PutFloat (const std::string &key, double value)=0 |
| virtual void | PutInteger (const std::string &key, int value)=0 |
| virtual void | PutMemento (IMemento::Pointer memento)=0 |
| virtual void | PutString (const std::string &key, const std::string &value)=0 |
| virtual void | PutBoolean (const std::string &key, bool value)=0 |
| virtual void | PutTextData (const std::string &data)=0 |
| virtual | ~IMemento () |
Interface to a memento used for saving the important state of an object in a form that can be persisted in the file system.
Mementos were designed with the following requirements in mind:
Mementos meet these requirements by providing support for storing a mapping of arbitrary string keys to primitive values, and by allowing mementos to have other mementos as children (arranged into a tree). A robust external storage format based on XML is used.
The key for an attribute may be any alpha numeric value. However, the value of TAG_ID is reserved for internal use.
This interface is not intended to be implemented or extended by clients.
Definition at line 64 of file berryIMemento.h.
| berry::IMemento::~IMemento | ( | ) | [virtual] |
Definition at line 23 of file berryIMemento.cpp.
| virtual berryInterfaceMacro (IMemento, berry) static const std IMemento::Pointer berry::IMemento::CreateChild | ( | const std::string & | type | ) | [pure virtual] |
Special reserved key used to store the memento id (value "IMemento.internal.id").
The GetChild and GetChildren methods are used to retrieve children of a given type.
| type | the type |
| virtual IMemento::Pointer berry::IMemento::CreateChild | ( | const std::string & | type, |
| const std::string & | id | ||
| ) | [pure virtual] |
Creates a new child of this memento with the given type and id. The id is stored in the child memento (using a special reserved key, TAG_ID) and can be retrieved using GetID.
The GetChild and GetChildren methods are used to retrieve children of a given type.
| type | the type |
| id | the child id |
Implemented in berry::XMLMemento.
| virtual std::vector<std::string> berry::IMemento::GetAttributeKeys | ( | ) | const [pure virtual] |
Returns an array of all the attribute keys of the memento. This will not be null. If there are no keys, an array of length zero will be returned.
Implemented in berry::XMLMemento.
| virtual bool berry::IMemento::GetBoolean | ( | const std::string & | key, |
| bool & | value | ||
| ) | const [pure virtual] |
Gets the boolean value of the given key.
| key | the key |
| value | the value of the given key |
Implemented in berry::XMLMemento.
| virtual IMemento::Pointer berry::IMemento::GetChild | ( | const std::string & | type | ) | const [pure virtual] |
Returns the first child with the given type id.
| type | the type id |
Implemented in berry::XMLMemento.
| virtual std::vector<IMemento::Pointer> berry::IMemento::GetChildren | ( | const std::string & | type | ) | const [pure virtual] |
Returns all children with the given type id.
| type | the type id |
Implemented in berry::XMLMemento.
| virtual bool berry::IMemento::GetFloat | ( | const std::string & | key, |
| double & | value | ||
| ) | const [pure virtual] |
Gets the floating point value of the given key.
| key | the key |
| value | the value of the given key |
Implemented in berry::XMLMemento.
| virtual std::string berry::IMemento::GetID | ( | ) | const [pure virtual] |
Returns the id for this memento.
"" if none Implemented in berry::XMLMemento.
| virtual bool berry::IMemento::GetInteger | ( | const std::string & | key, |
| int & | value | ||
| ) | const [pure virtual] |
Gets the integer value of the given key.
| key | the key |
| value | the value of the given key |
Implemented in berry::XMLMemento.
| virtual bool berry::IMemento::GetString | ( | const std::string & | key, |
| std::string & | value | ||
| ) | const [pure virtual] |
Gets the string value of the given key.
| key | the key |
| value | the value of the given key |
Implemented in berry::XMLMemento.
| virtual const std::string& berry::IMemento::GetTextData | ( | ) | const [pure virtual] |
Returns the data of the Text node of the memento. Each memento is allowed only one Text node.
null if the memento has no Text node. Implemented in berry::XMLMemento.
| virtual std::string berry::IMemento::GetType | ( | ) | const [pure virtual] |
Returns the type for this memento.
Implemented in berry::XMLMemento.
| virtual void berry::IMemento::PutBoolean | ( | const std::string & | key, |
| bool | value | ||
| ) | [pure virtual] |
Sets the value of the given key to the given boolean value.
| key | the key |
| value | the value |
Implemented in berry::XMLMemento.
| virtual void berry::IMemento::PutFloat | ( | const std::string & | key, |
| double | value | ||
| ) | [pure virtual] |
Sets the value of the given key to the given floating point number.
| key | the key |
| value | the value |
Implemented in berry::XMLMemento.
| virtual void berry::IMemento::PutInteger | ( | const std::string & | key, |
| int | value | ||
| ) | [pure virtual] |
Sets the value of the given key to the given integer.
| key | the key |
| value | the value |
Implemented in berry::XMLMemento.
| virtual void berry::IMemento::PutMemento | ( | IMemento::Pointer | memento | ) | [pure virtual] |
Copy the attributes and children from memento to the receiver.
| memento | the IMemento to be copied. |
Implemented in berry::XMLMemento.
| virtual void berry::IMemento::PutString | ( | const std::string & | key, |
| const std::string & | value | ||
| ) | [pure virtual] |
Sets the value of the given key to the given const std::string&.
| key | the key |
| value | the value |
Implemented in berry::XMLMemento.
| virtual void berry::IMemento::PutTextData | ( | const std::string & | data | ) | [pure virtual] |
Sets the memento's Text node to contain the given data. Creates the Text node if none exists. If a Text node does exist, it's current contents are replaced. Each memento is allowed only one text node.
| data | the data to be placed on the Text node |
Implemented in berry::XMLMemento.