Associative array template.
More...
Associative array template.
Usage:
prg_count.
Insert(
"hello", 10);
prg_count.
Insert(
"world", 20);
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
Associative array template.
Definition Types.c:485
proto TValue Get(TKey key)
Search for an element with the given key.
proto bool Insert(TKey key, TValue value)
Insert new element into map.
◆ Begin()
◆ Clear()
| proto native void map.Clear |
( |
| ) |
|
◆ Contains()
| proto bool map.Contains |
( |
TKey | key | ) |
|
Returns whether map contains element with given key.
◆ Copy()
| proto int map.Copy |
( |
map< TKey, TValue > | from | ) |
|
◆ Count()
| proto native int map.Count |
( |
| ) |
|
- Returns
- Number of elements in the map.
◆ End()
◆ Find()
| proto bool map.Find |
( |
TKey | key, |
|
|
out TValue | val ) |
Search for an element with the given key.
- Parameters
-
| key | The key of the element to find. |
| [out] | val | Destination where result will be stored. |
- Returns
true if given key exist.
◆ Get()
| proto TValue map.Get |
( |
TKey | key | ) |
|
Search for an element with the given key.
- Parameters
-
| key | The key of the element to find. |
- Returns
- value associated to given key or default for value type when key is not present
◆ GetElement()
| proto TValue map.GetElement |
( |
int | index | ) |
|
Return the i-th element in the map.
- Note
- This operation is O(n) complexity. Use with care!
- Parameters
-
| index | The position of the element in the map. |
- Returns
- The element on the i-th position.
◆ GetIteratorElement()
◆ GetIteratorKey()
◆ GetKey()
| proto TKey map.GetKey |
( |
int | i | ) |
|
Return the i-th element key in the map.
- Note
- This operation is O(n) complexity. Use with care!
- Parameters
-
| i | The position of the element key in the map. |
- Returns
- Return key of i-th element.
◆ GetKeyByValue()
| TKey map.GetKeyByValue |
( |
TValue | value | ) |
|
◆ Insert()
| proto bool map.Insert |
( |
TKey | key, |
|
|
TValue | value ) |
Insert new element into map.
- Parameters
-
| key | Key of element to be inserted. |
| value | Data of element to be inserted. |
◆ IsEmpty()
| proto native bool map.IsEmpty |
( |
| ) |
|
- Returns
true if the map size is 0, false otherwise.
◆ Next()
◆ Remove()
| proto bool map.Remove |
( |
TKey | key | ) |
|
◆ RemoveElement()
| proto bool map.RemoveElement |
( |
int | i | ) |
|
Removes i-th element with given key.
- Note
- This operation is O(n) complexity. Use with care!
- Parameters
-
| i | The position of the element key in the map. |
- Returns
true if element was removed.
◆ ReplaceKey()
| bool map.ReplaceKey |
( |
TKey | old_key, |
|
|
TKey | new_key ) |
◆ Set()
| proto void map.Set |
( |
TKey | key, |
|
|
TValue | value ) |
Sets value of element with given key.
If element with key does not exist, it is created.
- Note
- Creating new elements is faster using Insert() function.
◆ Take()
| proto bool map.Take |
( |
TKey | key, |
|
|
out TValue | value ) |
Search for an element with the given key and remove it.
- Parameters
-
| key | The key of the element to find and remove. |
| [out] | value | Destination where result will be stored. |
- Returns
true if element was removed.
The documentation for this interface was generated from the following file: