C12Adapter Opensource C++ Interface
|
Dictionary of keys and their values, associative collection. More...
Public Member Functions | |
MDictionary () | |
Object constructor, creates an empty dictionary. | |
MDictionary (const MStdString &properties) | |
Object constructor that accepts the list of values. More... | |
MDictionary (const MDictionary &other) | |
Object copy constructor, creates an equivalent dictionary. | |
virtual | ~MDictionary () |
Object destructor, removes allocated resources from memory. | |
MDictionary & | operator= (const MDictionary &other) |
Assignment operator. | |
unsigned | GetCount () const |
Return the number of entries in the dictionary. | |
MVariant & | GetMap () |
Access the map object of the dictionary. | |
const MVariant & | GetMap () const |
Access the constant map object of the dictionary. | |
void | Clear () |
Make dictionary empty. | |
const MVariant & | Item (const MVariant &key) const |
Return value of the key specified. More... | |
void | SetItem (const MVariant &key, const MVariant &val) |
Set (key, value) pair to the dictionary. More... | |
const MVariant & | operator[] (const MVariant &key) const |
Get the value associated with the key. More... | |
MVariant & | operator[] (const MVariant &key) |
Set or get the value associated with the key. More... | |
MVariant::VariantVector | GetAllKeys () const |
Return the list of all available keys. | |
MVariant::VariantVector | GetAllValues () const |
Return the list of all available values. | |
MStdString | AsStringUnsorted () const |
Get the string with key=value pairs enumerated in the order of their insertion. More... | |
bool | IsKeyPresent (const MVariant &key) const |
Return 'true' if the specified key exists. | |
bool | IsValuePresent (const MVariant &val) const |
Return 'true' if the specified value exist. | |
MVariant * | GetValue (const MVariant &key) |
Get a value associated with the key, or NULL if the value does not exist. | |
const MVariant * | GetValue (const MVariant &key) const |
const variant of the same function (see above) | |
void | Remove (const MVariant &key) |
Removes key and value pair from the dictionary. More... | |
bool | RemoveIfPresent (const MVariant &key) |
Removes key and value pair from the dictionary, if such key is present. More... | |
void | Merge (const MDictionary &dict) |
Merges the current dictionary with given one. | |
MDictionary * | NewClone () const |
Reflection enabled object copy constructor. | |
MStdString | AsString () const |
void | SetAsString (const MStdString &properties) |
![]() | |
virtual | ~MObject () |
Object destructor. | |
virtual const MClass * | GetClass () const =0 |
Get the final class of the object. More... | |
virtual unsigned | GetEmbeddedSizeof () const |
For embedded object types, return the size of the class. More... | |
bool | IsEmbeddedObject () const |
Tell if the object is of embedded kind. More... | |
SHOW_INTERNAL MVariant | Call (const MStdString &name, const MVariant ¶ms) |
Call the object service with parameters, given as variant. More... | |
MVariant | Call0 (const MStdString &name) |
Call the object service with no parameters. More... | |
MVariant | Call1 (const MStdString &name, const MVariant &p1) |
Call the object service with one parameter. More... | |
MVariant | Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2) |
Call the object service with two parameter. More... | |
MVariant | Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3) |
Call the object service with three parameter. More... | |
MVariant | Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4) |
Call the object service with four parameter. More... | |
MVariant | Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5) |
Call the object service with five parameter. More... | |
MVariant | Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6) |
Call the object service with six parameter. More... | |
virtual MVariant | CallV (const MStdString &name, const MVariant::VariantVector ¶ms) |
Call the object service with parameters, given as variant vector. More... | |
virtual bool | IsPropertyPresent (const MStdString &name) const |
Tell if the property with the given name exists. | |
virtual bool | IsServicePresent (const MStdString &name) const |
Tell if the service with the given name exists. | |
virtual MVariant | GetProperty (const MStdString &name) const |
Get the property value using name of the property. More... | |
virtual void | SetProperty (const MStdString &name, const MVariant &value) |
Set the property using name of the property, and value. More... | |
virtual MStdStringVector | GetAllPropertyNames () const |
Return the list of publicly available properties, persistent or not. More... | |
virtual MStdStringVector | GetAllPersistentPropertyNames () const |
Return the list of persistent properties. More... | |
virtual void | SetPersistentPropertiesToDefault () |
Set the persistent properties of the object to their default values. More... | |
virtual MVariant | GetPersistentPropertyDefaultValue (const MStdString &name) const |
Get the default value of persistent property with the name given. More... | |
virtual void | SetPersistentPropertyToDefault (const MStdString &name) |
Set the persistent property with the name given to default value. More... | |
virtual const char * | GetType () const |
Get the name of the type for the object (could be the same as class name). | |
virtual void | SetType (const MStdString &) |
Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More... | |
virtual void | Validate () |
Validate internal structures of the object. More... | |
Additional Inherited Members | |
![]() | |
static const MClass * | GetStaticClass () |
Get the declared class of this particular object. More... | |
static bool | IsClassPresent (const MStdString &name) |
Tells if the given class name is available. More... | |
![]() | |
static const MClass | s_class |
Class of MObject. | |
![]() | |
MObject () | |
Object constructor, protected as the class is abstract. | |
void | DoSetPersistentPropertiesToDefault (const MClass *staticClass) |
Set the persistent properties to their default values for one object provided the class for that object. More... | |
Dictionary of keys and their values, associative collection.
This is how a dictionary represents itself within a string:
This is how a dictionary represents itself within a J command (given as an example):
In case of a J command, value can be anything but the closing square brace.
|
explicit |
Object constructor that accepts the list of values.
Initializes the dictionary by parsing the list of keys and values and looking in the configuration source for used configuration names.
MStdString MDictionary::AsString | ( | ) | const |
Access dictionary representation as string with key=value pairs.
When the property is got, the string returned will have keys sorted. When the property is set, the string can have key=value pairs in any order. The string has the following format:
Where KEY1, KEY2, ... are key names, value1, value2 ... are their values. In case the value is of string type, the correspondent value is enclosed in quotes, and it can have C-like escape sequences.
MStdString MDictionary::AsStringUnsorted | ( | ) | const |
Get the string with key=value pairs enumerated in the order of their insertion.
The order of appearance of keys will be the order at which the keys were added into the dictionary.
The string has the following format:
Where KEY1, KEY2, ... are key names, value1, value2 ... are their values. In case the value is of string type, the correspondent value is enclosed in quotes, and it can have C-like escape sequences.
Return value of the key specified.
Throw exception if the key doesn't exist.
Get the value associated with the key.
Set or get the value associated with the key.
If the key doesn't exist in the dictionary, it is created. The value of the key associated is created with default constructor.
void MDictionary::Remove | ( | const MVariant & | key | ) |
Removes key and value pair from the dictionary.
bool MDictionary::RemoveIfPresent | ( | const MVariant & | key | ) |
Removes key and value pair from the dictionary, if such key is present.
Return true if key was actually removed.
void MDictionary::SetAsString | ( | const MStdString & | properties | ) |
Access dictionary representation as string with key=value pairs.
When the property is got, the string returned will have keys sorted. When the property is set, the string can have key=value pairs in any order. The string has the following format:
Where KEY1, KEY2, ... are key names, value1, value2 ... are their values. In case the value is of string type, the correspondent value is enclosed in quotes, and it can have C-like escape sequences.