cmakepp_lang/map/get_set

Defines functions to get and set key/value pairs for a CMakePPLang Map.

cmakepp_lang/map/get_set.cpp_map_get(this value key)

Retrieves the value of the specified key.

This function is used to retrieve the value associated with the provided key. If a key has not been set this function will return the empty string. Users can use cpp_map_has_key to determine whether the map does not have the key or if the key was simply set to the empty string.

Parameters:
  • this (map) – The map storing the key-value pairs.

  • value (desc) – Name for the identifier to save the value to.

  • key (str) – The key whose value we want.

Returns:

value will be set to the value associated with key. If key has no value associated with it value will be set to the empty string.

Return type:

str

Error Checking

If CMakePP is run in debug mode this function will ensure that it has been provided exactly three arguments and that those arguments are of the correct types. If any of these checks fail an error will be raised. These checks are only performed if CMakePP is being run in debug mode.

var CMAKEPP_LANG_DEBUG_MODE:

Used to determine if CMakePP is being run in debug mode.

vartype CMAKEPP_LANG_DEBUG_MODE:

bool

cmakepp_lang/map/get_set.cpp_map_set(this key value)

Associates a value with the specified key.

This function can be used to set the value of a map’s key. If the key has a value associated with it already that value will be overridden.

Parameters:
  • this (map) – The map whose key is going to be set.

  • key (str) – The key whose value is going to be set.

  • value (str) – The value to set the key to.

Error Checking

If CMakePP is run in debug mode this function will assert that it was called with exactly three arguments, and that those arguments have the correct types. If these assertions fail an error will be raised. These checks are only performed if CMakePP is run in debug mode.

var CMAKEPP_LANG_DEBUG_MODE:

Used to determine if CMakePP is being run in debug mode or not.

vartype CMAKEPP_LANG_DEBUG_MODE:

bool