18 INLINE ConfigVariable::
19 ConfigVariable(
const std::string &name, ConfigVariable::ValueType value_type) :
28 INLINE ConfigVariable::
29 ConfigVariable(
const std::string &name, ConfigVariable::ValueType value_type,
30 const std::string &description,
int flags) :
40 INLINE ConfigVariable::
41 ConfigVariable(
const std::string &name) :
50 INLINE ConfigVariable::
59 get_default_value()
const {
60 nassertr(is_constructed(),
nullptr);
61 return _core->get_default_value();
69 nassertr(is_constructed(), *
new std::string());
81 nassertv(is_constructed());
82 _core->make_local_value()->set_string_value(string_value);
91 nassertv(is_constructed());
92 _core->clear_local_value();
101 nassertr(is_constructed(), 0);
111 INLINE
bool ConfigVariable::
112 has_string_word(
size_t n)
const {
113 nassertr(is_constructed(),
false);
122 INLINE
bool ConfigVariable::
123 has_bool_word(
size_t n)
const {
124 nassertr(is_constructed(),
false);
133 INLINE
bool ConfigVariable::
134 has_int_word(
size_t n)
const {
135 nassertr(is_constructed(),
false);
144 INLINE
bool ConfigVariable::
145 has_int64_word(
size_t n)
const {
146 nassertr(is_constructed(),
false);
155 INLINE
bool ConfigVariable::
156 has_double_word(
size_t n)
const {
157 nassertr(is_constructed(),
false);
166 INLINE std::string ConfigVariable::
167 get_string_word(
size_t n)
const {
168 nassertr(is_constructed(), std::string());
177 INLINE
bool ConfigVariable::
178 get_bool_word(
size_t n)
const {
179 nassertr(is_constructed(),
false);
188 INLINE
int ConfigVariable::
189 get_int_word(
size_t n)
const {
190 nassertr(is_constructed(), 0);
199 INLINE int64_t ConfigVariable::
200 get_int64_word(
size_t n)
const {
201 nassertr(is_constructed(), 0);
210 INLINE
double ConfigVariable::
211 get_double_word(
size_t n)
const {
212 nassertr(is_constructed(), 0.0);
221 INLINE
void ConfigVariable::
222 set_string_word(
size_t n,
const std::string &value) {
223 nassertv(is_constructed());
224 _core->make_local_value()->set_string_word(n, value);
231 INLINE
void ConfigVariable::
232 set_bool_word(
size_t n,
bool value) {
233 nassertv(is_constructed());
234 _core->make_local_value()->set_bool_word(n, value);
241 INLINE
void ConfigVariable::
242 set_int_word(
size_t n,
int value) {
243 nassertv(is_constructed());
244 _core->make_local_value()->set_int_word(n, value);
251 INLINE
void ConfigVariable::
252 set_int64_word(
size_t n, int64_t value) {
253 nassertv(is_constructed());
254 _core->make_local_value()->set_int64_word(n, value);
261 INLINE
void ConfigVariable::
262 set_double_word(
size_t n,
double value) {
263 nassertv(is_constructed());
264 _core->make_local_value()->set_double_word(n, value);
273 INLINE
bool ConfigVariable::
274 is_constructed()
const {
276 if (_core ==
nullptr) {
277 report_unconstructed();
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.
bool has_double_word(size_t n) const
Returns true if the declaration's value has a valid integer value for the nth word.
void set_string_value(const std::string &value)
Changes the value assigned to this variable.
std::string get_string_word(size_t n) const
Returns the string value of the nth word of the declaration's value, or empty string if there is no n...
bool get_bool_word(size_t n) const
Returns the boolean value of the nth word of the declaration's value, or false if there is no nth val...
size_t get_num_words() const
Returns the number of words in the variable's value.
int64_t get_int64_word(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.
int get_int_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.
bool has_int_word(size_t n) const
Returns true if the declaration's value has a valid integer value for the nth word.
bool has_bool_word(size_t n) const
Returns true if the declaration's value has a valid boolean value for the nth word.
const std::string & get_string_value() const
Returns the toplevel value of the variable, formatted as a string.
void clear_value()
Removes the value assigned to this variable, and lets its original value (as read from the prc files)...
size_t get_num_words() const
Returns the number of words in the declaration's value.
bool has_string_word(size_t n) const
Returns true if the declaration's value has a valid string value for the nth word.
bool has_int64_word(size_t n) const
Returns true if the declaration's value has a valid int64 value for the nth word.
This class is the base class for both ConfigVariableList and ConfigVariable (and hence for all of the...
A single declaration of a config variable, typically defined as one line in a .prc file,...