14#ifndef CONFIGDECLARATION_H
15#define CONFIGDECLARATION_H
37 const std::string &string_value,
int decl_seq);
41 INLINE
bool operator < (
const ConfigDeclaration &other)
const;
76 void output(std::ostream &out)
const;
77 void write(std::ostream &out)
const;
80 static size_t extract_words(
const std::string &str, vector_string &words);
81 static std::string
downcase(
const std::string &s);
85 void check_bool_word(
size_t n);
86 void check_int_word(
size_t n);
87 void check_int64_word(
size_t n);
88 void check_double_word(
size_t n);
93 std::string _string_value;
97 F_checked_bool = 0x0001,
98 F_valid_bool = 0x0002,
99 F_checked_int = 0x0004,
100 F_valid_int = 0x0008,
101 F_checked_double = 0x0010,
102 F_valid_double = 0x0020,
103 F_checked_int64 = 0x0040,
104 F_valid_int64 = 0x0080,
117 typedef std::vector<Word> Words;
121 friend class ConfigPage;
124INLINE std::ostream &operator << (std::ostream &out,
const ConfigDeclaration &decl);
A single declaration of a config variable, typically defined as one line in a .prc file,...
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.
bool has_bool_word(size_t n) const
Returns true if the declaration's value has a valid boolean value for the nth word.
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...
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.
bool has_int_word(size_t n) const
Returns true if the declaration's value has a valid integer value for the nth word.
void set_double_word(size_t n, double value)
Changes the nth word to the indicated value without affecting the other words.
size_t get_num_words() const
Returns the number of words in the declaration's value.
void set_int_word(size_t n, int value)
Changes the nth word to the indicated value without affecting the other words.
void set_int64_word(size_t n, int64_t value)
Changes the nth word to the indicated value without affecting the other words.
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_double_word(size_t n) const
Returns true if the declaration's value has a valid integer value for the nth word.
const std::string & get_string_value() const
Returns the value assigned to this variable.
void set_string_word(size_t n, const std::string &value)
Changes the nth word to the indicated value without affecting the other words.
Filename get_filename_value() const
Interprets the string value as a filename and returns it, with any variables expanded.
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 has_int64_word(size_t n) const
Returns true if the declaration's value has a valid int64 value for the nth word.
void set_bool_word(size_t n, bool value)
Changes the nth word to the indicated value without affecting the other words.
get_page
Returns the page on which this declaration can be found.
int get_decl_seq() const
Returns the sequence number of the declaration within the page.
void set_string_value(const std::string &value)
Changes the value assigned to this variable.
get_variable
Returns the variable that this declaration names.
bool has_string_word(size_t n) const
Returns true if the declaration's value has a valid string value for the nth word.
This class is the base class of both ConfigVariable and ConfigVariableCore.
The internal definition of a ConfigVariable.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int extract_words(const string &str, vector_string &words)
Divides the string into a number of words according to whitespace.
string downcase(const string &s)
Returns the input string with all uppercase letters converted to lowercase.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.