Map

Engine/source/core/util/tDictionary.h

A Map template class.

More...

Public Types

Sequence::ConstIterator
ConstIterator 
ConstReference 
DifferenceType 
Sequence::Iterator
Iterator 
Sequence::Pair
Pair 
Pair &
Reference 
SizeType 
ValueType 

Private Attributes

Sequence

Public Functions

Map()
Map(const Map & p)
~Map()

Iterator to first element.

Iterator to first element.

Empty the Map.

bool
contains(const Key & a)
end()

IIterator to last element + 1.

end()

Iterator to last element + 1.

erase(const Key & key)

Erase the key from the map.

Erase the given entry.

find(const Key & )

Find entry for the given key.

find(const Key & )

Find entry for the given key.

insert(const Key & key, const Value & )

Insert the key value pair but don't allow duplicates.

bool

Returns true if the map is empty.

operator[](const Key & )

Index using the given key.

resize(U32 size)
size()

Return the number of elements.

bool
tryGetValue(const Key & key, Value & val)

Try to get the value of the specified key.

Detailed Description

A Map template class.

The map class maps between a key and an associated value. Keys are unique. The hash table class is used as the default implementation so the the key must be hashable, see util/hash.h for details.

Public Types

typedef Sequence::ConstIterator ConstIterator 
typedef const Pair & ConstReference 
typedef S32 DifferenceType 
typedef Sequence::Iterator Iterator 
typedef Sequence::Pair Pair 
typedef Pair & Reference 
typedef U32 SizeType 
typedef Pair ValueType 

Private Attributes

Sequence mMap 

Public Functions

Map()

Map(const Map & p)

~Map()

begin()

Iterator to first element.

begin()

Iterator to first element.

clear()

Empty the Map.

contains(const Key & a)

end()

IIterator to last element + 1.

end()

Iterator to last element + 1.

erase(const Key & key)

Erase the key from the map.

erase(Iterator )

Erase the given entry.

find(const Key & )

Find entry for the given key.

find(const Key & )

Find entry for the given key.

insert(const Key & key, const Value & )

Insert the key value pair but don't allow duplicates.

The map class does not allow duplicates keys. If the key already exists in the map the function will fail and return end().

isEmpty()

Returns true if the map is empty.

operator[](const Key & )

Index using the given key.

If the key is not currently in the map it is added. If you just want to try to get the value without the side effect of creating the key, use tryGetValue() instead.

resize(U32 size)

size()

Return the number of elements.

tryGetValue(const Key & key, Value & val)

Try to get the value of the specified key.

Returns true and fills in the value if the key exists. Returns false otherwise. Unlike operator [], this function does not create the key/value if the key is not found.