An unsorted list of key/value pairs. More...
#include <entitylib.h>
Data Structures | |
class | KeyContext |
Public Types | |
typedef KeyValue | Value |
typedef MemberCaller1 < EntityKeyValues, const KeyValues &,&EntityKeyValues::importState > | UndoImportCaller |
Public Member Functions | |
EntityKeyValues (EntityClass *eclass) | |
EntityKeyValues (const EntityKeyValues &other) | |
~EntityKeyValues () | |
void | importState (const KeyValues &keyValues) |
void | attach (Observer &observer) |
void | detach (Observer &observer) |
void | forEachKeyValue_instanceAttach (MapFile *map) |
void | forEachKeyValue_instanceDetach (MapFile *map) |
void | instanceAttach (MapFile *map) |
void | instanceDetach (MapFile *map) |
EntityClass & | getEntityClass () const |
void | forEachKeyValue (Visitor &visitor) const |
void | setKeyValue (const std::string &key, const std::string &value) |
const char * | getKeyValue (const std::string &key) const |
Searches the value for a given property key, returns default key if not found. | |
void | addMandatoryKeyValues () |
Add missing mandatory key/value-pairs to actual entity. | |
bool | isContainer () const |
Static Public Member Functions | |
static StringPool & | getPool () |
static void | setKeyValueChangedFunc (EntityCreator::KeyValueChangedFunc func) |
static void | setCounter (Counter *counter) |
Data Fields | |
bool | m_isContainer |
Private Types | |
typedef Static< StringPool, KeyContext > | KeyPool |
typedef PooledString< KeyPool > | Key |
typedef SmartPointer< KeyValue > | KeyValuePtr |
typedef UnsortedMap< Key, KeyValuePtr > | KeyValues |
typedef UnsortedSet< Observer * > | Observers |
Private Member Functions | |
void | notifyInsert (const char *key, Value &value) |
void | notifyErase (const char *key, Value &value) |
void | forEachKeyValue_notifyInsert () |
void | forEachKeyValue_notifyErase () |
void | insert (const char *key, const KeyValuePtr &keyValue) |
void | insert (const char *key, const char *value) |
void | erase (KeyValues::iterator i) |
void | erase (const char *key) |
const char * | getKeyValueOrNull (const std::string &key) const |
Searches the value for a given property key, returns 0 if not found. | |
Private Attributes | |
EntityClass * | m_eclass |
KeyValues | m_keyValues |
Observers | m_observers |
ObservedUndoableObject< KeyValues > | m_undo |
bool | m_instanced |
bool | m_observerMutex |
Static Private Attributes | |
static EntityCreator::KeyValueChangedFunc | m_entityKeyValueChanged |
static Counter * | m_counter |
An unsorted list of key/value pairs.
Definition at line 380 of file entitylib.h.
typedef PooledString<KeyPool> EntityKeyValues::Key [private] |
Definition at line 399 of file entitylib.h.
typedef Static<StringPool, KeyContext> EntityKeyValues::KeyPool [private] |
Definition at line 398 of file entitylib.h.
typedef SmartPointer<KeyValue> EntityKeyValues::KeyValuePtr [private] |
Definition at line 400 of file entitylib.h.
typedef UnsortedMap<Key, KeyValuePtr> EntityKeyValues::KeyValues [private] |
Definition at line 401 of file entitylib.h.
typedef UnsortedSet<Observer*> EntityKeyValues::Observers [private] |
Definition at line 404 of file entitylib.h.
typedef MemberCaller1<EntityKeyValues, const KeyValues&, &EntityKeyValues::importState> EntityKeyValues::UndoImportCaller |
Definition at line 544 of file entitylib.h.
typedef KeyValue EntityKeyValues::Value |
Definition at line 383 of file entitylib.h.
EntityKeyValues::EntityKeyValues | ( | EntityClass * | eclass | ) | [inline] |
Definition at line 500 of file entitylib.h.
EntityKeyValues::EntityKeyValues | ( | const EntityKeyValues & | other | ) | [inline] |
Definition at line 505 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), i, insert(), and m_keyValues.
EntityKeyValues::~EntityKeyValues | ( | ) | [inline] |
Definition at line 513 of file entitylib.h.
References UnsortedSet< Value >::begin(), UnsortedSet< Value >::empty(), UnsortedSet< Value >::end(), i, and m_observers.
void EntityKeyValues::addMandatoryKeyValues | ( | ) | [inline, virtual] |
Add missing mandatory key/value-pairs to actual entity.
Implements Entity.
Definition at line 639 of file entitylib.h.
References EntityClass::getDefaultForAttribute(), getKeyValueOrNull(), i, EntityClass::m_attributes, m_eclass, and setKeyValue().
void EntityKeyValues::attach | ( | Observer & | observer | ) | [inline, virtual] |
Implements Entity.
Definition at line 546 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), i, Entity::Observer::insert(), UnsortedSet< Value >::insert(), m_keyValues, m_observerMutex, and m_observers.
Referenced by NameKeys::NameKeys(), and TargetableInstance::TargetableInstance().
void EntityKeyValues::detach | ( | Observer & | observer | ) | [inline, virtual] |
Implements Entity.
Definition at line 554 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), Entity::Observer::erase(), UnsortedSet< Value >::erase(), i, m_keyValues, m_observerMutex, and m_observers.
Referenced by NameKeys::~NameKeys(), and TargetableInstance::~TargetableInstance().
void EntityKeyValues::erase | ( | const char * | key | ) | [inline, private] |
Definition at line 474 of file entitylib.h.
References UnsortedMap< Key, Value >::end(), erase(), UnsortedMap< Key, Value >::find(), i, m_keyValues, and m_undo.
void EntityKeyValues::erase | ( | KeyValues::iterator | i | ) | [inline, private] |
Definition at line 462 of file entitylib.h.
References UnsortedMap< Key, Value >::erase(), key, m_instanced, m_keyValues, m_undo, and notifyErase().
Referenced by erase(), importState(), and setKeyValue().
void EntityKeyValues::forEachKeyValue | ( | Visitor & | visitor | ) | const [inline, virtual] |
Implements Entity.
Definition at line 602 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), i, m_keyValues, and Entity::Visitor::visit().
void EntityKeyValues::forEachKeyValue_instanceAttach | ( | MapFile * | map | ) | [inline] |
Definition at line 563 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), i, and m_keyValues.
Referenced by instanceAttach().
void EntityKeyValues::forEachKeyValue_instanceDetach | ( | MapFile * | map | ) | [inline] |
Definition at line 569 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), i, and m_keyValues.
Referenced by instanceDetach().
void EntityKeyValues::forEachKeyValue_notifyErase | ( | ) | [inline, private] |
Definition at line 434 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), i, m_keyValues, and notifyErase().
void EntityKeyValues::forEachKeyValue_notifyInsert | ( | ) | [inline, private] |
Definition at line 428 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), i, m_keyValues, and notifyInsert().
EntityClass& EntityKeyValues::getEntityClass | ( | ) | const [inline, virtual] |
Implements Entity.
Definition at line 598 of file entitylib.h.
References m_eclass.
Referenced by NamedEntity::identifierChanged(), NamedEntity::name(), and TargetableInstance::render().
const char* EntityKeyValues::getKeyValue | ( | const std::string & | key | ) | const [inline, virtual] |
Searches the value for a given property key, returns default key if not found.
[in] | key | The property key to get the value for |
Implements Entity.
Definition at line 627 of file entitylib.h.
References EntityClass_valueForKey(), getKeyValueOrNull(), and m_eclass.
const char* EntityKeyValues::getKeyValueOrNull | ( | const std::string & | key | ) | const [inline, private] |
Searches the value for a given property key, returns 0 if not found.
key | the property key to get the value for |
Definition at line 488 of file entitylib.h.
References UnsortedMap< Key, Value >::end(), UnsortedMap< Key, Value >::find(), i, and m_keyValues.
Referenced by addMandatoryKeyValues(), and getKeyValue().
static StringPool& EntityKeyValues::getPool | ( | ) | [inline, static] |
Definition at line 385 of file entitylib.h.
void EntityKeyValues::importState | ( | const KeyValues & | keyValues | ) | [inline] |
Definition at line 532 of file entitylib.h.
References UnsortedMap< Key, Value >::begin(), UnsortedMap< Key, Value >::end(), erase(), i, insert(), m_entityKeyValueChanged, and m_keyValues.
void EntityKeyValues::insert | ( | const char * | key, | |
const char * | value | |||
) | [inline, private] |
Definition at line 451 of file entitylib.h.
References UnsortedMap< Key, Value >::end(), EntityClass_valueForKey(), UnsortedMap< Key, Value >::find(), i, insert(), m_eclass, m_keyValues, and m_undo.
void EntityKeyValues::insert | ( | const char * | key, | |
const KeyValuePtr & | keyValue | |||
) | [inline, private] |
Definition at line 441 of file entitylib.h.
References i, UnsortedMap< Key, Value >::insert(), m_instanced, m_keyValues, m_undo, and notifyInsert().
Referenced by EntityKeyValues(), importState(), insert(), and setKeyValue().
void EntityKeyValues::instanceAttach | ( | MapFile * | map | ) | [inline] |
Definition at line 576 of file entitylib.h.
References forEachKeyValue_instanceAttach(), m_counter, m_instanced, and m_undo.
void EntityKeyValues::instanceDetach | ( | MapFile * | map | ) | [inline] |
Definition at line 586 of file entitylib.h.
References forEachKeyValue_instanceDetach(), m_counter, m_instanced, and m_undo.
bool EntityKeyValues::isContainer | ( | ) | const [inline, virtual] |
void EntityKeyValues::notifyErase | ( | const char * | key, | |
Value & | value | |||
) | [inline, private] |
Definition at line 420 of file entitylib.h.
References UnsortedSet< Value >::begin(), UnsortedSet< Value >::end(), i, m_observerMutex, and m_observers.
Referenced by erase(), and forEachKeyValue_notifyErase().
void EntityKeyValues::notifyInsert | ( | const char * | key, | |
Value & | value | |||
) | [inline, private] |
Definition at line 412 of file entitylib.h.
References UnsortedSet< Value >::begin(), UnsortedSet< Value >::end(), i, m_observerMutex, and m_observers.
Referenced by forEachKeyValue_notifyInsert(), and insert().
static void EntityKeyValues::setCounter | ( | Counter * | counter | ) | [inline, static] |
Definition at line 527 of file entitylib.h.
References m_counter.
void EntityKeyValues::setKeyValue | ( | const std::string & | key, | |
const std::string & | value | |||
) | [inline, virtual] |
Set a keyvalue on the entity.
Implements Entity.
Definition at line 612 of file entitylib.h.
References erase(), insert(), and m_entityKeyValueChanged.
Referenced by addMandatoryKeyValues().
static void EntityKeyValues::setKeyValueChangedFunc | ( | EntityCreator::KeyValueChangedFunc | func | ) | [inline, static] |
Definition at line 522 of file entitylib.h.
References m_entityKeyValueChanged.
Counter* EntityKeyValues::m_counter [static, private] |
Definition at line 391 of file entitylib.h.
Referenced by instanceAttach(), instanceDetach(), and setCounter().
EntityClass* EntityKeyValues::m_eclass [private] |
Definition at line 393 of file entitylib.h.
Referenced by addMandatoryKeyValues(), getEntityClass(), getKeyValue(), and insert().
EntityCreator::KeyValueChangedFunc EntityKeyValues::m_entityKeyValueChanged [static, private] |
Definition at line 390 of file entitylib.h.
Referenced by importState(), setKeyValue(), and setKeyValueChangedFunc().
bool EntityKeyValues::m_instanced [private] |
Definition at line 408 of file entitylib.h.
Referenced by erase(), insert(), instanceAttach(), and instanceDetach().
Definition at line 498 of file entitylib.h.
Referenced by isContainer().
KeyValues EntityKeyValues::m_keyValues [private] |
Definition at line 402 of file entitylib.h.
Referenced by attach(), detach(), EntityKeyValues(), erase(), forEachKeyValue(), forEachKeyValue_instanceAttach(), forEachKeyValue_instanceDetach(), forEachKeyValue_notifyErase(), forEachKeyValue_notifyInsert(), getKeyValueOrNull(), importState(), and insert().
bool EntityKeyValues::m_observerMutex [private] |
Definition at line 410 of file entitylib.h.
Referenced by attach(), detach(), notifyErase(), and notifyInsert().
Observers EntityKeyValues::m_observers [private] |
Definition at line 405 of file entitylib.h.
Referenced by attach(), detach(), notifyErase(), notifyInsert(), and ~EntityKeyValues().
ObservedUndoableObject<KeyValues> EntityKeyValues::m_undo [private] |
Definition at line 407 of file entitylib.h.
Referenced by erase(), insert(), instanceAttach(), and instanceDetach().