X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fconfig.hh;h=2c2957470e075fa18f3470fb9b35fadbe7f45824;hb=b04f5a85d5dd3660207318403cf9e620b48dcc76;hp=443834edf8eff918bb3b494f3c648316e32a2035;hpb=aa827d0c91dcb808469af768cc9bed0ef8980abd;p=chaz%2Fopenbox diff --git a/util/epist/config.hh b/util/epist/config.hh index 443834ed..2c295747 100644 --- a/util/epist/config.hh +++ b/util/epist/config.hh @@ -26,50 +26,63 @@ #include #include -class ConfigItem; +// forward declarations +struct BoolItem; +struct StringItem; +struct NumberItem; class Config { public: - enum ItemType { - noType, + enum BoolType { + NO_BOOL_TYPE, + stackedCycling, + NUM_BOOL_TYPES + }; + + enum StringType { + NO_STRING_TYPE, + NUM_STRING_TYPES + }; + + enum NumberType { + NO_NUMBER_TYPE, chainTimeout, workspaceColumns, - numTypes + NUM_NUMBER_TYPES }; private: - typedef std::list ItemList; - ItemList items; + typedef std::list BoolItemList; + typedef std::list StringItemList; + typedef std::list NumberItemList; + BoolItemList bool_items; + StringItemList string_items; + NumberItemList number_items; public: Config(); ~Config(); - bool getStringValue(Config::ItemType, std::string &) const; - int getNumberValue(Config::ItemType) const; - void addOption(ConfigItem *); + bool getValue(BoolType, bool &) const; + bool getValue(StringType, std::string &) const; + bool getValue(NumberType, int &) const; + void addOption(const std::string &, const std::string &); }; +struct BoolItem { + Config::BoolType type; + bool value; +}; -class ConfigItem { -private: - Config::ItemType _type; - std::string _value; - -public: - ConfigItem(Config::ItemType type, std::string value) - : _type(type), _value(value) {} - ~ConfigItem() {} - - inline const std::string &getStringValue() const - { return _value; } - - inline int getNumberValue() const - { return atoi(_value.c_str()); } +struct StringItem { + Config::StringType type; + std::string value; +}; - inline Config::ItemType getType() const - { return _type; } +struct NumberItem { + Config::NumberType type; + int value; }; #endif // __config_hh