Panda3D
Loading...
Searching...
No Matches
configVariableList.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file configVariableList.h
10 * @author drose
11 * @date 2004-10-20
12 */
13
14#ifndef CONFIGVARIABLELIST_H
15#define CONFIGVARIABLELIST_H
16
17#include "dtoolbase.h"
18#include "configVariableBase.h"
19
20/**
21 * This class is similar to ConfigVariable, but it reports its value as a list
22 * of strings. In this special case, all of the declarations of the variable
23 * are returned as the elements of this list, in order.
24 *
25 * Note that this is different from a normal ConfigVariableString, which just
26 * returns its topmost value, which can optionally be treated as a number of
27 * discrete words by dividing it at the spaces.
28 *
29 * A ConfigVariableList cannot be modified locally.
30 */
31class EXPCL_DTOOL_PRC ConfigVariableList : public ConfigVariableBase {
32PUBLISHED:
33 INLINE ConfigVariableList(const std::string &name,
34 const std::string &description = std::string(),
35 int flags = 0);
36 INLINE ~ConfigVariableList();
37
38 INLINE size_t get_num_values() const;
39 INLINE std::string get_string_value(size_t n) const;
40
41 INLINE size_t get_num_unique_values() const;
42 INLINE std::string get_unique_value(size_t n) const;
43
44 INLINE size_t size() const;
45 INLINE std::string operator [] (size_t n) const;
46
47 void output(std::ostream &out) const;
48 void write(std::ostream &out) const;
49};
50
51INLINE std::ostream &operator << (std::ostream &out, const ConfigVariableList &variable);
52
53#include "configVariableList.I"
54
55#endif
This class is similar to ConfigVariable, but it reports its value as a list of strings.
std::string get_unique_value(size_t n) const
Returns the nth unique value of the variable.
size_t get_num_unique_values() const
Returns the number of unique values in the variable.
size_t size() const
Returns the number of unique values of 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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.