SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND


Platform::Lang::TypeConcepts
Template Class GeneralDictionaryType

GeneralContainerType
   |
   +-GeneralDictionaryType

Implemented in:
Platform.Lang.TypeConcepts.GeneralDictionaryType.h
Direct Known Subclasses:
HashMap, SortedMap

template <typename Base, typename Container, typename KeyType, typename ValueType>
class GeneralDictionaryType:
public GeneralContainerType

The base type for all the dictionary-based, associative containers.

A dictionary-based container consists of entries which map keys to values. A dictionary does not permit duplicate keys - each key in a dictionary is unique and is associated with exactly one value.

Inner Compounds, Typedefs, and Enumscollapse
class ConstEnumerator
          DOCTODO.
class ConstIterator
          DOCTODO.
struct Entry
          DOCTODO.
class Enumerator
          DOCTODO.
class Iterator
          DOCTODO.
typedef EntryType
          The type of the mapping entry (i.e.

Fields inherited from class GeneralContainerTypecollapse
base

Method Summarycollapse
Bool add(const KeyType& key, const ValueType& value)
          Adds a mapping of the specified key and value to this map.
Int addAll(const Container& container)
          Adds all the mapping in the specified container to this map.
template <typename ContainerX>
Int
addAll(const ContainerX& container)
          Adds all the mapping in the specified container to this map.
Bool containsAll(const Container& container) const
          Tests whether this map contains all of the mappings present in the specified map container.
template <typename ContainerX>
Bool
containsAll(const ContainerX& container) const
          Tests whether this map contains all of the mappings present in the specified map container.
template <typename ContainerX>
Bool
containsAllKeys(const ContainerX& container) const
          Tests whether this map contains all of the keys present in the specified container.
Bool containsKey(const KeyType& key) const
          Tests whether this map contains a mapping for the specified key.
Bool containsValue(const ValueType& value) const
          Tests whether this map contains one or more mappings to the specified value.
ValueType get(const KeyType& key) const
          Returns the value mapped to the specified key.
Bool get(const KeyType& key, ValueType& copiedValue) const
          Tests whether this map contains a mapping for the specified key.
Bool get(const KeyType& key, ValueType*& retrievedValue) const
          Tests whether this map contains a mapping for the specified key.
Bool put(const KeyType& key, const ValueType& value)
          Puts a mapping of the specified key and value into this map.
Bool put(const KeyType& key, const ValueType& value, ValueType& replacedValue)
          Puts a mapping of the specified key and value into this map.
Int putAll(const Container& container)
          Puts all the mapping in the specified container into this map.
template <typename ContainerX>
Int
putAll(const ContainerX& container)
          Puts all the mapping in the specified container into this map.
Bool remove(const KeyType& key)
          Removes the mapping for the specified key from this map.
Bool remove(const KeyType& key, ValueType& removedValue)
          Removes the mapping for the specified key from this map.
String toString() const
          Returns a string representation of this container.

Methods inherited from class GeneralContainerTypecollapse
compareTo, deepSize, empty, equals, exchangeWith, hashCode, isEmpty, size, toString, toXml

 

Method Detail

add[inline]

Bool add(const KeyType& key, const ValueType& value)

Adds a mapping of the specified key and value to this map. If the specified key already exists in this map the given mapping is rejected such that the map remains unmodified and the function returns False.

Parameters:
key - the key of the mapping to add to the map
value - the value of the mapping to associate with the key
Returns:
True if the mapping was added to the map, False otherwise

addAll[inline]

Int addAll(const Container& container)

Adds all the mapping in the specified container to this map. Mappings with keys already present in this map are rejected (meaning only new content is added to the map).

Parameters:
container - the container containing mappings to be added to this map
Returns:
the number of mappings added to this map

addAll[inline]

template <typename ContainerX>
Int addAll(const ContainerX& container)

Adds all the mapping in the specified container to this map. Mappings with keys already present in this map are rejected (meaning only new content is added to the map).

Parameters:
container - the container containing mappings to be added to this map
Returns:
the number of mappings added to this map

containsAll[inline]

Bool containsAll(const Container& container) const

Tests whether this map contains all of the mappings present in the specified map container. The order in which the mappings are tested is not significant. If the specified container is empty this method returns True.

Parameters:
container - a map containing mappings to find
Returns:
True if this map contains all of the mappings present in the specified map container, False otherwise

containsAll[inline]

template <typename ContainerX>
Bool containsAll(const ContainerX& container) const

Tests whether this map contains all of the mappings present in the specified map container. The order in which the mappings are tested is not significant. If the specified container is empty this method returns True.

Parameters:
container - a map containing mappings to find
Returns:
True if this map contains all of the mappings present in the specified map container, False otherwise

containsAllKeys[inline]

template <typename ContainerX>
Bool containsAllKeys(const ContainerX& container) const

Tests whether this map contains all of the keys present in the specified container. The order in which the keys are tested is not significant. If the specified container is empty this method returns True.

Parameters:
container - a container holding keys to find
Returns:
True if this map contains all of the keys present in the specified container, False otherwise

containsKey[inline]

Bool containsKey(const KeyType& key) const

Tests whether this map contains a mapping for the specified key.

Parameters:
key - the key to to find
Returns:
True if this map contains a mapping for the specified key, False otherwise

containsValue[inline]

Bool containsValue(const ValueType& value) const

Tests whether this map contains one or more mappings to the specified value.

Parameters:
value - the value to find
Returns:
True if this map contains one or more mappings to the specified value, False otherwise

get[inline]

ValueType get(const KeyType& key) const

Returns the value mapped to the specified key. If the key does not exist in the map the returned value is initialized by its default constructor.

Parameters:
key - the key whose associated value is to be returned
Returns:
the value mapped to the specified key, or the value initialized by its default constructor if not found

get[inline]

Bool get(const KeyType& key, ValueType& copiedValue) const

Tests whether this map contains a mapping for the specified key. If the mapping is found, the associated value is copied into the given copiedValue parameter and the function returns True. If the key does not exist in this map, the copiedValue parameter is not modified and the function returns False.

Parameters:
key - the key to find
copiedValue - the target to receive the value of the mapping if the key was found in this map
Returns:
True if this map contains a mapping for the specified key, False otherwise

get[inline]

Bool get(const KeyType& key, ValueType*& retrievedValue) const

Tests whether this map contains a mapping for the specified key. If the mapping is found, the pointer to the associated value is copied into the given retrievedValue parameter and the function returns True. If the key does not exist in this map, the retrievedValue parameter is not modified and the function returns False.

Parameters:
key - the key to find
retrievedValue - the target to receive the pointer to the value of the mapping if the key was found in this map
Returns:
True if this map contains a mapping for the specified key, False otherwise
Remarks:
returning a pointer to the mapped value avoids data copying and allows the user to directly modify the value of the mapping in the map

put[inline]

Bool put(const KeyType& key, const ValueType& value)

Puts a mapping of the specified key and value into this map. If the specified key already exists in this map its value is replaced (and lost) with the given value parameter and the function returns True. Otherwise, the new mapping is added to this map and the return value is False.

Parameters:
key - the key of the mapping to put into the map
value - the value of the mapping to associate with the key or replace if the mapping already exists
Returns:
True if the mapping already existed in this map and its value was replaced, False otherwise

put[inline]

Bool put(const KeyType& key, const ValueType& value, ValueType& replacedValue)

Puts a mapping of the specified key and value into this map. If the specified key already exists in this map its value is copied into the replacedValue parameter and then replaced with the given value parameter with the function returning True. Otherwise, the new mapping is added to this map, the replacedValue is unmodified and the return value is False.

Parameters:
key - the key of the mapping to put into the map
value - the value of the mapping to associate with the key or replace if the mapping already exists
replacedValue - the target to receive the mapping's original value if the mapping is already present in this map
Returns:
True if the mapping already existed in this map and its value was replaced, False otherwise

putAll[inline]

Int putAll(const Container& container)

Puts all the mapping in the specified container into this map. Mappings with keys already present in this map are replaced with the values from the container (meaning new content replaces the one existing in this map). The replaced values are not preserved.

Parameters:
container - the container containing mappings to be put into this map
Returns:
the number of mappings replaced in this map

putAll[inline]

template <typename ContainerX>
Int putAll(const ContainerX& container)

Puts all the mapping in the specified container into this map. Mappings with keys already present in this map are replaced with the values from the container (meaning new content replaces the one existing in this map). The replaced values are not preserved.

Parameters:
container - the container containing mappings to be put into this map
Returns:
the number of mappings replaced in this map

remove[inline]

Bool remove(const KeyType& key)

Removes the mapping for the specified key from this map. If the mapping with the specified key is not present in this map, the map is not modified and the function returns False.

Parameters:
key - the key of the mapping to remove from this map
Returns:
True if the mapping was found and removed, False otherwise

remove[inline]

Bool remove(const KeyType& key, ValueType& removedValue)

Removes the mapping for the specified key from this map. If the mapping with the specified key exists in this map, its value is copied into the removedValue parameter prior to mappings removal. If the mapping is not found, the map and the removedValue parameter will remain unmodified and the function returns False.

Parameters:
key - the key of the mapping to remove from this map
removedValue - the target to receive the value of the removed mapping, unmodified if the mapping is not found
Returns:
True if the mapping was found and removed, False otherwise

toString[inline]

String toString() const

Returns a string representation of this container.

Returns:
a string representation of the container
See Also:
Lang::toString
Overrides:
GeneralContainerType<Base, Container>::toString


SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND