17 INLINE ConfigVariableColor::
18 ConfigVariableColor(
const std::string &name) :
20 _local_modified(initial_invalid_cache()),
29 INLINE ConfigVariableColor::
30 ConfigVariableColor(
const std::string &name,
const LColor &default_value,
31 const std::string &description,
int flags) :
32 #ifdef PRC_SAVE_DESCRIPTIONS
37 _local_modified(initial_invalid_cache()),
40 set_default_value(default_value);
47 INLINE ConfigVariableColor::
48 ConfigVariableColor(
const std::string &name,
const std::string &default_value,
49 const std::string &description,
int flags) :
50 #ifdef PRC_SAVE_DESCRIPTIONS
55 _local_modified(initial_invalid_cache()),
58 _core->set_default_value(default_value);
73 INLINE ConfigVariableColor::
74 operator
const LColor & ()
const {
93 set_double_word(0, color[0]);
94 set_double_word(1, color[1]);
95 set_double_word(2, color[2]);
96 set_double_word(3, color[3]);
104 TAU_PROFILE(
"const LColor &ConfigVariableColor::get_value() const",
" ", TAU_USER);
105 if (!is_cache_valid(_local_modified)) {
106 mark_cache_valid(_local_modified);
110 _cache.set((PN_stdfloat)get_double_word(0), (PN_stdfloat)get_double_word(0),
111 (PN_stdfloat)get_double_word(0), 1);
115 _cache.set((PN_stdfloat)get_double_word(0), (PN_stdfloat)get_double_word(0),
116 (PN_stdfloat)get_double_word(0), (PN_stdfloat)get_double_word(1));
120 _cache.set((PN_stdfloat)get_double_word(0), (PN_stdfloat)get_double_word(1),
121 (PN_stdfloat)get_double_word(2), 1);
125 _cache.set((PN_stdfloat)get_double_word(0), (PN_stdfloat)get_double_word(1),
126 (PN_stdfloat)get_double_word(2), (PN_stdfloat)get_double_word(3));
131 <<
"Invalid color value for ConfigVariable " 144 if (decl !=
nullptr) {
160 <<
"Invalid default color value for ConfigVariable " 164 return LColor(0, 0, 0, 1);
double get_double_word(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.
const std::string & get_string_value() const
Returns the value assigned to this variable.
The internal definition of a ConfigVariable.
void set_value(const LColor &value)
Reassigns the variable's local value.
const LColor & get_value() const
Returns the variable's value.
void operator=(const LColor &value)
Reassigns the variable's local value.
void set_string_value(const std::string &value)
Changes the value assigned to this variable.
size_t get_num_words() const
Returns the number of words in the variable's value.
This is a generic, untyped ConfigVariable.
const std::string & get_string_value() const
Returns the toplevel value of the variable, formatted as a string.
size_t get_num_words() const
Returns the number of words in the declaration's value.
PN_stdfloat operator [](int n) const
Returns the value of the color's nth component (which is not necessarily the same thing as the variab...
get_name
Returns the name of the variable.
A single declaration of a config variable, typically defined as one line in a .prc file,...
LColor get_default_value() const
Returns the variable's default value.