libRocket
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | List of all members
Rocket::Core::Dictionary Class Reference

#include <Dictionary.h>

Public Member Functions

 Dictionary ()
 
 Dictionary (const Dictionary &dict)
 
 ~Dictionary ()
 
void Set (const String &key, const Variant &value)
 Store an item in the dictionary. More...
 
template<typename T >
void Set (const String &key, const T &value)
 Templated set eases setting of values. More...
 
Variant * Get (const String &key) const
 Get an item from the dictionary. More...
 
Variant * operator[] (const String &key) const
 
template<typename T >
T Get (const String &key, const T &default_val) const
 
template<typename T >
bool GetInto (const String &key, T &value) const
 
bool Remove (const String &key)
 Remove an item from the dictionary. More...
 
bool Iterate (int &pos, String &key, Variant *&value) const
 Iterate through a dictionary. More...
 
template<typename T >
bool Iterate (int &pos, String &key, T &value) const
 
bool Reserve (int size)
 Reserve the specified number of entries in the dictionary. More...
 
void Clear ()
 Empty the dictionary. More...
 
bool IsEmpty () const
 Is the dictionary empty? More...
 
int Size () const
 Items in the dict. More...
 
void Merge (const Dictionary &dict)
 Merges another dictionary into this one. Any existing values stored against similar keys will be updated. More...
 
void operator= (const Dictionary &dict)
 

Detailed Description

A dictionay is a container of variants. It uses a hash table to maintain a string key to variant mapping.

Author
Lloyd Weehuizen

Constructor & Destructor Documentation

Rocket::Core::Dictionary::Dictionary ( )
Rocket::Core::Dictionary::Dictionary ( const Dictionary &  dict)
Rocket::Core::Dictionary::~Dictionary ( )

Member Function Documentation

void Rocket::Core::Dictionary::Clear ( )

Empty the dictionary.

Variant* Rocket::Core::Dictionary::Get ( const String &  key) const

Get an item from the dictionary.

template<typename T >
T Rocket::Core::Dictionary::Get ( const String &  key,
const T &  default_val 
) const
inline

Get a value from the dictionary, if it doesn't exist use the supplied default value

template<typename T >
bool Rocket::Core::Dictionary::GetInto ( const String &  key,
T &  value 
) const
inline

Get a value from the dictionary, returns if the value was found or not.

bool Rocket::Core::Dictionary::IsEmpty ( ) const

Is the dictionary empty?

bool Rocket::Core::Dictionary::Iterate ( int &  pos,
String &  key,
Variant *&  value 
) const

Iterate through a dictionary.

template<typename T >
bool Rocket::Core::Dictionary::Iterate ( int &  pos,
String &  key,
T &  value 
) const
inline
void Rocket::Core::Dictionary::Merge ( const Dictionary &  dict)

Merges another dictionary into this one. Any existing values stored against similar keys will be updated.

void Rocket::Core::Dictionary::operator= ( const Dictionary &  dict)
Variant* Rocket::Core::Dictionary::operator[] ( const String &  key) const
bool Rocket::Core::Dictionary::Remove ( const String &  key)

Remove an item from the dictionary.

bool Rocket::Core::Dictionary::Reserve ( int  size)

Reserve the specified number of entries in the dictionary.

void Rocket::Core::Dictionary::Set ( const String &  key,
const Variant &  value 
)

Store an item in the dictionary.

template<typename T >
void Rocket::Core::Dictionary::Set ( const String &  key,
const T &  value 
)
inline

Templated set eases setting of values.

int Rocket::Core::Dictionary::Size ( ) const

Items in the dict.


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