]> Dogcows Code - chaz/openbox/blobdiff - util/epist/config.hh
some debug messages for bug testing
[chaz/openbox] / util / epist / config.hh
index 1732012510c465fa7b055bb29c1da9f7032abe9a..2c2957470e075fa18f3470fb9b35fadbe7f45824 100644 (file)
 #include <string>
 #include <list>
 
-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<ConfigItem *> ItemList;
-  ItemList items;
+  typedef std::list<BoolItem *> BoolItemList;
+  typedef std::list<StringItem *> StringItemList;
+  typedef std::list<NumberItem *> NumberItemList;
+  BoolItemList bool_items;
+  StringItemList string_items;
+  NumberItemList number_items;
 
 public:
   Config();
   ~Config();
 
-  const std::string &getStringValue(Config::ItemType) 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
This page took 0.021368 seconds and 4 git commands to generate.