class ConfigVariableManager

A global object that maintains the set of ConfigVariables (actually, ConfigVariableCores) everywhere in the world, and keeps them in sorted order.

Inheritance diagram

Inheritance diagram of ConfigVariableManager

static ConfigVariableManager *get_global_ptr(void)
std::size_t get_num_variables(void) const

Returns the current number of active ConfigVariableCores in the world.

ConfigVariableCore *get_variable(std::size_t n) const

Returns the nth active ConfigVariableCore in the world.

std::string get_variable_name(std::size_t n) const

Returns the name of the nth active ConfigVariable in the list.

bool is_variable_used(std::size_t n) const

Returns true if the nth active ConfigVariable in the list has been used by code, false otherwise.

void list_dynamic_variables(void) const

Writes a list of all the “dynamic” variables that have been declared somewhere in code, along with a brief description. This is a (usually large) list of config variables that are declared with a generated variable name.

void list_unused_variables(void) const

Writes a list of all the variables that have been defined in a prc file without having been declared somewhere in code.

void list_variables(void) const

Writes a list of all the variables that have been declared somewhere in code, along with a brief description.

ConfigVariableCore *make_variable(std::string const &name)

Creates and returns a new, undefined ConfigVariableCore with the indicated name; or if a variable with this name has already been created, returns that one instead.

ConfigVariableCore *make_variable_template(std::string const &pattern, ConfigFlags::ValueType type, std::string const &default_value, std::string const &description = string(), int flags = 0)

Defines a variable “template” to match against dynamically-defined variables that may or may not be created in the future.

The template consists of a glob pattern, e.g. notify-level-*, which will be tested against any config variable passed to a future call to make_variable(). If the pattern matches, the returned ConfigVariableCore is copied to define the new variable, instead of creating a default, empty one.

This is useful to pre-specify default values for a family of variables that all have similar properties, and all may not be created at the same time. It is especially useful to avoid cluttering up the list of available variables with user-declared variables that have not been defined yet by the application (e.g. egg-object-type-*).

This method basically pre-defines all variables that match the specified glob pattern.

void output(std::ostream &out) const
void write(std::ostream &out) const
void write_prc_variables(std::ostream &out) const

Writes all of the prc-set config variables, as they appear in a prc file somewhere, one per line, very concisely. This lists the dominant value in the prc file; it does not list shadowed values, and it does not list locally-set values.

This is mainly intended for generating a hash of the input config file state.