Detailed Description
template<typename K, typename V>
class PMap< K, V >
Generic (templated) associative container; NOT thread-safe.
How to iterate over a PMap?
#include <PMap.h>
Constructor & Destructor Documentation
◆ PMap() [1/2]
◆ PMap() [2/2]
Constructs a shared copy of other.
Member Function Documentation
◆ Clear()
◆ Get() [1/6]
Returns PResult::C_OK and the value to which the specified key is mapped.
If there is no mapping for the specified key, then an error is returned; output value (2nd argument) remains unchanged.
◆ Get() [2/6]
Returns PResult::C_OK and the value to which the specified key is mapped (if the value is a PBool (see PBoxing) or a PString representing a boolean value, see PString::ToBool()).
If there is no mapping for the specified key, then an error is returned; output value (2nd argument) remains unchanged.
◆ Get() [3/6]
PResult PMap< K, V >::Get | ( | const K & | key, |
papillon::int32 & | value | ||
) | const |
Returns PResult::C_OK and the value to which the specified key is mapped (if the value is a PInt32 (see PBoxing) or a PString representing an int32 value, see PString::ToInt32()).
If there is no mapping for the specified key, then an error is returned; output value (2nd argument) remains unchanged.
◆ Get() [4/6]
PResult PMap< K, V >::Get | ( | const K & | key, |
papillon::int64 & | value | ||
) | const |
Returns PResult::C_OK and the value to which the specified key is mapped (if the value is a PInt64, PInt32 (see PBoxing) or a PString representing an int64 value, see PString::ToInt64()).
If there is no mapping for the specified key, then an error is returned; output value (2nd argument) remains unchanged.
◆ Get() [5/6]
Returns PResult::C_OK and the value to which the specified key is mapped (if the value is a PFloat, PInt64, PInt32 (see PBoxing) or a PString representing a float value, see PString::ToFloat()).
If there is no mapping for the specified key, then an error is returned; output value (2nd argument) remains unchanged.
◆ Get() [6/6]
Returns PResult::C_OK and the value to which the specified key is mapped (if the value is a PDouble, PFloat, PInt64, PInt32 (see PBoxing) or a PString representing a double value, see PString::ToDouble()).
If there is no mapping for the specified key, then an error is returned; output value (2nd argument) remains unchanged.
◆ GetKeyList()
Returns a list (unordered) of all the keys contained in this map.
◆ GetValueList()
Returns a list (unordered) of all the values contained in this map.
◆ Has()
bool PMap< K, V >::Has | ( | const K & | key | ) | const |
Returns true if this map contains an entry for the specified key, false otherwise.
◆ IsEmpty()
bool PMap< K, V >::IsEmpty | ( | ) | const |
Returns true if this map is empty, false otherwise.
- See also
- Size()
◆ Iterator()
PMapIterator<K, V> PMap< K, V >::Iterator | ( | ) | const |
Returns an iterator on this map.
◆ Merge()
Extracts all the elements contained in other and insert them into this map.
◆ operator=()
Performs a shared copy of other to this object.
◆ Put()
Associates the specified value with the specified key in this map.
A new entry is added if the key does not exist, otherwise current value is replaced by the new one. Calls to Put() can be chained.
◆ Remove()
Removes the mapping for the specified key from this map if present.
Returns PResult::C_OK if success, another result otherwise.