Panda3D
 All Classes Functions Variables Enumerations
configVariableBase.h
1 // Filename: configVariableBase.h
2 // Created by: drose (21Oct04)
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 CONFIGVARIABLEBASE_H
16 #define CONFIGVARIABLEBASE_H
17 
18 #include "dtoolbase.h"
19 #include "configFlags.h"
20 #include "configVariableCore.h"
21 #include "configDeclaration.h"
22 #include "configVariableManager.h"
23 #include "vector_string.h"
24 #include "pset.h"
25 
26 // Use this macro to wrap around a description passed to a
27 // ConfigVariable constructor. This allows the description to be
28 // completely compiled out, so that it won't even be a part of the
29 // string table, in the absence of PRC_SAVE_DESCRIPTIONS.
30 #ifdef PRC_SAVE_DESCRIPTIONS
31 #define PRC_DESC(description) description
32 #else
33 #define PRC_DESC(description) ""
34 #endif
35 
36 ////////////////////////////////////////////////////////////////////
37 // Class : ConfigVariableBase
38 // Description : This class is the base class for both
39 // ConfigVariableList and ConfigVariable (and hence for
40 // all of the ConfigVariableBool, ConfigVaribleString,
41 // etc. classes). It collects together the common
42 // interface for all generic ConfigVariables.
43 //
44 // Mostly, this class serves as a thin wrapper around
45 // ConfigVariableCore and/or ConfigDeclaration, more or
46 // less duplicating the interface presented there.
47 ////////////////////////////////////////////////////////////////////
48 class EXPCL_DTOOLCONFIG ConfigVariableBase : public ConfigFlags {
49 protected:
50  INLINE ConfigVariableBase(const string &name, ValueType type);
51  ConfigVariableBase(const string &name, ValueType type,
52  const string &description, int flags);
53  INLINE ~ConfigVariableBase();
54 
55 PUBLISHED:
56  INLINE const string &get_name() const;
57 
58  INLINE ValueType get_value_type() const;
59  INLINE const string &get_description() const;
60  INLINE int get_flags() const;
61  INLINE bool is_closed() const;
62  INLINE int get_trust_level() const;
63  INLINE bool is_dynamic() const;
64 
65  INLINE bool clear_local_value();
66  INLINE bool has_local_value() const;
67  INLINE bool has_value() const;
68 
69  INLINE void output(ostream &out) const;
70  INLINE void write(ostream &out) const;
71 
72 protected:
73  void record_unconstructed() const;
74  bool was_unconstructed() const;
75 
76  ConfigVariableCore *_core;
77 
79  static Unconstructed *_unconstructed;
80 };
81 
82 INLINE ostream &operator << (ostream &out, const ConfigVariableBase &variable);
83 
84 #include "configVariableBase.I"
85 
86 #endif
The internal definition of a ConfigVariable.
This class is the base class of both ConfigVariable and ConfigVariableCore.
Definition: configFlags.h:29
This is our own Panda specialization on the default STL set.
Definition: pset.h:52
This class is the base class for both ConfigVariableList and ConfigVariable (and hence for all of the...