Panda3D
Public Member Functions | Public Attributes | List of all members
ConfigVariableBase Class Reference

This class is the base class for both ConfigVariableList and ConfigVariable (and hence for all of the ConfigVariableBool, ConfigVaribleString, etc. More...

#include "configVariableBase.h"

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

Public Member Functions

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
 

Public Attributes

 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...
 

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
}
 

Detailed Description

This class is the base class for both ConfigVariableList and ConfigVariable (and hence for all of the ConfigVariableBool, ConfigVaribleString, etc.

classes). It collects together the common interface for all generic ConfigVariables.

Mostly, this class serves as a thin wrapper around ConfigVariableCore and/or ConfigDeclaration, more or less duplicating the interface presented there.

Definition at line 45 of file configVariableBase.h.

Member Function Documentation

◆ clear_local_value()

bool ConfigVariableBase::clear_local_value ( )
inline

Removes the local value defined for this variable, and allows its value to be once again retrieved from the .prc files.

Returns true if the value was successfully removed, false if it did not exist in the first place.

Definition at line 125 of file configVariableBase.I.

◆ get_flags()

int ConfigVariableBase::get_flags ( ) const
inline

Returns the flags value as set by set_flags().

This includes the trust level and some other settings. See the individual methods is_closed(), get_trust_level(), etc. to pull out the semantic meaning of these flags individually.

Definition at line 70 of file configVariableBase.I.

◆ has_local_value()

bool ConfigVariableBase::has_local_value ( ) const
inline

Returns true if this variable's value has been shadowed by a local assignment (as created via make_local_value()), or false otherwise.

Definition at line 135 of file configVariableBase.I.

◆ has_value()

bool ConfigVariableBase::has_value ( ) const
inline

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.

Definition at line 145 of file configVariableBase.I.

Member Data Documentation

◆ get_description

const std::string & ConfigVariableBase::get_description
inline

Returns the brief description of this variable, if it has been defined.

Definition at line 64 of file configVariableBase.h.

◆ get_name

const std::string & ConfigVariableBase::get_name
inline

Returns the name of the variable.

Definition at line 62 of file configVariableBase.h.

◆ get_trust_level

int ConfigVariableBase::get_trust_level
inline

Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.

Arguably, this should be called the "mistrust level", since the larger the value, the more suspicious we are of prc files. This value is not used if is_closed() returns true, which indicates no file may be trusted.

This value only has effect in a release build (specifically, when PRC_RESPECT_TRUST_LEVEL is defined true in Config.pp).

Definition at line 66 of file configVariableBase.h.

◆ get_value_type

ConfigVariableBase::ValueType ConfigVariableBase::get_value_type
inline

Returns the stated type of this variable.

This should be VT_list, unless a later variable declaration has changed it.

Definition at line 63 of file configVariableBase.h.

◆ is_closed

bool ConfigVariableBase::is_closed
inline

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()).

This value only has effect in a release build (specifically, when PRC_RESPECT_TRUST_LEVEL is defined true in Config.pp).

Definition at line 65 of file configVariableBase.h.

◆ is_dynamic

bool ConfigVariableBase::is_dynamic
inline

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.

Definition at line 67 of file configVariableBase.h.


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