|
OpenTTD Source
1.10.0-RC1
|
Implementation of simple mapping class. More...
#include <smallmap_type.hpp>
Public Types | |
| typedef ::SmallPair< T, U > | Pair |
| typedef Pair * | iterator |
| typedef const Pair * | const_iterator |
Public Member Functions | |
| SmallMap () | |
| Creates new SmallMap. More... | |
| ~SmallMap () | |
| Data are freed in SmallVector 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... | |
Implementation of simple mapping class.
Both types have to be POD ("Plain Old Data")! It has inherited accessors from SmallVector().
| T | Key type. |
| U | Value type. |
| S | Unit of allocation. |
Definition at line 40 of file smallmap_type.hpp.
Creates new SmallMap.
Data are initialized in SmallVector constructor
Definition at line 46 of file smallmap_type.hpp.
|
inline |
Tests whether a key is assigned in this map.
| key | key to test |
Definition at line 93 of file smallmap_type.hpp.
Referenced by ScriptInfo::AddLabels(), GRFParameterInfo::Finalize(), UnmappedChoiceList::Flush(), and NetworkAddress::Resolve().
|
inline |
Tests whether a key is assigned in this map.
| key | key to test |
Definition at line 103 of file smallmap_type.hpp.
Removes given pair from this map.
| pair | pair to remove |
Definition at line 113 of file smallmap_type.hpp.
|
inline |
Removes given key from this map.
| key | key to remove |
Definition at line 126 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.
Referenced by ChangeGRFParamValueNames(), Vehicle::GetConsistFreeCapacities(), Layouter::GetFont(), TrueTypeFontCache::GetFontTable(), and GetRating().
Finds given key in this map.
| key | key to find |
Definition at line 69 of file smallmap_type.hpp.
|
inline |
Adds new item to this map.
| key | key |
| data | data |
Definition at line 141 of file smallmap_type.hpp.
Referenced by ScriptInfo::AddLabels(), ChangeGRFParamValueNames(), TrueTypeFontCache::GetFontTable(), and GRFParameterInfo::GRFParameterInfo().
|
inline |
Returns data belonging to this key.
| key | key |
Definition at line 154 of file smallmap_type.hpp.