Panda3D
Public Types | Public Member Functions

ConfigVariableFilename Class Reference

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

Inheritance diagram for ConfigVariableFilename:
ConfigVariable ConfigVariableBase ConfigFlags

List of all members.

Public Types

enum  ValueType {
  VTUndefined = 0, VTList = 1, VTString = 2, VTFilename = 3,
  VTBool = 4, VTInt = 5, VTDouble = 6, VTEnum = 7,
  VTSearchPath = 8, VTInt64 = 9
}
enum  VariableFlags {
  FTrustLevelMask = 4095, FOpen = 4096, FClosed = 8192, FDynamic = 16384,
  FDconfig = 32768
}

Public Member Functions

 ConfigVariableFilename (string name)
 ConfigVariableFilename (string name, Filename const default_value, string description, int flags)
 ConfigVariableFilename (string name, Filename const default_value)
 ConfigVariableFilename (string name, Filename const default_value, string description)
bool clearLocalValue ()
 Removes the local value defined for this variable, and allows its value to be once again retrieved from the .prc files.
 clearValue ()
 Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through.
string cStr ()
bool empty ()
string getBasename ()
 Returns the basename part of the filename.
string getBasenameWoExtension ()
 Returns the basename part of the filename, without the file extension.
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.
Filename getDefaultValue ()
 Returns the variable's default value.
string getDescription ()
 Returns the brief description of this variable, if it has been defined.
string getDirname ()
 Returns the directory part of the filename.
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.
string getExtension ()
 Returns the file extension.
int getFlags ()
 Returns the flags value as set by set_flags().
string getFullpath ()
 Returns the entire filename: directory, basename, extension.
string getFullpathWoExtension ()
 Returns the full filename--directory and basename parts--except for the extension.
long int getInt64Word (int n)
 Returns the int64 value of the nth word of the variable's value, or 0 if there is no nth value.
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.
string getName ()
 Returns the name of the variable.
int getNumWords ()
 Returns the number of words in the variable's value.
string getStringValue ()
 Returns the toplevel value of the variable, formatted as a string.
string 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.
int getTrustLevel ()
 Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.
Filename const getValue ()
 Returns the variable's value.
ValueType getValueType ()
 Returns the stated type of this variable.
Filename getWord (int n)
 Returns the variable's nth value.
bool hasBoolWord (int n)
 Returns true if the variable's value has a valid boolean value for the nth word.
bool hasDoubleWord (int n)
 Returns true if the variable's value has a valid integer value for the nth word.
bool hasInt64Word (int n)
 Returns true if the variable's value has a valid 64-bit integer value for the nth word.
bool hasIntWord (int n)
 Returns true if the variable's value has a valid integer value for the nth word.
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.
bool hasStringWord (int n)
 Returns true if the variable's value has a valid string value for the nth word.
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.
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()).
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.
unsigned int length ()
bool operator!= (Filename const other)
bool operator< (Filename const other)
ConfigVariableFilename operator= (Filename const value)
 Reassigns the variable's local value.
bool operator== (Filename const other)
char operator[] (int n)
 output (ostream out)
 setBoolWord (int n, bool value)
 Changes the nth word to the indicated value without affecting the other words.
 setDoubleWord (int n, double value)
 Changes the nth word to the indicated value without affecting the other words.
 setInt64Word (int n, long int value)
 Changes the nth word to the indicated value without affecting the other words.
 setIntWord (int n, int value)
 Changes the nth word to the indicated value without affecting the other words.
 setStringValue (string value)
 Changes the value assigned to this variable.
 setStringWord (int n, string value)
 Changes the nth word to the indicated value without affecting the other words.
 setValue (Filename const value)
 Reassigns the variable's local value.
 setWord (int n, Filename const value)
 Reassigns the variable's nth value.
 write (ostream out)

Detailed Description

This is a convenience class to specialize ConfigVariable as a Filename type.

It is almost the same thing as ConfigVariableString, except it handles an implicit Filename.expand_from() operation so that the user may put OS-specific filenames, or filenames based on environment variables, in the prc file.


Member Enumeration Documentation

