ConfigDeclaration

class ConfigDeclaration

Bases: ConfigFlags

A single declaration of a config variable, typically defined as one line in a .prc file, e.g. “show-frame-rate-meter 1”. This is really just a pairing of a string name (actually, a ConfigVariableCore pointer) to a string value.

Inheritance diagram

Inheritance diagram of ConfigDeclaration

bool get_bool_word(std::size_t n) const

Returns the boolean value of the nth word of the declaration’s value, or false if there is no nth value. See also has_bool_word().

int get_decl_seq(void) const

Returns the sequence number of the declaration within the page. Sequence numbers are assigned as each declaration is created; each declaration is given a higher sequence number than all the declarations created in the page before it.

double get_double_word(std::size_t n) const

Returns the integer value of the nth word of the declaration’s value, or 0 if there is no nth value. See also has_double_word().

Filename get_filename_value(void) const

Interprets the string value as a filename and returns it, with any variables expanded.

int64_t get_int64_word(std::size_t n) const

Returns the int64 value of the nth word of the declaration’s value, or 0 if there is no nth value. See also has_int64_word().

int get_int_word(std::size_t n) const

Returns the integer value of the nth word of the declaration’s value, or 0 if there is no nth value. See also has_int_word().

std::size_t get_num_words(void) const

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

ConfigPage *get_page(void) const

Returns the page on which this declaration can be found.

std::string const &get_string_value(void) const

Returns the value assigned to this variable. This is the original one-line text defined for the variable in the .prc file (or passed to ConfigPage::make_declaration()).

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

Returns the string value of the nth word of the declaration’s value, or empty string if there is no nth value. See also has_string_word().

ConfigVariableCore *get_variable(void) const

Returns the variable that this declaration names. This variable may or may not have been defined by the time the declaration is read.

bool has_bool_word(std::size_t n) const

Returns true if the declaration’s value has a valid boolean value for the nth word.

bool has_double_word(std::size_t n) const

Returns true if the declaration’s value has a valid integer value for the nth word.

bool has_int64_word(std::size_t n) const

Returns true if the declaration’s value has a valid int64 value for the nth word.

bool has_int_word(std::size_t n) const

Returns true if the declaration’s value has a valid integer value for the nth word.

bool has_string_word(std::size_t n) const

Returns true if the declaration’s value has a valid string value for the nth word. This is really the same thing as asking if there are at least n words in the value.

void output(std::ostream &out) const
void set_bool_word(std::size_t n, bool value)

Changes the nth word to the indicated value without affecting the other words.

void set_double_word(std::size_t n, double value)

Changes the nth word to the indicated value without affecting the other words.

void set_int64_word(std::size_t n, int64_t value)

Changes the nth word to the indicated value without affecting the other words.

void set_int_word(std::size_t n, int value)

Changes the nth word to the indicated value without affecting the other words.

void set_string_value(std::string const &value)

Changes the value assigned to this variable.

void set_string_word(std::size_t n, std::string const &value)

Changes the nth word to the indicated value without affecting the other words.

void write(std::ostream &out) const