Panda3D
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ConfigVariableList Class Reference

This class is similar to ConfigVariable, but it reports its value as a list of strings. More...

#include "configVariableList.h"

Inheritance diagram for ConfigVariableList:
ConfigVariableBase ConfigFlags

Public Member Functions

 ConfigVariableList (const std::string &name, const std::string &description=std::string(), int flags=0)
 
size_t get_num_unique_values () const
 Returns the number of unique values in the variable.
 
size_t get_num_values () const
 Returns the number of values in the variable.
 
std::string get_string_value (size_t n) const
 Returns the nth value of the variable.
 
std::string get_unique_value (size_t n) const
 Returns the nth unique value of the variable.
 
std::string operator[] (size_t n) const
 Returns the nth unique value of the variable.
 
void output (std::ostream &out) const
 
size_t size () const
 Returns the number of unique values of the variable.
 
void write (std::ostream &out) const
 
- 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
 

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

Detailed Description

This class is similar to ConfigVariable, but it reports its value as a list of strings.

In this special case, all of the declarations of the variable are returned as the elements of this list, in order.

Note that this is different from a normal ConfigVariableString, which just returns its topmost value, which can optionally be treated as a number of discrete words by dividing it at the spaces.

A ConfigVariableList cannot be modified locally.

Definition at line 31 of file configVariableList.h.

Constructor & Destructor Documentation

◆ ConfigVariableList()

ConfigVariableList::ConfigVariableList ( const std::string & name,
const std::string & description = std::string(),
int flags = 0 )
inline

Definition at line 24 of file configVariableList.I.

◆ ~ConfigVariableList()

ConfigVariableList::~ConfigVariableList ( )
inline

Definition at line 17 of file configVariableList.I.

Member Function Documentation

◆ get_num_unique_values()

size_t ConfigVariableList::get_num_unique_values ( ) const
inline

Returns the number of unique values in the variable.

Definition at line 67 of file configVariableList.I.

Referenced by Texture::adjust_size(), VirtualFileSystem::get_global_ptr(), MovieTypeRegistry::load_audio_types(), MovieTypeRegistry::load_video_types(), and size().

◆ get_num_values()

size_t ConfigVariableList::get_num_values ( ) const
inline

Returns the number of values in the variable.

Definition at line 45 of file configVariableList.I.

◆ get_string_value()

std::string ConfigVariableList::get_string_value ( size_t n) const
inline

Returns the nth value of the variable.

Definition at line 54 of file configVariableList.I.

References ConfigDeclaration::get_string_value().

◆ get_unique_value()

std::string ConfigVariableList::get_unique_value ( size_t n) const
inline

◆ operator[]()

std::string ConfigVariableList::operator[] ( size_t n) const
inline

Returns the nth unique value of the variable.

Note that the indexing operator returns the list of unique values, and so the maximum range is get_num_unique_values().

Definition at line 99 of file configVariableList.I.

References get_unique_value().

◆ output()

void ConfigVariableList::output ( std::ostream & out) const

Definition at line 19 of file configVariableList.cxx.

◆ size()

size_t ConfigVariableList::size ( ) const
inline

Returns the number of unique values of the variable.

Definition at line 89 of file configVariableList.I.

References get_num_unique_values().

◆ write()

void ConfigVariableList::write ( std::ostream & out) const

Definition at line 27 of file configVariableList.cxx.


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