Fix bot module loading in Guile 1.9.x+
[clinton/bobotpp.git] / source / BotConfig.H
index 5d6c61d..d657f71 100644 (file)
@@ -1,5 +1,5 @@
 // BotConfig.H  -*- C++ -*-
-// Copyright (C) 2004 Clinton Ebadi
+// Copyright (C) 2004,2005 Clinton Ebadi
 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
 
 /*
   Config Database:
   map<key,pair<list<string>,list<watcher>>
   void watcher (key, options, appended?)
 
+  NOTE: The key is always UPPERCASE internally. Keys are converted
+  automagically to uppercase.
+
 */
 
 #include <map>
@@ -32,7 +36,8 @@ public:
   typedef std::string t_value;
   typedef std::list<t_value> t_value_list;
 
-  typedef void (*t_watcher) (std::string key, t_value_list vals, bool appended);
+  typedef void (*t_watcher) 
+    (std::string key, t_value_list vals, bool appended);
 
   typedef std::list<t_watcher> t_watcher_list;
   typedef std::pair<t_value_list, t_watcher_list> t_option_values;
@@ -45,9 +50,11 @@ private:
   std::string config_filename;
 
 public:
-  BotConfig (std::string);
+  BotConfig (std::string); // sets config_filename but DOES NOT read
+                          // config!
 
-  bool read_config (); // true if read successfully
+  bool read_config (); // true if read successfully. This also clears
+                      // the option_db.
   bool write_config (); // true if written succesfully
 
   // Getters
@@ -58,16 +65,17 @@ public:
   // Setters
   void set_option_value (std::string key, t_value_list values, 
                         bool append);
-  
+  // Convinience proc
+  void set_option_value (std::string key, t_value value, bool append);
 
   std::string set_config_file (std::string new_filename); // returns
                                                          // old
                                                          // filename
 
   bool add_watcher (std::string key, t_watcher new_watcher); // t if key
-                                                          // exists,
-                                                          // f
-                                                          // otherwise
+                                                            // exists,
+                                                            // f
+                                                            // otherwise
   bool clear_watchers (std::string key); // t if key exists, f
                                         // otherwise