enum ValueType [inherited]
Enumerator:
VTUndefined 
VTList 
VTString 
VTFilename 
VTBool 
VTInt 
VTDouble 
VTEnum 
VTSearchPath 
VTInt64 
enum VariableFlags [inherited]
Enumerator:
FTrustLevelMask 
FOpen 
FClosed 
FDynamic 
FDconfig 

Constructor & Destructor Documentation

ConfigVariableFilename ( string  name)
ConfigVariableFilename ( string  name,
Filename const  default_value,
string  description,
int  flags 
)
ConfigVariableFilename ( string  name,
Filename const  default_value,
string  description 
)
ConfigVariableFilename ( string  name,
Filename const  default_value 
)

Member Function Documentation

bool clearLocalValue ( ) [inherited]

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.

Reimplemented in ConfigVariableSearchPath.

clearValue ( ) [inherited]

Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through.

string cStr ( )
bool empty ( )
string getBasename ( )

Returns the basename part of the filename.

This is everything in the filename after the rightmost slash, including any extensions.

string getBasenameWoExtension ( )

Returns the basename part of the filename, without the file extension.

bool getBoolWord ( int  n) [inherited]

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

Filename getDefaultValue ( )

Returns the variable's default value.

Reimplemented from ConfigVariable.

string getDescription ( ) [inherited]

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

string getDirname ( )

Returns the directory part of the filename.

This is everything in the filename up to, but not including the rightmost slash.

double getDoubleWord ( int  n) [inherited]

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

string getExtension ( )

Returns the file extension.

This is everything after the rightmost dot, if there is one, or the empty string if there is not.

int getFlags ( ) [inherited]

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.

string getFullpath ( )

Returns the entire filename: directory, basename, extension.

This is the same thing returned by the string typecast operator, so this function is a little redundant.

string getFullpathWoExtension ( )

Returns the full filename--directory and basename parts--except for the extension.

long int getInt64Word ( int  n) [inherited]

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

int getIntWord ( int  n) [inherited]

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

string getName ( ) [inherited]

Returns the name of the variable.

int getNumWords ( ) [inherited]

Returns the number of words in the variable's value.

A word is defined as a sequence of non-whitespace characters delimited by whitespace.

string getStringValue ( ) [inherited]

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

string getStringWord ( int  n) [inherited]

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

int getTrustLevel ( ) [inherited]

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

Filename const getValue ( )

Returns the variable's value.

ValueType getValueType ( ) [inherited]

Returns the stated type of this variable.

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

Filename getWord ( int  n)

Returns the variable's nth value.

bool hasBoolWord ( int  n) [inherited]

Returns true if the variable's value has a valid boolean value for the nth word.

bool hasDoubleWord ( int  n) [inherited]

Returns true if the variable's value has a valid integer value for the nth word.

bool hasInt64Word ( int  n) [inherited]

Returns true if the variable's value has a valid 64-bit integer value for the nth word.

bool hasIntWord ( int  n) [inherited]

Returns true if the variable's value has a valid integer value for the nth word.

bool hasLocalValue ( ) [inherited]

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

bool hasStringWord ( int  n) [inherited]

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.

bool hasValue ( ) [inherited]

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.

bool isClosed ( ) [inherited]

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

bool isDynamic ( ) [inherited]

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.

unsigned int length ( )
bool operator!= ( Filename const  other)
bool operator< ( Filename const  other)
ConfigVariableFilename operator= ( Filename const  value)

Reassigns the variable's local value.

bool operator== ( Filename const  other)
char operator[] ( int  n)
output ( ostream  out) [inherited]
setBoolWord ( int  n,
bool  value 
) [inherited]

Changes the nth word to the indicated value without affecting the other words.

setDoubleWord ( int  n,
double  value 
) [inherited]

Changes the nth word to the indicated value without affecting the other words.

setInt64Word ( int  n,
long int  value 
) [inherited]

Changes the nth word to the indicated value without affecting the other words.

setIntWord ( int  n,
int  value 
) [inherited]

Changes the nth word to the indicated value without affecting the other words.

setStringValue ( string  value) [inherited]

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.

setStringWord ( int  n,
string  value 
) [inherited]

Changes the nth word to the indicated value without affecting the other words.

setValue ( Filename const  value)

Reassigns the variable's local value.

setWord ( int  n,
Filename const  value 
)

Reassigns the variable's nth value.

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

write ( ostream  out) [inherited]
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties