Panda3D
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. More...
 
size_t get_num_values () const
 Returns the number of values in the variable. More...
 
std::string get_string_value (size_t n) const
 Returns the nth value of the variable. More...
 
std::string get_unique_value (size_t n) const
 Returns the nth unique value of the variable. More...
 
std::string operator [] (size_t n) const
 Returns the nth unique value of the variable. More...
 
void output (std::ostream &out) const
 
size_t size () const
 Returns the number of unique values of the variable. More...
 
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. More...
 
const std::string & get_description () const
 
int get_flags () const
 Returns the flags value as set by set_flags(). More...
 
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. More...
 
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. More...
 
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. More...
 
 get_name
 Returns the name of the variable. More...
 
 get_trust_level
 Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable. More...
 
 get_value_type
 Returns the stated type of this variable. More...
 
 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()). More...
 
 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. More...
 

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.

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 68 of file configVariableList.I.

Referenced by size().

◆ get_num_values()

size_t ConfigVariableList::get_num_values ( ) const
inline

Returns the number of values in the variable.

Definition at line 46 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 55 of file configVariableList.I.

◆ get_unique_value()

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

Returns the nth unique value of the variable.

Definition at line 77 of file configVariableList.I.

Referenced by operator []().

◆ 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 100 of file configVariableList.I.

References get_unique_value().

◆ size()

size_t ConfigVariableList::size ( ) const
inline

Returns the number of unique values of the variable.

Definition at line 90 of file configVariableList.I.

References get_num_unique_values().


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