Panda3D
Public Member Functions | List of all members
ConfigVariable Class Reference

This is a generic, untyped ConfigVariable. More...

#include "configVariable.h"

Inheritance diagram for ConfigVariable:
ConfigVariableBase ConfigFlags ConfigVariableBool ConfigVariableColor ConfigVariableDouble ConfigVariableEnum< EnumType > ConfigVariableEnum< NotifySeverity > ConfigVariableFilename ConfigVariableInt ConfigVariableInt64 ConfigVariableString

Public Member Functions

 ConfigVariable (const std::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...
 
size_t get_num_words () const
 Returns the number of words in the variable's value. More...
 
const std::string & get_string_value () const
 Returns the toplevel value of the variable, formatted as a string. More...
 
void set_string_value (const std::string &value)
 Changes the value assigned to this variable. More...
 
- Public Member Functions inherited from ConfigVariableBase
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 std::string & get_description () const
 
int get_flags () const
 Returns the flags value as set by set_flags(). More...
 
const std::string & get_name () const
 
int get_trust_level () const
 
ValueType get_value_type () const
 
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
 
bool is_dynamic () const
 
void output (std::ostream &out) const
 
void write (std::ostream &out) const
 

Additional Inherited Members

- Public Types inherited from ConfigFlags
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
}
 
- Public Attributes inherited from ConfigVariableBase
 get_description
 Returns the brief description of this variable, if it has been defined. More...
 
 get_name
 Returns the name of the variable. More...
 
 get_trust_level
 Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable. More...
 
 get_value_type
 Returns the stated type of this variable. More...
 
 is_closed
 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...
 
 is_dynamic
 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...
 

Detailed Description

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 31 of file configVariable.h.

Constructor & Destructor Documentation

◆ ConfigVariable()

ConfigVariable::ConfigVariable ( const std::string &  name)
inlineexplicit

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 41 of file configVariable.I.

Member Function Documentation

◆ clear_value()

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 90 of file configVariable.I.

◆ get_num_words()

size_t 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 100 of file configVariable.I.

Referenced by ConfigVariableBool::size(), ConfigVariableDouble::size(), ConfigVariableInt::size(), and ConfigVariableInt64::size().

◆ get_string_value()

const std::string & ConfigVariable::get_string_value ( ) const
inline

Returns the toplevel value of the variable, formatted as a string.

Definition at line 68 of file configVariable.I.

◆ set_string_value()

void ConfigVariable::set_string_value ( const std::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 80 of file configVariable.I.

Referenced by ConfigVariableColor::set_value().


The documentation for this class was generated from the following files: