|
cartobase 6.0.6
|
A dictionary generic Object. More...
#include <cartobase/object/property.h>


Classes | |
| class | iterator |
Public Types | |
| typedef ::sigc::signal3< void, const Object &, const std::string &, const Object & > | Signal |
| This signal type informs the slots about the sender (this), the property name and its old value. | |
Public Types inherited from carto::RCObject | |
| typedef int | RefCounterType |
Public Member Functions | |
| PropertySet () | |
| PropertySet (const PropertySet &) | |
| PropertySet & | operator= (const PropertySet &) |
| virtual | ~PropertySet () |
| Signal & | getSignalPropertyChanged () |
| template<typename T> | |
| void | addBuiltinProperty (const std::string &, T &) |
| template<typename T> | |
| void | addBuiltinProperty (const std::string &, T &, bool &provided) |
| add an optional builtin property | |
| template<typename T> | |
| bool | getProperty (const std::string &, T &) const |
| template<typename T> | |
| void | setProperty (const std::string &, const T &) |
| virtual bool | getProperty (const std::string &, Object &) const |
Access the element ok key key. | |
| virtual void | setProperty (const std::string &, Object) |
Set (insert or replace) the element of key key with the value object. | |
| virtual bool | removeProperty (const std::string &key) |
| remove an element. | |
| virtual bool | hasProperty (const std::string &) const |
check if an element exists under the key key | |
| virtual size_t | size () const |
| Number of sub-elements. | |
| virtual void | clearProperties () |
| clear the dictionary | |
| virtual void | copyBuiltinProperties (const PropertySet &source) |
| virtual Object | objectIterator () const |
| returns an object implementing the IteratorIntrerface | |
| iterator | getIterator () const |
| template<typename T> | |
| void | changeBuiltinProperty (const std::string &, T &) |
| change the reference to a builtin property | |
| template<typename T> | |
| void | changeBuiltinProperty (const std::string &, T &, bool &provided) |
| change the reference to an optional builtin property | |
| Object | getProperty (const std::string &) const |
| same as the other getProperty() functions except that the value object is returned. | |
| Object | getProperty (Object key) const |
same as the other getProperty() functions except that the key is contained in the key argument (which must implement the StringInterface). | |
Public Member Functions inherited from carto::RCObject | |
| RCObject () | |
| RCObject (const RCObject &) | |
| RCObject & | operator= (const RCObject &) |
| virtual | ~RCObject () |
Public Member Functions inherited from carto::DictionaryInterface | |
| virtual | ~DictionaryInterface () |
| virtual bool | isDictionary () const |
| Returns false if the stored object doesn't actually implement the DictionaryInterface API (needed since all GenericObject inherit this interface whatever they actually contain) | |
| Object | getProperty (const std::string &) const |
| same as the other getProperty() functions except that the value object is returned. | |
| Object | getProperty (Object key) const |
same as the other getProperty() functions except that the key is contained in the key argument (which must implement the StringInterface). | |
| template<typename T> | |
| bool | getProperty (const std::string &key, T &value) const |
same as the other getProperty() functions except that the value object must be of exact type T and is copied to the value argument. | |
| void | setProperty (const std::string &, const char *) |
| specific specialization: C strings are stored as std::string objects | |
| template<typename T> | |
| void | setProperty (const std::string &, const T &) |
same as the other setProperty() functions except that the value to be set is of the arbitrary type T and will possibly be stored in an Object. | |
| virtual void | copyProperties (Object source) |
copy all properties of the source object to this object. | |
| virtual bool | operator== (const DictionaryInterface &other) const |
| equality test | |
| virtual bool | operator!= (const DictionaryInterface &other) const |
| template<> | |
| void | setProperty (const std::string &key, Object const &value) |
| template<> | |
| bool | getProperty (const std::string &key, Object &value) const |
Public Member Functions inherited from carto::SizeInterface | |
| virtual | ~SizeInterface () |
Public Member Functions inherited from carto::Interface | |
| virtual | ~Interface () |
Public Member Functions inherited from carto::IterableInterface | |
| virtual | ~IterableInterface () |
| virtual bool | isIterable () const |
| Returns false if the stored object doesn't actually implement the IterableInterface API (needed since all GenericObject inherit this interface whatever they actually contain) | |
| virtual bool | operator== (const IterableInterface &other) const |
| equality test | |
| virtual bool | operator!= (const IterableInterface &other) const |
A dictionary generic Object.
PropertySet can replace a std::map<std::string,Object> in GenericObject implementations, and offers additional interesting features:
Definition at line 75 of file property.h.
| typedef ::sigc::signal3< void, const Object &, const std::string&, const Object& > carto::PropertySet::Signal |
This signal type informs the slots about the sender (this), the property name and its old value.
Definition at line 82 of file property.h.
| carto::PropertySet::PropertySet | ( | ) |
Referenced by copyBuiltinProperties(), objectIterator(), operator=(), and PropertySet().
| carto::PropertySet::PropertySet | ( | const PropertySet & | ) |
References PropertySet().
|
virtual |
|
inline |
Definition at line 242 of file property.h.
References carto::Object::reference().
Referenced by changeBuiltinProperty(), and changeBuiltinProperty().
|
inline |
add an optional builtin property
Definition at line 257 of file property.h.
References carto::Object::reference().
|
inline |
change the reference to a builtin property
Definition at line 273 of file property.h.
References addBuiltinProperty().
|
inline |
change the reference to an optional builtin property
Definition at line 289 of file property.h.
References addBuiltinProperty().
|
virtual |
clear the dictionary
Reimplemented from carto::DictionaryInterface.
|
virtual |
References PropertySet().
|
inline |
Definition at line 319 of file property.h.
| Object carto::DictionaryInterface::getProperty | ( | const std::string & | ) | const |
same as the other getProperty() functions except that the value object is returned.
An exception is thrown in case of failure.
|
virtual |
Access the element ok key key.
value is filled with a wrapper to the selected element. If it fails (key not found for instance), an exception is thrown.
Implements carto::DictionaryInterface.
|
inline |
Definition at line 306 of file property.h.
same as the other getProperty() functions except that the key is contained in the key argument (which must implement the StringInterface).
The value object is returned. An exception is thrown in case of failure.
| Signal & carto::PropertySet::getSignalPropertyChanged | ( | ) |
References carto::DictionaryInterface::getProperty().
|
virtual |
check if an element exists under the key key
Implements carto::DictionaryInterface.
|
virtual |
returns an object implementing the IteratorIntrerface
Implements carto::IterableInterface.
References PropertySet().
| PropertySet & carto::PropertySet::operator= | ( | const PropertySet & | ) |
References PropertySet().
|
inlinevirtual |
remove an element.
Note that on some dictionary implementations (PropertySet with builtin properties for instance), some properties cannot be removed.
Implements carto::DictionaryInterface.
Definition at line 103 of file property.h.
|
inline |
Definition at line 211 of file property.h.
References carto::Object::reference(), and carto::Object::value().
|
virtual |
Set (insert or replace) the element of key key with the value object.
On some specific dictionary implementations (such as PropertySet with builtin properties, or maps of specific, typed values), an existing property cannot change type. In this case value must hold an object of the correct type, otherwise an exception will be thrown.
Implements carto::DictionaryInterface.
|
virtual |
Number of sub-elements.
This method may throw an exception if the stored object has not a size-compatible interface
Implements carto::SizeInterface.