Description
The Map class is a case sensitive key-value container, where the keys
are strings. Keys will all be unique.
Operators
- object&
operator[]( string key ) – Accesses value at location
key, performing an insert if
key does not already exist.
- Map&
operator =( Map m ) – Copies the values from Map
m. Returns this object.
- bool
operator ==( Map m ) – Returns true if both Maps contain the
same number of entries, and each entry is equal to the corresponding entry in
the other Map.
Methods
- object&
at( string key ) – Accesses value at location
key. Throws exception if not found.
- void
clear() – Empties the Map.
- bool
empty() – Returns true if the Map is empty.
- size_t
size() – Returns the count of items in the Map.
- size_t
count( string key ) – Returns 1 if
key is found inside the container; otherwise, 0.
- size_t
erase( string key ) – Removes specified elements from the
container, if one exists. Returns 1 if
key is found inside the container; otherwise, 0.
- void
insert( Map m ) – Copies values from
m into this Map. Ignores values from
m with keys that are already in this map.
- void
insert( Map_Pair p ) – Inserts value
p into this Map. Ignores
p if the key value is already in this map.
Map_Pair
The entries in a Map are of type
Map_Pair, which holds a string and a value.
Constructors (Map_Pair)
-
Map_Pair() – Creates an empty Map_Pair object.
-
Map_Pair(Map_Pair mp) – Creates a Map_Pair with a copy of
mp.
-
Map_Pair(string key, object v) – Creates a Map_Pair
initialized with
key and
v.
Methods (Map_Pair)
- string&
first() – Accesses the string used as the key for the entry.
- object&
second() – Accesses the object used as the value for the
entry.
Copyright © 2007–2019 Micro Focus or one of its affiliates. All rights reserved.