Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ConfigVariableEnum< EnumType > Class Template Reference

This class specializes ConfigVariable as an enumerated type. More...

#include "configVariableEnum.h"

Inheritance diagram for ConfigVariableEnum< EnumType >:
ConfigVariable ConfigVariableBase ConfigFlags

Public Member Functions

 ConfigVariableEnum (const std::string &name, const std::string &default_value, const std::string &description=std::string(), int flags=0)
 
 ConfigVariableEnum (const std::string &name, EnumType default_value, const std::string &description=std::string(), int flags=0)
 
EnumType get_default_value () const
 
EnumType get_value () const
 
EnumType get_word (size_t n) const
 Returns the variable's nth value.
 
 operator EnumType () const
 Returns the variable's value.
 
void operator= (EnumType value)
 Reassigns the variable's local value.
 
EnumType operator[] (size_t n) const
 Returns the value of the variable's nth word.
 
void set_value (EnumType value)
 
void set_word (size_t n, EnumType value)
 Reassigns the variable's nth value.
 
size_t size () const
 Returns the number of unique words in the variable.
 
- Public Member Functions inherited from ConfigVariable
 ConfigVariable (const std::string &name)
 Use this constructor to make a ConfigVariable of an unspecified type.
 
void clear_value ()
 Removes the value assigned to this variable, and lets its original value (as read from the prc files) show through.
 
size_t get_num_words () const
 Returns the number of words in the variable's value.
 
const std::string & get_string_value () const
 Returns the toplevel value of the variable, formatted as a string.
 
void set_string_value (const std::string &value)
 Changes the value assigned to this variable.
 
- Public Member Functions inherited from ConfigVariableBase
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.
 
const std::string & get_description () const
 
int get_flags () const
 Returns the flags value as set by set_flags().
 
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.
 
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.
 
bool is_closed () const
 
bool is_dynamic () const
 
void output (std::ostream &out) const
 
void write (std::ostream &out) const
 

Public Attributes

 get_default_value
 Returns the variable's default value.
 
 get_value
 Returns the variable's value.
 
 set_value
 Reassigns the variable's local value.
 
- Public Attributes inherited from ConfigVariableBase
 get_description
 Returns the brief description of this variable, if it has been defined.
 
 get_name
 Returns the name of the variable.
 
 get_trust_level
 Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.
 
 get_value_type
 Returns the stated type of this variable.
 
 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()).
 
 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.
 

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

template<class EnumType>
class ConfigVariableEnum< EnumType >

This class specializes ConfigVariable as an enumerated type.

It is a template class, so it cannot be easily published; it's not really necessary outside of C++ anyway.

This variable assumes that the enumerated type in question has input and output stream operators defined that do the right thing (outputting a sensible string for the type, and converting a string to the correct value).

Definition at line 31 of file configVariableEnum.h.

Constructor & Destructor Documentation

◆ ConfigVariableEnum() [1/2]

template<class EnumType >
ConfigVariableEnum< EnumType >::ConfigVariableEnum ( const std::string & name,
EnumType default_value,
const std::string & description = std::string(),
int flags = 0 )
inline

Definition at line 18 of file configVariableEnum.I.

◆ ConfigVariableEnum() [2/2]

template<class EnumType >
ConfigVariableEnum< EnumType >::ConfigVariableEnum ( const std::string & name,
const std::string & default_value,
const std::string & description = std::string(),
int flags = 0 )
inline

Definition at line 38 of file configVariableEnum.I.

◆ ~ConfigVariableEnum()

template<class EnumType >
ConfigVariableEnum< EnumType >::~ConfigVariableEnum ( )
inline

Definition at line 58 of file configVariableEnum.I.

Member Function Documentation

◆ get_word()

template<class EnumType >
EnumType ConfigVariableEnum< EnumType >::get_word ( size_t n) const
inline

Returns the variable's nth value.

Definition at line 141 of file configVariableEnum.I.

◆ operator EnumType()

template<class EnumType >
ConfigVariableEnum< EnumType >::operator EnumType ( ) const
inline

Returns the variable's value.

Definition at line 75 of file configVariableEnum.I.

◆ operator=()

template<class EnumType >
void ConfigVariableEnum< EnumType >::operator= ( EnumType value)
inline

Reassigns the variable's local value.

Definition at line 66 of file configVariableEnum.I.

◆ operator[]()

template<class EnumType >
EnumType ConfigVariableEnum< EnumType >::operator[] ( size_t n) const
inline

Returns the value of the variable's nth word.

Definition at line 93 of file configVariableEnum.I.

◆ set_word()

template<class EnumType >
void ConfigVariableEnum< EnumType >::set_word ( size_t n,
EnumType value )
inline

Reassigns the variable's nth value.

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

Definition at line 151 of file configVariableEnum.I.

◆ size()

template<class EnumType >
size_t ConfigVariableEnum< EnumType >::size ( ) const
inline

Returns the number of unique words in the variable.

Definition at line 84 of file configVariableEnum.I.

Member Data Documentation

◆ get_default_value

template<class EnumType >
EnumType ConfigVariableEnum< EnumType >::get_default_value
inline

Returns the variable's default value.

Definition at line 51 of file configVariableEnum.h.

◆ get_value

template<class EnumType >
EnumType ConfigVariableEnum< EnumType >::get_value
inline

Returns the variable's value.

Definition at line 50 of file configVariableEnum.h.

◆ set_value

template<class EnumType >
void ConfigVariableEnum< EnumType >::set_value
inline

Reassigns the variable's local value.

Definition at line 50 of file configVariableEnum.h.


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