Panda3D
|
This is a generic, untyped ConfigVariable. More...
#include "configVariable.h"
Public Member Functions | |
ConfigVariable (const string &name) | |
Use this constructor to make a ConfigVariable of an unspecified type. | |
void | clear_value () |
Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through. | |
bool | get_bool_word (int n) const |
Returns the boolean value of the nth word of the variable's value, or false if there is no nth value. | |
const ConfigDeclaration * | get_default_value () const |
Returns the default variable specified for this variable. | |
double | get_double_word (int n) const |
Returns the integer value of the nth word of the variable's value, or 0 if there is no nth value. | |
PN_int64 | get_int64_word (int n) const |
Returns the int64 value of the nth word of the variable's value, or 0 if there is no nth value. | |
int | get_int_word (int n) const |
Returns the integer value of the nth word of the variable's value, or 0 if there is no nth value. | |
int | get_num_words () const |
Returns the number of words in the variable's value. | |
const string & | get_string_value () const |
Returns the toplevel value of the variable, formatted as a string. | |
string | get_string_word (int n) const |
Returns the string value of the nth word of the variable's value, or empty string if there is no nth value. | |
bool | has_bool_word (int n) const |
Returns true if the variable's value has a valid boolean value for the nth word. | |
bool | has_double_word (int n) const |
Returns true if the variable's value has a valid integer value for the nth word. | |
bool | has_int64_word (int n) const |
Returns true if the variable's value has a valid 64-bit integer value for the nth word. | |
bool | has_int_word (int n) const |
Returns true if the variable's value has a valid integer value for the nth word. | |
bool | has_string_word (int n) const |
Returns true if the variable's value has a valid string value for the nth word. | |
void | set_bool_word (int n, bool value) |
Changes the nth word to the indicated value without affecting the other words. | |
void | set_double_word (int n, double value) |
Changes the nth word to the indicated value without affecting the other words. | |
void | set_int64_word (int n, PN_int64 value) |
Changes the nth word to the indicated value without affecting the other words. | |
void | set_int_word (int n, int value) |
Changes the nth word to the indicated value without affecting the other words. | |
void | set_string_value (const string &value) |
Changes the value assigned to this variable. | |
void | set_string_word (int n, const string &value) |
Changes the nth word to the indicated value without affecting the other words. | |
Protected Member Functions | |
ConfigVariable (const string &name, ValueType type) | |
This constructor is only intended to be called from a specialized ConfigVariableFoo derived class. | |
ConfigVariable (const string &name, ValueType type, const string &description, int flags) | |
This constructor is only intended to be called from a specialized ConfigVariableFoo derived class. | |
bool | is_constructed () const |
Returns true if the constructor has been called and _core initialized, false if the constructor has not yet been called and _core is NULL. | |
void | report_unconstructed () const |
Displays a suitable error message when an unconstructed ConfigVariable is attempted to be used. |
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.
Definition at line 35 of file configVariable.h.
ConfigVariable::ConfigVariable | ( | const string & | name, |
ConfigVariable::ValueType | value_type | ||
) | [inline, protected] |
This constructor is only intended to be called from a specialized ConfigVariableFoo derived class.
Definition at line 23 of file configVariable.I.
ConfigVariable::ConfigVariable | ( | const string & | name, |
ConfigVariable::ValueType | value_type, | ||
const string & | description, | ||
int | flags | ||
) | [inline, protected] |
This constructor is only intended to be called from a specialized ConfigVariableFoo derived class.
Definition at line 35 of file configVariable.I.
ConfigVariable::ConfigVariable | ( | const string & | name | ) | [inline] |
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.
Definition at line 50 of file configVariable.I.
References ConfigVariableCore::set_used().
void ConfigVariable::clear_value | ( | ) | [inline] |
Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through.
Definition at line 113 of file configVariable.I.
References ConfigVariableCore::clear_local_value(), and is_constructed().
bool ConfigVariable::get_bool_word | ( | int | n | ) | const [inline] |
Returns the boolean value of the nth word of the variable's value, or false if there is no nth value.
See also has_bool_word().
Definition at line 221 of file configVariable.I.
References ConfigDeclaration::get_bool_word(), ConfigVariableCore::get_declaration(), and is_constructed().
Referenced by ConfigVariableBool::get_value(), and ConfigVariableBool::get_word().
const ConfigDeclaration * ConfigVariable::get_default_value | ( | ) | const [inline] |
Returns the default variable specified for this variable.
If the variable has not yet been defined, this will return NULL.
Reimplemented in ConfigVariableBool, ConfigVariableDouble, ConfigVariableEnum< EnumType >, ConfigVariableFilename, ConfigVariableInt, ConfigVariableInt64, ConfigVariableString, and ConfigVariableEnum< NotifySeverity >.
Definition at line 73 of file configVariable.I.
References ConfigVariableCore::get_default_value(), and is_constructed().
Referenced by ConfigVariableEnum< EnumType >::get_default_value().
double ConfigVariable::get_double_word | ( | int | n | ) | const [inline] |
Returns the integer value of the nth word of the variable's value, or 0 if there is no nth value.
See also has_double_word().
Definition at line 263 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::get_double_word(), and is_constructed().
Referenced by ConfigVariableDouble::get_value(), and ConfigVariableDouble::get_word().
PN_int64 ConfigVariable::get_int64_word | ( | int | n | ) | const [inline] |
Returns the int64 value of the nth word of the variable's value, or 0 if there is no nth value.
See also has_int_word().
Definition at line 249 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::get_int64_word(), and is_constructed().
Referenced by ConfigVariableInt64::get_value(), and ConfigVariableInt64::get_word().
int ConfigVariable::get_int_word | ( | int | n | ) | const [inline] |
Returns the integer value of the nth word of the variable's value, or 0 if there is no nth value.
See also has_int_word().
Definition at line 235 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::get_int_word(), and is_constructed().
Referenced by ConfigVariableInt::get_value(), and ConfigVariableInt::get_word().
int ConfigVariable::get_num_words | ( | ) | const [inline] |
Returns the number of words in the variable's value.
A word is defined as a sequence of non-whitespace characters delimited by whitespace.
Definition at line 126 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::get_num_words(), and is_constructed().
Referenced by WindowProperties::get_config_properties(), FrameBufferProperties::get_default(), GraphicsOutput::GraphicsOutput(), SpeedTreeNode::reload_config(), ConfigVariableInt64::size(), ConfigVariableInt::size(), ConfigVariableDouble::size(), and ConfigVariableBool::size().
const string & ConfigVariable::get_string_value | ( | ) | const [inline] |
Returns the toplevel value of the variable, formatted as a string.
Definition at line 85 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::get_string_value(), and is_constructed().
Referenced by ConfigVariableString::get_value(), and GraphicsOutput::GraphicsOutput().
string ConfigVariable::get_string_word | ( | int | n | ) | const [inline] |
Returns the string value of the nth word of the variable's value, or empty string if there is no nth value.
See also has_string_word().
Definition at line 207 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::get_string_word(), and is_constructed().
Referenced by ConfigVariableString::get_word(), and ConfigVariableFilename::get_word().
bool ConfigVariable::has_bool_word | ( | int | n | ) | const [inline] |
Returns true if the variable's value has a valid boolean value for the nth word.
Definition at line 154 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::has_bool_word(), and is_constructed().
bool ConfigVariable::has_double_word | ( | int | n | ) | const [inline] |
Returns true if the variable's value has a valid integer value for the nth word.
Definition at line 193 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::has_double_word(), and is_constructed().
bool ConfigVariable::has_int64_word | ( | int | n | ) | const [inline] |
Returns true if the variable's value has a valid 64-bit integer value for the nth word.
Definition at line 180 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::has_int64_word(), and is_constructed().
bool ConfigVariable::has_int_word | ( | int | n | ) | const [inline] |
Returns true if the variable's value has a valid integer value for the nth word.
Definition at line 167 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::has_int_word(), and is_constructed().
bool ConfigVariable::has_string_word | ( | int | n | ) | const [inline] |
Returns true if the variable'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.
Definition at line 141 of file configVariable.I.
References ConfigVariableCore::get_declaration(), ConfigDeclaration::has_string_word(), and is_constructed().
bool ConfigVariable::is_constructed | ( | ) | const [inline, protected] |
Returns true if the constructor has been called and _core initialized, false if the constructor has not yet been called and _core is NULL.
This is intended to be placed in an assertion check, to guard against static-init ordering issues.
Definition at line 339 of file configVariable.I.
References report_unconstructed().
Referenced by clear_value(), get_bool_word(), get_default_value(), get_double_word(), get_int64_word(), get_int_word(), get_num_words(), get_string_value(), get_string_word(), has_bool_word(), has_double_word(), has_int64_word(), has_int_word(), has_string_word(), set_bool_word(), set_double_word(), set_int64_word(), set_int_word(), set_string_value(), and set_string_word().
void ConfigVariable::report_unconstructed | ( | ) | const [protected] |
Displays a suitable error message when an unconstructed ConfigVariable is attempted to be used.
This normally indicates a static-init ordering issue.
Definition at line 26 of file configVariable.cxx.
References ConfigVariableBase::record_unconstructed().
Referenced by is_constructed().
void ConfigVariable::set_bool_word | ( | int | n, |
bool | value | ||
) | [inline] |
Changes the nth word to the indicated value without affecting the other words.
Definition at line 288 of file configVariable.I.
References is_constructed(), ConfigVariableCore::make_local_value(), and ConfigDeclaration::set_bool_word().
Referenced by ConfigVariableBool::set_value(), and ConfigVariableBool::set_word().
void ConfigVariable::set_double_word | ( | int | n, |
double | value | ||
) | [inline] |
Changes the nth word to the indicated value without affecting the other words.
Definition at line 324 of file configVariable.I.
References is_constructed(), ConfigVariableCore::make_local_value(), and ConfigDeclaration::set_double_word().
Referenced by ConfigVariableDouble::set_value(), and ConfigVariableDouble::set_word().
void ConfigVariable::set_int64_word | ( | int | n, |
PN_int64 | value | ||
) | [inline] |
Changes the nth word to the indicated value without affecting the other words.
Definition at line 312 of file configVariable.I.
References is_constructed(), ConfigVariableCore::make_local_value(), and ConfigDeclaration::set_int_word().
Referenced by ConfigVariableInt64::set_value(), and ConfigVariableInt64::set_word().
void ConfigVariable::set_int_word | ( | int | n, |
int | value | ||
) | [inline] |
Changes the nth word to the indicated value without affecting the other words.
Definition at line 300 of file configVariable.I.
References is_constructed(), ConfigVariableCore::make_local_value(), and ConfigDeclaration::set_int_word().
Referenced by ConfigVariableInt::set_value(), and ConfigVariableInt::set_word().
void ConfigVariable::set_string_value | ( | const string & | string_value | ) | [inline] |
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.
Definition at line 100 of file configVariable.I.
References is_constructed(), ConfigVariableCore::make_local_value(), and ConfigDeclaration::set_string_value().
Referenced by ConfigVariableString::set_value(), ConfigVariableInt64::set_value(), ConfigVariableInt::set_value(), ConfigVariableFilename::set_value(), ConfigVariableDouble::set_value(), and ConfigVariableBool::set_value().
void ConfigVariable::set_string_word | ( | int | n, |
const string & | value | ||
) | [inline] |
Changes the nth word to the indicated value without affecting the other words.
Definition at line 276 of file configVariable.I.
References is_constructed(), ConfigVariableCore::make_local_value(), and ConfigDeclaration::set_string_word().
Referenced by ConfigVariableString::set_word(), and ConfigVariableFilename::set_word().