EntityKeyValues Class Reference

An unsorted list of key/value pairs. More...

#include <entitylib.h>

Inheritance diagram for EntityKeyValues:
Inheritance graph
[legend]
Collaboration diagram for EntityKeyValues:
Collaboration graph
[legend]

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)
EntityClassgetEntityClass () 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< KeyPoolKey
typedef SmartPointer< KeyValueKeyValuePtr
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

EntityClassm_eclass
KeyValues m_keyValues
Observers m_observers
ObservedUndoableObject< KeyValuesm_undo
bool m_instanced
bool m_observerMutex

Static Private Attributes

static
EntityCreator::KeyValueChangedFunc 
m_entityKeyValueChanged
static Counter * m_counter

Detailed Description

An unsorted list of key/value pairs.

Definition at line 380 of file entitylib.h.


Member Typedef Documentation

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.

Definition at line 401 of file entitylib.h.

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.

Definition at line 383 of file entitylib.h.


Constructor & Destructor Documentation

EntityKeyValues::EntityKeyValues ( EntityClass eclass  )  [inline]

Definition at line 500 of file entitylib.h.

EntityKeyValues::EntityKeyValues ( const EntityKeyValues other  )  [inline]
EntityKeyValues::~EntityKeyValues (  )  [inline]

Member Function Documentation

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]
void EntityKeyValues::detach ( Observer observer  )  [inline, virtual]
void EntityKeyValues::erase ( const char *  key  )  [inline, private]
void EntityKeyValues::erase ( KeyValues::iterator  i  )  [inline, private]
void EntityKeyValues::forEachKeyValue ( Visitor visitor  )  const [inline, virtual]
void EntityKeyValues::forEachKeyValue_instanceAttach ( MapFile map  )  [inline]
void EntityKeyValues::forEachKeyValue_instanceDetach ( MapFile map  )  [inline]
void EntityKeyValues::forEachKeyValue_notifyErase (  )  [inline, private]
void EntityKeyValues::forEachKeyValue_notifyInsert (  )  [inline, private]
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.

Parameters:
[in] key The property key to get the value for
Returns:
The value for the given property key or the default value

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.

Parameters:
key the property key to get the value for
Returns:
the value for the given property or 0

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]
void EntityKeyValues::insert ( const char *  key,
const char *  value 
) [inline, private]
void EntityKeyValues::insert ( const char *  key,
const KeyValuePtr keyValue 
) [inline, private]
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]

Implements Entity.

Definition at line 650 of file entitylib.h.

References m_isContainer.

void EntityKeyValues::notifyErase ( const char *  key,
Value value 
) [inline, private]
void EntityKeyValues::notifyInsert ( const char *  key,
Value value 
) [inline, private]
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.


Field Documentation

Counter* EntityKeyValues::m_counter [static, private]

Definition at line 391 of file entitylib.h.

Referenced by instanceAttach(), instanceDetach(), and setCounter().

Definition at line 393 of file entitylib.h.

Referenced by addMandatoryKeyValues(), getEntityClass(), getKeyValue(), and insert().

Definition at line 390 of file entitylib.h.

Referenced by importState(), setKeyValue(), and setKeyValueChangedFunc().

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().

Definition at line 410 of file entitylib.h.

Referenced by attach(), detach(), notifyErase(), and notifyInsert().

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().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2