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

This is a convenience class to specialize ConfigVariable as an integer type. More...

Inheritance diagram for ConfigVariableInt:
ConfigVariable ConfigVariableBase ConfigFlags

Public Member Functions

 __init__ (str name)
 
 __init__ (str name, int default_value, str description, int flags)
 
 __init__ (str name, str default_value, str description, int flags)
 
int getDefaultValue ()
 Returns the variable's default value. More...
 
int getValue ()
 Returns the variable's value. More...
 
int getWord (int n)
 Returns the variable's nth value. More...
 
ConfigVariableInt operator= (int value)
 
int operator[] (int n)
 
 setValue (int value)
 Reassigns the variable's local value. More...
 
 setWord (int n, int value)
 Reassigns the variable's nth value. This makes a local copy of the variable's overall value. More...
 
int size ()
 Returns the number of unique words in the variable. More...
 
- Public Member Functions inherited from ConfigVariable
 __init__ (str name)
 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. More...
 
 clearValue ()
 Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through. More...
 
bool getBoolWord (int n)
 Returns the boolean value of the nth word of the variable's value, or false if there is no nth value. See also has_bool_word(). More...
 
const ConfigDeclaration getDefaultValue ()
 Returns the default variable specified for this variable. If the variable has not yet been defined, this will return NULL. More...
 
double getDoubleWord (int n)
 Returns the integer value of the nth word of the variable's value, or 0 if there is no nth value. See also has_double_word(). More...
 
PNInt64 getInt64Word (int n)
 Returns the int64 value of the nth word of the variable's value, or 0 if there is no nth value. See also has_int_word(). More...
 
int getIntWord (int n)
 Returns the integer value of the nth word of the variable's value, or 0 if there is no nth value. See also has_int_word(). More...
 
int getNumWords ()
 Returns the number of words in the variable's value. A word is defined as a sequence of non-whitespace characters delimited by whitespace. More...
 
str getStringValue ()
 Returns the toplevel value of the variable, formatted as a string. More...
 
str getStringWord (int n)
 Returns the string value of the nth word of the variable's value, or empty string if there is no nth value. See also has_string_word(). More...
 
bool hasBoolWord (int n)
 Returns true if the variable's value has a valid boolean value for the nth word. More...
 
bool hasDoubleWord (int n)
 Returns true if the variable's value has a valid integer value for the nth word. More...
 
bool hasInt64Word (int n)
 Returns true if the variable's value has a valid 64-bit integer value for the nth word. More...
 
bool hasIntWord (int n)
 Returns true if the variable's value has a valid integer value for the nth word. More...
 
bool hasStringWord (int n)
 Returns true if the variable's value has a valid string value for the nth word. This is really the same thing as asking if there are at least n words in the value. More...
 
 setBoolWord (int n, bool value)
 Changes the nth word to the indicated value without affecting the other words. More...
 
 setDoubleWord (int n, double value)
 Changes the nth word to the indicated value without affecting the other words. More...
 
 setInt64Word (int n, PNInt64 value)
 Changes the nth word to the indicated value without affecting the other words. More...
 
 setIntWord (int n, int value)
 Changes the nth word to the indicated value without affecting the other words. More...
 
 setStringValue (str value)
 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. More...
 
 setStringWord (int n, str value)
 Changes the nth word to the indicated value without affecting the other words. More...
 
- Public Member Functions inherited from ConfigVariableBase
bool clearLocalValue ()
 Removes the local value defined for this variable, and allows its value to be once again retrieved from the .prc files. 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 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...
 
ConfigFlags::ValueType getValueType ()
 Returns the stated type of this variable. This should be VT_list, unless a later variable declaration has changed it. 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 ()
 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 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...
 
 output (Ostream out)
 
 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

This is a convenience class to specialize ConfigVariable as an integer type.

Member Function Documentation

◆ __init__() [1/3]

__init__ ( str  name)

◆ __init__() [2/3]

__init__ ( str  name,
int  default_value,
str  description,
int  flags 
)

◆ __init__() [3/3]

__init__ ( str  name,
str  default_value,
str  description,
int  flags 
)

◆ getDefaultValue()

int getDefaultValue ( )

Returns the variable's default value.

◆ getValue()

int getValue ( )

Returns the variable's value.

◆ getWord()

int getWord ( int  n)

Returns the variable's nth value.

◆ operator=()

ConfigVariableInt operator= ( int  value)

◆ operator[]()

int operator[] ( int  n)

◆ setValue()

setValue ( int  value)

Reassigns the variable's local value.

◆ setWord()

setWord ( int  n,
int  value 
)

Reassigns the variable's nth value. This makes a local copy of the variable's overall value.

◆ size()

int size ( )

Returns the number of unique words in the variable.