00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CONFIGVARIABLEENUM_H
00016 #define CONFIGVARIABLEENUM_H
00017
00018 #include "dtoolbase.h"
00019 #include "configVariable.h"
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 template<class EnumType>
00035 class ConfigVariableEnum : public ConfigVariable {
00036 public:
00037 INLINE ConfigVariableEnum(const string &name, EnumType default_value,
00038 const string &description = string(),
00039 int flags = 0);
00040 INLINE ConfigVariableEnum(const string &name, const string &default_value,
00041 const string &description = string(),
00042 int flags = 0);
00043 INLINE ~ConfigVariableEnum();
00044
00045 INLINE void operator = (EnumType value);
00046 INLINE operator EnumType () const;
00047
00048 INLINE int size() const;
00049 INLINE EnumType operator [] (int n) const;
00050
00051 INLINE void set_value(EnumType value);
00052 INLINE EnumType get_value() const;
00053 INLINE EnumType get_default_value() const;
00054
00055 INLINE EnumType get_word(int n) const;
00056 INLINE void set_word(int n, EnumType value);
00057
00058 private:
00059 INLINE EnumType parse_string(const string &value) const;
00060 INLINE string format_enum(EnumType value) const;
00061
00062 private:
00063 bool _got_default_value;
00064 EnumType _default_value;
00065
00066 AtomicAdjust::Integer _local_modified;
00067 EnumType _cache;
00068 };
00069
00070 #include "configVariableEnum.I"
00071
00072 #endif
00073