OpenTTD Source
12.0-beta2
|
Implementation of simple mapping class. More...
#include <smallmap_type.hpp>
Public Types | |
typedef std::pair< T, U > | Pair |
typedef Pair * | iterator |
Public Member Functions | |
SmallMap () | |
Creates new SmallMap. More... | |
~SmallMap () | |
Data are freed in std::vector destructor. | |
std::vector< Pair >::const_iterator | Find (const T &key) const |
Finds given key in this map. More... | |
Pair * | Find (const T &key) |
Finds given key in this map. More... | |
const Pair * | End () const |
Pair * | End () |
bool | Contains (const T &key) const |
Tests whether a key is assigned in this map. More... | |
bool | Contains (const T &key) |
Tests whether a key is assigned in this map. More... | |
void | Erase (Pair *pair) |
Removes given pair from this map. More... | |
bool | Erase (const T &key) |
Removes given key from this map. More... | |
bool | Insert (const T &key, const U &data) |
Adds new item to this map. More... | |
U & | operator[] (const T &key) |
Returns data belonging to this key. More... | |
Data Fields | |
const typedef Pair * | const_iterator |
Implementation of simple mapping class.
It has inherited accessors from std::vector().
T | Key type. |
U | Value type. |
S | Unit of allocation. |
Definition at line 26 of file smallmap_type.hpp.
Creates new SmallMap.
Data are initialized in std::vector constructor
Definition at line 32 of file smallmap_type.hpp.
|
inline |
Tests whether a key is assigned in this map.
key | key to test |
Definition at line 89 of file smallmap_type.hpp.
|
inline |
Tests whether a key is assigned in this map.
key | key to test |
Definition at line 79 of file smallmap_type.hpp.
Referenced by GRFParameterInfo::Finalize(), and NetworkAddress::Resolve().
|
inline |
Removes given key from this map.
key | key to remove |
Definition at line 112 of file smallmap_type.hpp.
|
inline |
Removes given pair from this map.
pair | pair to remove |
Definition at line 99 of file smallmap_type.hpp.
|
inline |
Finds given key in this map.
key | key to find |
Definition at line 55 of file smallmap_type.hpp.
|
inline |
Finds given key in this map.
key | key to find |
Definition at line 41 of file smallmap_type.hpp.
Referenced by ChangeGRFParamValueNames(), Vehicle::GetConsistFreeCapacities(), Layouter::GetFont(), TrueTypeFontCache::GetFontTable(), and Window::GetQueryString().
|
inline |
Adds new item to this map.
key | key |
data | data |
Definition at line 127 of file smallmap_type.hpp.
Referenced by TrueTypeFontCache::GetFontTable().
|
inline |
Returns data belonging to this key.
key | key |
Definition at line 140 of file smallmap_type.hpp.