Panda3D
configVariable.h
1 // Filename: configVariable.h
2 // Created by: drose (18Oct04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CONFIGVARIABLE_H
16 #define CONFIGVARIABLE_H
17 
18 #include "dtoolbase.h"
19 #include "configVariableBase.h"
20 #include "numeric_types.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : ConfigVariable
24 // Description : This is a generic, untyped ConfigVariable. It is
25 // also the base class for the typed ConfigVariables,
26 // and contains all of the code common to
27 // ConfigVariables of all types (except
28 // ConfigVariableList, which is a bit of a special
29 // case).
30 //
31 // Mostly, this class serves as a thin wrapper around
32 // ConfigVariableCore and/or ConfigDeclaration, more or
33 // less duplicating the interface presented there.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_DTOOLCONFIG ConfigVariable : public ConfigVariableBase {
36 protected:
37  INLINE ConfigVariable(const string &name, ValueType type);
38  INLINE ConfigVariable(const string &name, ValueType type,
39  const string &description, int flags);
40 
41 PUBLISHED:
42  INLINE ConfigVariable(const string &name);
43  INLINE ~ConfigVariable();
44 
45  INLINE const ConfigDeclaration *get_default_value() const;
46 
47  INLINE const string &get_string_value() const;
48  INLINE void set_string_value(const string &value);
49  INLINE void clear_value();
50 
51  INLINE int get_num_words() const;
52 
53  INLINE bool has_string_word(int n) const;
54  INLINE bool has_bool_word(int n) const;
55  INLINE bool has_int_word(int n) const;
56  INLINE bool has_int64_word(int n) const;
57  INLINE bool has_double_word(int n) const;
58 
59  INLINE string get_string_word(int n) const;
60  INLINE bool get_bool_word(int n) const;
61  INLINE int get_int_word(int n) const;
62  INLINE PN_int64 get_int64_word(int n) const;
63  INLINE double get_double_word(int n) const;
64 
65  INLINE void set_string_word(int n, const string &value);
66  INLINE void set_bool_word(int n, bool value);
67  INLINE void set_int_word(int n, int value);
68  INLINE void set_int64_word(int n, PN_int64 value);
69  INLINE void set_double_word(int n, double value);
70 
71 protected:
72  INLINE bool is_constructed() const;
73  void report_unconstructed() const;
74 };
75 
76 #include "configVariable.I"
77 
78 #endif
This is a generic, untyped ConfigVariable.
This class is the base class for both ConfigVariableList and ConfigVariable (and hence for all of the...
A single declaration of a config variable, typically defined as one line in a .prc file...