Panda3D
|
00001 // Filename: configVariable.h 00002 // Created by: drose (18Oct04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CONFIGVARIABLE_H 00016 #define CONFIGVARIABLE_H 00017 00018 #include "dtoolbase.h" 00019 #include "configVariableBase.h" 00020 #include "numeric_types.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : ConfigVariable 00024 // Description : This is a generic, untyped ConfigVariable. It is 00025 // also the base class for the typed ConfigVariables, 00026 // and contains all of the code common to 00027 // ConfigVariables of all types (except 00028 // ConfigVariableList, which is a bit of a special 00029 // case). 00030 // 00031 // Mostly, this class serves as a thin wrapper around 00032 // ConfigVariableCore and/or ConfigDeclaration, more or 00033 // less duplicating the interface presented there. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_DTOOLCONFIG ConfigVariable : public ConfigVariableBase { 00036 protected: 00037 INLINE ConfigVariable(const string &name, ValueType type); 00038 INLINE ConfigVariable(const string &name, ValueType type, 00039 const string &description, int flags); 00040 00041 PUBLISHED: 00042 INLINE ConfigVariable(const string &name); 00043 INLINE ~ConfigVariable(); 00044 00045 INLINE const ConfigDeclaration *get_default_value() const; 00046 00047 INLINE const string &get_string_value() const; 00048 INLINE void set_string_value(const string &value); 00049 INLINE void clear_value(); 00050 00051 INLINE int get_num_words() const; 00052 00053 INLINE bool has_string_word(int n) const; 00054 INLINE bool has_bool_word(int n) const; 00055 INLINE bool has_int_word(int n) const; 00056 INLINE bool has_int64_word(int n) const; 00057 INLINE bool has_double_word(int n) const; 00058 00059 INLINE string get_string_word(int n) const; 00060 INLINE bool get_bool_word(int n) const; 00061 INLINE int get_int_word(int n) const; 00062 INLINE PN_int64 get_int64_word(int n) const; 00063 INLINE double get_double_word(int n) const; 00064 00065 INLINE void set_string_word(int n, const string &value); 00066 INLINE void set_bool_word(int n, bool value); 00067 INLINE void set_int_word(int n, int value); 00068 INLINE void set_int64_word(int n, PN_int64 value); 00069 INLINE void set_double_word(int n, double value); 00070 00071 protected: 00072 INLINE bool is_constructed() const; 00073 void report_unconstructed() const; 00074 }; 00075 00076 #include "configVariable.I" 00077 00078 #endif