ConfigVariable

class ConfigVariable

Bases: ConfigVariableBase

This is a generic, untyped ConfigVariable. It is also the base class for the typed ConfigVariables, and contains all of the code common to ConfigVariables of all types (except ConfigVariableList, which is a bit of a special case).

Mostly, this class serves as a thin wrapper around ConfigVariableCore and/or ConfigDeclaration, more or less duplicating the interface presented there.

Inheritance diagram

Inheritance diagram of ConfigVariable

explicit ConfigVariable(std::string const &name)
ConfigVariable(ConfigVariable const&) = default

This constructor is only intended to be called from a specialized ConfigVariableFoo derived class.

This constructor is only intended to be called from a specialized ConfigVariableFoo derived class.

Use this constructor to make a ConfigVariable of an unspecified type. Usually you’d want to do this just to reference a previously-defined ConfigVariable of a specific type, without having to know what type it is.

void clear_value(void)

Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through.

std::size_t get_num_words(void) const

Returns the number of words in the variable’s value. A word is defined as a sequence of non-whitespace characters delimited by whitespace.

std::string const &get_string_value(void) const

Returns the toplevel value of the variable, formatted as a string.

void set_string_value(std::string const &value)

Changes the value assigned to this variable. This creates a local value that shadows any values defined in the .prc files, until clear_local_value() is called.