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

The internal definition of a ConfigVariable. This object is shared between all instances of a ConfigVariable that use the same variable name. More...

Inheritance diagram for ConfigVariableCore:
ConfigFlags

Public Member Functions

bool clearLocalValue ()
 
const ConfigDeclaration getDeclaration (int n)
 
list getDeclarations ()
 
const ConfigDeclaration getDefaultValue ()
 Returns the default variable specified for this variable. If the variable has not yet been defined, this will return NULL. More...
 
str getDescription ()
 Returns the brief description of this variable, if it has been defined. More...
 
int getFlags ()
 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. More...
 
str getName ()
 Returns the name of the variable. More...
 
int getNumDeclarations ()
 
int getNumReferences ()
 Returns the number of prc files that reference this variable. This is not exactly the same as the number of declarations; see get_reference(). More...
 
int getNumTrustedReferences ()
 Returns the number of trusted prc files that reference this variable. See also get_num_references(). More...
 
int getNumUniqueReferences ()
 Returns the number of trusted, unique (by string value) values there exist for this variable. More...
 
const ConfigDeclaration getReference (int n)
 Returns the nth declaration in a prc file that references this variable. This is similar, but not identical to, get_declaration(). The difference is that this will list only true references in a prc file, and will not list default values or locally-assigned values; it also will list even the untrusted files. More...
 
list getReferences ()
 
const ConfigDeclaration getTrustedReference (int n)
 Returns the nth declaration in a trusted prc file that references this variable. This is similar, but not identical to, get_declaration(). The difference is that this will list only true references in a prc file, and will not list default values or locally-assigned values. More...
 
list getTrustedReferences ()
 
int getTrustLevel ()
 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. More...
 
const ConfigDeclaration getUniqueReference (int n)
 Returns the nth trusted, unique value for this variable. This is similar to get_trusted_reference(), except that duplicate values are removed. More...
 
list getUniqueReferences ()
 
ConfigFlags::ValueType getValueType ()
 Returns the stated type of this variable. If the variable has not yet been defined, this will be VT_undefined. More...
 
bool hasLocalValue ()
 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 hasValue ()
 
bool isClosed ()
 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 isDynamic ()
 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...
 
bool isUsed ()
 Returns true if the variable has been referenced by a ConfigVariable somewhere in code, false otherwise. More...
 
ConfigDeclaration makeLocalValue ()
 
 output (Ostream out)
 
 setDefaultValue (str default_value)
 
 setDescription (str description)
 
 setFlags (int flags)
 
 setUsed ()
 Marks that the variable has been "declared" by a ConfigVariable. More...
 
 setValueType (ConfigFlags::ValueType value_type)
 
 write (Ostream out)
 

Additional Inherited Members

- Public Types inherited from ConfigFlags
enum  ValueType {
  VT_undefined = 0, VT_list = 1, VT_string = 2, VT_filename = 3,
  VT_bool = 4, VT_int = 5, VT_double = 6, VT_enum = 7,
  VT_search_path = 8, VT_int64 = 9, VT_color = 10
}
 
enum  VariableFlags {
  F_trust_level_mask = 4095, F_open = 4096, F_closed = 8192, F_dynamic = 16384,
  F_dconfig = 32768
}
 

Detailed Description

The internal definition of a ConfigVariable. This object is shared between all instances of a ConfigVariable that use the same variable name.

You cannot create a ConfigVariableCore instance directly; instead, use the make() method, which may return a shared instance. Once created, these objects are never destructed.

Member Function Documentation

◆ clearLocalValue()

bool clearLocalValue ( )

◆ getDeclaration()

const ConfigDeclaration getDeclaration ( int  n)

◆ getDeclarations()

list getDeclarations ( )

◆ getDefaultValue()

const ConfigDeclaration getDefaultValue ( )

Returns the default variable specified for this variable. If the variable has not yet been defined, this will return NULL.

◆ getDescription()

str getDescription ( )

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

◆ getFlags()

int getFlags ( )

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.

◆ getName()

str getName ( )

Returns the name of the variable.

◆ getNumDeclarations()

int getNumDeclarations ( )

◆ getNumReferences()

int getNumReferences ( )

Returns the number of prc files that reference this variable. This is not exactly the same as the number of declarations; see get_reference().

◆ getNumTrustedReferences()

int getNumTrustedReferences ( )

Returns the number of trusted prc files that reference this variable. See also get_num_references().

◆ getNumUniqueReferences()

int getNumUniqueReferences ( )

Returns the number of trusted, unique (by string value) values there exist for this variable.

◆ getReference()

const ConfigDeclaration getReference ( int  n)

Returns the nth declaration in a prc file that references this variable. This is similar, but not identical to, get_declaration(). The difference is that this will list only true references in a prc file, and will not list default values or locally-assigned values; it also will list even the untrusted files.

◆ getReferences()

list getReferences ( )

◆ getTrustedReference()

const ConfigDeclaration getTrustedReference ( int  n)

Returns the nth declaration in a trusted prc file that references this variable. This is similar, but not identical to, get_declaration(). The difference is that this will list only true references in a prc file, and will not list default values or locally-assigned values.

This is also similar to get_reference(), except that it only lists the trusted declarations, omitting the untrusted ones.

◆ getTrustedReferences()

list getTrustedReferences ( )

◆ getTrustLevel()

int getTrustLevel ( )

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

◆ getUniqueReference()

const ConfigDeclaration getUniqueReference ( int  n)

Returns the nth trusted, unique value for this variable. This is similar to get_trusted_reference(), except that duplicate values are removed.

◆ getUniqueReferences()

list getUniqueReferences ( )

◆ getValueType()

ConfigFlags::ValueType getValueType ( )

Returns the stated type of this variable. If the variable has not yet been defined, this will be VT_undefined.

◆ hasLocalValue()

bool hasLocalValue ( )

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

◆ hasValue()

bool hasValue ( )

◆ isClosed()

bool isClosed ( )

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

◆ isDynamic()

bool isDynamic ( )

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.

◆ isUsed()

bool isUsed ( )

Returns true if the variable has been referenced by a ConfigVariable somewhere in code, false otherwise.

◆ makeLocalValue()

ConfigDeclaration makeLocalValue ( )

◆ output()

output ( Ostream  out)

◆ setDefaultValue()

setDefaultValue ( str  default_value)

◆ setDescription()

setDescription ( str  description)

◆ setFlags()

setFlags ( int  flags)

◆ setUsed()

setUsed ( )

Marks that the variable has been "declared" by a ConfigVariable.

◆ setValueType()

setValueType ( ConfigFlags::ValueType  value_type)

◆ write()

write ( Ostream  out)