![]() |
Safir SDK Core
|
Base class for all dictionary containers. More...
#include <Safir/Dob/Typesystem/DictionaryContainer.h>
Public Member Functions | |
DictionaryContainerBase () | |
Default Constructor. | |
bool | IsChangedHere () const |
Is the change flag in the container set? | |
void | SetChangedHere (const bool changed) |
Set the change flag in the container. | |
virtual size_t | size () const =0 |
Get the size of the dictionary, i.e number of contained keys. | |
virtual bool | empty () const =0 |
Check if dictionary is empty. | |
Reflection part. | |
These methods allow applications to manipulate the members of objects without having been compiled against it. There should be no reason for most applications to use these methods. | |
template<class KeyT > | |
ContainerBase & | InsertNull (const KeyT &key) |
Adds a new key to the dictionary and return the value container. | |
template<class KeyT > | |
const KeyT & | GetKeyAt (const size_t index) const |
Get the key at a particular position in the dictionary. | |
virtual ContainerBase & | GetValueContainerAt (const size_t index)=0 |
Get the container of the value at a particular position in the dictionary. | |
virtual const ContainerBase & | GetValueContainerAt (const size_t index) const =0 |
Const version of GetValueContainerAt() | |
![]() | |
constexpr | ContainerBase () |
Default Constructor. | |
constexpr | ContainerBase (const ContainerBase &)=default |
Copy constructor. | |
virtual | ~ContainerBase () |
Virtual destructor. | |
virtual bool | IsNull () const =0 |
Is the container set to null? | |
virtual void | SetNull ()=0 |
Set the container to null. | |
virtual bool | IsChanged () const |
Is the change flag set on the container? | |
virtual void | SetChanged (const bool changed) |
Set the containers change flag. | |
virtual void | Copy (const ContainerBase &that)=0 |
Virtual assignment. | |
Protected Member Functions | |
virtual ContainerBase & | InsertNullInternal (const void *key, const std::type_info &typeInfo)=0 |
virtual const void * | GetKeyAtInternal (const size_t index) const =0 |
![]() | |
ContainerBase & | operator= (const ContainerBase &other) |
Copy assignment operator. | |
Friends | |
void | Utilities::MergeChanges (ObjectPtr into, const ObjectConstPtr &from) |
Additional Inherited Members | |
![]() | |
bool | m_bIsChanged |
The variable containing the change flag. | |
Base class for all dictionary containers.
The reason for the existence of this class is that code that uses the reflection functionality must be able to get hold of members of items.
Safir::Dob::Typesystem::DictionaryContainerBase::DictionaryContainerBase | ( | ) |
Default Constructor.
|
pure virtual |
Check if dictionary is empty.
Implemented in Safir::Dob::Typesystem::DictionaryContainer< KeyT, ValT >.
const KeyT & Safir::Dob::Typesystem::DictionaryContainerBase::GetKeyAt | ( | const size_t | index | ) | const |
Get the key at a particular position in the dictionary.
Note that the order of keys in the dictionary is not guaranteed. This is not a particularly "cheap" way of accessing the contents of a dictionary. Much better to use the iterators in the implementing class.
This function needs to be called like this: dict.GetKeyAt<Int32>(10). If the dictionary does not have KeyT as its key type the behaviour is undefined.
For enumeration values, use EnumerationValue as the type, and you will get the ordinal value.
index | an index between 0 and size(). |
References GetKeyAtInternal().
|
protectedpure virtual |
Implemented in Safir::Dob::Typesystem::DictionaryContainer< KeyT, ValT >.
Referenced by GetKeyAt().
|
pure virtual |
Const version of GetValueContainerAt()
Implemented in Safir::Dob::Typesystem::DictionaryContainer< KeyT, ValT >.
|
pure virtual |
Get the container of the value at a particular position in the dictionary.
Note that the order of keys in the dictionary is not guaranteed. This is not a particularly "cheap" way of accessing the contents of a dictionary. Much better to use the iterators in the implementing class.
index | an index between 0 and size(). |
Implemented in Safir::Dob::Typesystem::DictionaryContainer< KeyT, ValT >.
ContainerBase & Safir::Dob::Typesystem::DictionaryContainerBase::InsertNull | ( | const KeyT & | key | ) |
Adds a new key to the dictionary and return the value container.
If the key already exists, the value will be overwritten.
If the dictionary does not have KeyT as its key type the behaviour is undefined. However if the keyT is an enum type together with a valid enum value, or keyT int togehter with a valid ordinal is allowed.
key | the key to be added. |
References InsertNullInternal().
|
protectedpure virtual |
Implemented in Safir::Dob::Typesystem::DictionaryContainer< KeyT, ValT >.
Referenced by InsertNull().
bool Safir::Dob::Typesystem::DictionaryContainerBase::IsChangedHere | ( | ) | const |
Is the change flag in the container set?
This method is like IsChanged without the recursion.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
void Safir::Dob::Typesystem::DictionaryContainerBase::SetChangedHere | ( | const bool | changed | ) |
Set the change flag in the container.
This method is like SetChanged without the recursion
changed | [in] - The value to set the change flag to. |
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
pure virtual |
Get the size of the dictionary, i.e number of contained keys.
Implemented in Safir::Dob::Typesystem::DictionaryContainer< KeyT, ValT >.
|
friend |