#include "variables.hpp"
Go to the source code of this file.
Functions | |
std::string | get_value (std::string const &name, variable_map const *local_variables) |
std::string | expand (std::string str, variable_map const *local_variables) |
Variables | |
variable_map | global_variables |
Definition in file variables.cpp.
std::string expand | ( | std::string | str, | |
variable_map const * | local_variables = 0 | |||
) |
Expand variables in a string using a local map and the global map.
str | The string to expand | |
local_variables | The optional, local map; can be null |
Definition at line 26 of file variables.cpp.
Referenced by artifact_impl::expand(), and parse_graph().
std::string get_value | ( | std::string const & | name, | |
variable_map const * | local_variables | |||
) |
Get a variable’s value. Try the local variables first; if not found try the global variables. If still not found, define the name with an empty string and return an empty string. Subsequent lookups of the same name will find the empty string. Exercise for reader: print a message the first time the undefined variable’s name is used.
name | The variable name | |
local_variables | Pointer to the local variables map or null |
Definition at line 15 of file variables.cpp.
References global_variables.
Referenced by expand().
Listing 57-7. The variables.cpp File Implements the expand Function
Definition at line 5 of file variables.cpp.
Referenced by get_value(), and parse_graph().