#include "ycp/YCPBuiltinMap.h"#include "ycp/YCPMap.h"#include "ycp/YCPSymbol.h"#include "ycp/YCPBoolean.h"#include "ycp/YCPInteger.h"#include "ycp/YCPCode.h"#include "ycp/YCPVoid.h"#include "ycp/StaticDeclaration.h"#include "ycp/y2log.h"Functions | |
| static YCPValue | m_haskey (const YCPMap &map, const YCPValue &value) |
| static YCPValue | m_filter (const YCPSymbol &key, const YCPSymbol &value, const YCPMap &map, const YCPCode &expr) |
| static YCPValue | m_mapmap (const YCPSymbol &key, const YCPSymbol &value, const YCPMap &map, const YCPCode &expr) |
| static YCPValue | m_maplist (const YCPSymbol &key, const YCPSymbol &value, const YCPMap &map, const YCPCode &expr) |
| static YCPValue | m_unionmap (const YCPMap &map1, const YCPMap &map2) |
| static YCPValue | m_addmap (const YCPMap &map, const YCPValue &key, const YCPValue &value) |
| static YCPValue | m_changemap (YCPMap &map, const YCPValue &key, const YCPValue &value) |
| static YCPValue | m_size (const YCPValue &map) |
| static YCPValue | m_foreach (const YCPValue &key, const YCPValue &val, const YCPMap &map, const YCPCode &expr) |
| static YCPValue | m_tomap (const YCPValue &v) |
| static YCPValue | m_remove (const YCPMap &map, const YCPValue &key) |
Variables | |
| StaticDeclaration | static_declarations |
| static YCPValue m_addmap | ( | const YCPMap & | map, | |
| const YCPValue & | key, | |||
| const YCPValue & | value | |||
| ) | [static] |
add Add a key/value pair to a map
Adds the key/value pair k : v to the map MAP and returns the newly Created map. If the key KEY exists in KEY, the old key/value pair is replaced with the new one. Functionality partly replaced with syntax: map map m = $["a":1]; m["b"] = 2; -> $["a":1, "b":2]
| map | MAP | |
| any | KEY | |
| any | VALUE |
change Change element pair in a map. Deprecated, use MAP[KEY] = VALUE. Before Code 9, this was used to change a map directly without creating a copy. Now it is a synonym for add.
| map | MAP | |
| any | KEY | |
| any | VALUE |
| static YCPValue m_filter | ( | const YCPSymbol & | key, | |
| const YCPSymbol & | value, | |||
| const YCPMap & | map, | |||
| const YCPCode & | expr | |||
| ) | [static] |
filter Filter a Map For each key/value pair of the map MAP the expression EXPR is evaluated in a new block, where the variable KEY is assigned to the key and VALUE to the value of the pair. If the expression evaluates to true, the key/value pair is appended to the returned map.
| any | KEY | |
| any | VALUE | |
| map | MAP | |
| blocl | EXPR |
| static YCPValue m_foreach | ( | const YCPValue & | key, | |
| const YCPValue & | val, | |||
| const YCPMap & | map, | |||
| const YCPCode & | expr | |||
| ) | [static] |
foreach Process the content of a map For each key:value pair of the map MAP the expression EXPR is executed in a new block, where the variables KEY is bound to the key and VALUE is bound to the value. The return value of the last execution of exp is the value of the foreach construct.
| any | KEY | |
| any | VALUE | |
| map | MAP | |
| any | EXPR |
haskey Check if map has a certain key
Determines whether the map MAP contains a pair with the key KEY. Returns true if this is true.
| map | MAP | |
| any | KEY |
| static YCPValue m_maplist | ( | const YCPSymbol & | key, | |
| const YCPSymbol & | value, | |||
| const YCPMap & | map, | |||
| const YCPCode & | expr | |||
| ) | [static] |
maplist Maps an operation onto all elements key/value and create a list Maps an operation onto all elements key/value pairs of a map and thus creates a list.
For each key/value pair of the map MAP the expression e is evaluated in a new block, where the variable KEY is assigned to the key and VALUE to the value of the pair. The result is the list of those evaluations.
| any | KEY | |
| any | VALUE | |
| map | MAP | |
| block | EXPR |
| static YCPValue m_mapmap | ( | const YCPSymbol & | key, | |
| const YCPSymbol & | value, | |||
| const YCPMap & | map, | |||
| const YCPCode & | expr | |||
| ) | [static] |
mapmap Maps an operation onto all key/value pairs of a map
Maps an operation onto all key/value pairs of the map MAP and thus creates a new map. For each key/value pair of the map MAP the expression EXPR is evaluated in a new block, where the variable KEY is assigned to the key and VALUE to the value of the pair. The result is the map of those evaluations.
The result of each evaluation must be a map with a single entry which will be added to the result map.
| any | KEY | |
| any | VALUE | |
| map | MAP | |
| block | EXPR |
remove Remove key/value pair from a map
Remove the value with the key KEY from a map. Returns nil if the key is invalid.
| map | MAP | |
| any | KEY |
size Size of a map
Returns the number of key/value pairs in the map MAP.
| map | MAP |
tomap Converts a value to a map.
If the value can't be converted to a map, nilmap is returned. Functionality partly replaced with retyping: any a = $[1:1, 2:2]; map m = (map) a;
| any | VALUE |
union Union of 2 maps Interprets two maps as sets and returns a new map that has all elements of the first map MAP1and all of the second map MAP2. If elements have identical keys, values from MAP2 overwrite elements from MAP1.
| map | MAP1 | |
| map | MAP2 |
1.5.3