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

A global object that maintains the set of ConfigVariables (actually, ConfigVariableCores) everywhere in the world, and keeps them in sorted order. More...

Public Member Functions

int getNumVariables ()
 Returns the current number of active ConfigVariableCores in the world. More...
 
ConfigVariableCore getVariable (int n)
 Returns the nth active ConfigVariableCore in the world. More...
 
str getVariableName (int n)
 Returns the name of the nth active ConfigVariable in the list. More...
 
list getVariables ()
 
bool isVariableUsed (int n)
 Returns true if the nth active ConfigVariable in the list has been used by code, false otherwise. More...
 
 listDynamicVariables ()
 Writes a list of all the "dynamic" variables that have been declared somewhere in code, along with a brief description. More...
 
 listUnusedVariables ()
 Writes a list of all the variables that have been defined in a prc file without having been declared somewhere in code. More...
 
 listVariables ()
 Writes a list of all the variables that have been declared somewhere in code, along with a brief description. More...
 
ConfigVariableCore makeVariable (str name)
 Creates and returns a new, undefined ConfigVariableCore with the indicated name; or if a variable with this name has already been created, returns that one instead. More...
 
ConfigVariableCore makeVariableTemplate (str pattern, ConfigFlags::ValueType type, str default_value, str description, int flags)
 Defines a variable "template" to match against dynamically-defined variables that may or may not be created in the future. More...
 
 output (Ostream out)
 
 write (Ostream out)
 
 writePrcVariables (Ostream out)
 Writes all of the prc-set config variables, as they appear in a prc file somewhere, one per line, very concisely. More...
 

Static Public Member Functions

static ConfigVariableManager getGlobalPtr ()
 

Public Attributes

ConfigVariableCore variables []
 

Detailed Description

A global object that maintains the set of ConfigVariables (actually, ConfigVariableCores) everywhere in the world, and keeps them in sorted order.

Member Function Documentation

◆ getGlobalPtr()

static ConfigVariableManager getGlobalPtr ( )
static

◆ getNumVariables()

int getNumVariables ( )

Returns the current number of active ConfigVariableCores in the world.

◆ getVariable()

ConfigVariableCore getVariable ( int  n)

Returns the nth active ConfigVariableCore in the world.

◆ getVariableName()

str getVariableName ( int  n)

Returns the name of the nth active ConfigVariable in the list.

◆ getVariables()

list getVariables ( )

◆ isVariableUsed()

bool isVariableUsed ( int  n)

Returns true if the nth active ConfigVariable in the list has been used by code, false otherwise.

◆ listDynamicVariables()

listDynamicVariables ( )

Writes a list of all the "dynamic" variables that have been declared somewhere in code, along with a brief description.

This is a (usually large) list of config variables that are declared with a generated variable name.

◆ listUnusedVariables()

listUnusedVariables ( )

Writes a list of all the variables that have been defined in a prc file without having been declared somewhere in code.

◆ listVariables()

listVariables ( )

Writes a list of all the variables that have been declared somewhere in code, along with a brief description.

◆ makeVariable()

ConfigVariableCore makeVariable ( str  name)

Creates and returns a new, undefined ConfigVariableCore with the indicated name; or if a variable with this name has already been created, returns that one instead.

◆ makeVariableTemplate()

ConfigVariableCore makeVariableTemplate ( str  pattern,
ConfigFlags::ValueType  type,
str  default_value,
str  description,
int  flags 
)

Defines a variable "template" to match against dynamically-defined variables that may or may not be created in the future.

The template consists of a glob pattern, e.g. "notify-level-*", which will be tested against any config variable passed to a future call to make_variable(). If the pattern matches, the returned ConfigVariableCore is copied to define the new variable, instead of creating a default, empty one.

This is useful to pre-specify default values for a family of variables that all have similar properties, and all may not be created at the same time. It is especially useful to avoid cluttering up the list of available variables with user-declared variables that have not been defined yet by the application (e.g. "egg-object-type-*").

This method basically pre-defines all variables that match the specified glob pattern.

◆ output()

output ( Ostream  out)

◆ write()

write ( Ostream  out)

◆ writePrcVariables()

writePrcVariables ( Ostream  out)

Writes all of the prc-set config variables, as they appear in a prc file somewhere, one per line, very concisely.

This lists the dominant value in the prc file; it does not list shadowed values, and it does not list locally-set values.

This is mainly intended for generating a hash of the input config file state.

Member Data Documentation

◆ variables

ConfigVariableCore variables[]