Panda3D
|
This is a convenience class to specialize ConfigVariable as a Filename type. More...
#include "configVariableFilename.h"
Public Member Functions | |
ConfigVariableFilename (const string &name) | |
ConfigVariableFilename (const string &name, const Filename &default_value, const string &description=string(), int flags=0) | |
const char * | c_str () const |
bool | empty () const |
string | get_basename () const |
Returns the basename part of the filename. More... | |
string | get_basename_wo_extension () const |
Returns the basename part of the filename, without the file extension. More... | |
Filename | get_default_value () const |
Returns the variable's default value. More... | |
string | get_dirname () const |
Returns the directory part of the filename. More... | |
string | get_extension () const |
Returns the file extension. More... | |
string | get_fullpath () const |
Returns the entire filename: directory, basename, extension. More... | |
string | get_fullpath_wo_extension () const |
Returns the full filename–directory and basename parts–except for the extension. More... | |
Filename | get_value () const |
Returns the variable's value. More... | |
Filename | get_word (int n) const |
Returns the variable's nth value. More... | |
size_t | length () const |
operator const Filename & () const | |
Returns the variable's value as a Filename. More... | |
bool | operator!= (const Filename &other) const |
bool | operator< (const Filename &other) const |
void | operator= (const Filename &value) |
Reassigns the variable's local value. More... | |
bool | operator== (const Filename &other) const |
char | operator[] (int n) const |
void | set_value (const Filename &value) |
Reassigns the variable's local value. More... | |
void | set_word (int n, const Filename &value) |
Reassigns the variable's nth value. More... | |
![]() | |
ConfigVariable (const string &name) | |
Use this constructor to make a ConfigVariable of an unspecified type. More... | |
void | clear_value () |
Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through. More... | |
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. More... | |
const ConfigDeclaration * | get_default_value () const |
Returns the default variable specified for this variable. More... | |
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. More... | |
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. More... | |
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. More... | |
int | get_num_words () const |
Returns the number of words in the variable's value. More... | |
const string & | get_string_value () const |
Returns the toplevel value of the variable, formatted as a string. More... | |
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. More... | |
bool | has_bool_word (int n) const |
Returns true if the variable's value has a valid boolean value for the nth word. More... | |
bool | has_double_word (int n) const |
Returns true if the variable's value has a valid integer value for the nth word. More... | |
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. More... | |
bool | has_int_word (int n) const |
Returns true if the variable's value has a valid integer value for the nth word. More... | |
bool | has_string_word (int n) const |
Returns true if the variable's value has a valid string value for the nth word. More... | |
void | set_bool_word (int n, bool value) |
Changes the nth word to the indicated value without affecting the other words. More... | |
void | set_double_word (int n, double value) |
Changes the nth word to the indicated value without affecting the other words. More... | |
void | set_int64_word (int n, PN_int64 value) |
Changes the nth word to the indicated value without affecting the other words. More... | |
void | set_int_word (int n, int value) |
Changes the nth word to the indicated value without affecting the other words. More... | |
void | set_string_value (const string &value) |
Changes the value assigned to this variable. More... | |
void | set_string_word (int n, const string &value) |
Changes the nth word to the indicated value without affecting the other words. More... | |
![]() | |
bool | clear_local_value () |
Removes the local value defined for this variable, and allows its value to be once again retrieved from the .prc files. More... | |
const string & | get_description () const |
Returns the brief description of this variable, if it has been defined. More... | |
int | get_flags () const |
Returns the flags value as set by set_flags(). More... | |
const string & | get_name () const |
Returns the name of the variable. More... | |
int | get_trust_level () const |
Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable. More... | |
ValueType | get_value_type () const |
Returns the stated type of this variable. More... | |
bool | has_local_value () const |
Returns true if this variable's value has been shadowed by a local assignment (as created via make_local_value()), or false otherwise. More... | |
bool | has_value () const |
Returns true if this variable has an explicit value, either from a prc file or locally set, or false if variable has its default value. More... | |
bool | is_closed () const |
Returns true if the variable is not trusted by any prc file (and hence cannot be modified from its compiled-in default value), or false for the normal case, in which the variable can be modified by any prc file at or above its trust level (see get_trust_level()). More... | |
bool | is_dynamic () const |
Returns true if the variable was indicated as "dynamic" by its constructor, indicating that its name was dynamically generated, possibly from a large pool, and it should not be listed along with the other variables. More... | |
void | output (ostream &out) const |
void | write (ostream &out) const |
Additional Inherited Members | |
![]() | |
enum | ValueType { VT_undefined, VT_list, VT_string, VT_filename, VT_bool, VT_int, VT_double, VT_enum, VT_search_path, VT_int64, VT_color } |
enum | VariableFlags { F_trust_level_mask = 0x00000fff, F_open = 0x00001000, F_closed = 0x00002000, F_dynamic = 0x00004000, F_dconfig = 0x00008000 } |
This is a convenience class to specialize ConfigVariable as a Filename type.
It is almost the same thing as ConfigVariableString, except it handles an implicit Filename::expand_from() operation so that the user may put OS-specific filenames, or filenames based on environment variables, in the prc file.
Definition at line 30 of file configVariableFilename.h.
|
inline |
Returns the basename part of the filename.
This is everything in the filename after the rightmost slash, including any extensions.
Definition at line 142 of file configVariableFilename.I.
References Filename::get_basename(), and get_fullpath_wo_extension().
Referenced by get_dirname().
|
inline |
Returns the basename part of the filename, without the file extension.
Definition at line 166 of file configVariableFilename.I.
References Filename::get_basename_wo_extension(), and get_extension().
Referenced by get_fullpath_wo_extension().
|
inline |
Returns the variable's default value.
Definition at line 243 of file configVariableFilename.I.
References Filename::expand_from(), ConfigVariable::get_default_value(), ConfigDeclaration::get_string_value(), and get_word().
Referenced by get_value().
|
inline |
Returns the directory part of the filename.
This is everything in the filename up to, but not including the rightmost slash.
Definition at line 130 of file configVariableFilename.I.
References get_basename(), and Filename::get_dirname().
Referenced by get_fullpath().
|
inline |
Returns the file extension.
This is everything after the rightmost dot, if there is one, or the empty string if there is not.
Definition at line 179 of file configVariableFilename.I.
References Filename::get_extension(), and set_value().
Referenced by get_basename_wo_extension().
|
inline |
Returns the entire filename: directory, basename, extension.
This is the same thing returned by the string typecast operator, so this function is a little redundant.
Definition at line 118 of file configVariableFilename.I.
References get_dirname(), and Filename::get_fullpath().
Referenced by operator const Filename &().
|
inline |
Returns the full filename–directory and basename parts–except for the extension.
Definition at line 154 of file configVariableFilename.I.
References get_basename_wo_extension(), and Filename::get_fullpath_wo_extension().
Referenced by get_basename().
|
inline |
Returns the variable's value.
Definition at line 229 of file configVariableFilename.I.
References get_default_value().
Referenced by TextProperties::add_properties(), set_value(), and SpeedTreeNode::write_error().
|
inline |
Returns the variable's nth value.
Definition at line 257 of file configVariableFilename.I.
References Filename::expand_from(), ConfigVariable::get_string_word(), and set_word().
Referenced by get_default_value().
|
inline |
Returns the variable's value as a Filename.
Definition at line 64 of file configVariableFilename.I.
References get_fullpath().
|
inline |
Reassigns the variable's local value.
Definition at line 54 of file configVariableFilename.I.
References set_value().
|
inline |
Reassigns the variable's local value.
Definition at line 219 of file configVariableFilename.I.
References get_value(), and ConfigVariable::set_string_value().
Referenced by get_extension(), and operator=().
|
inline |
Reassigns the variable's nth value.
This makes a local copy of the variable's overall value.
Definition at line 268 of file configVariableFilename.I.
References ConfigVariable::set_string_word().
Referenced by get_word().