]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/base.h
Apparently to catch descendent classes we need to catch a reference to the parent...
[user/henk/code/inspircd.git] / include / base.h
index d253c5dc3dfe45fa37bc0f07ed5d2f1a644f660a..5f7ac0ffbb13be41f395b9733414906d9cf90db6 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
  *                       E-mail:
  *                <brain@chatspike.net>
  *               <Craig@chatspike.net>
@@ -20,6 +20,7 @@
 #include "inspircd_config.h" 
 #include <time.h>
 #include <map>
+#include <deque>
 #include <string>
 
 typedef void* VoidPointer;
@@ -86,7 +87,77 @@ public:
         * @return If you provide a non-existent key name, the function returns NULL, otherwise a pointer to the item referenced by the key is returned.
         */
        char* GetExt(std::string key);
+
+       /** Get a list of all extension items names.
+        *
+        * @param list A deque of strings to receive the list
+        *
+        * @return This function writes a list of all extension items stored in this object by name into the given deque and returns void.
+        */
+       void GetExtList(std::deque<std::string> &list);
+};
+
+/** BoolSet is a utility class designed to hold eight bools in a bitmask.
+ * Use BoolSet::Set and BoolSet::Get to set and get bools in the bitmask,
+ * and Unset and Invert for special operations upon them.
+ */
+class BoolSet
+{
+       char bits;
+
+ public:
+
+       /** The default constructor initializes the BoolSet to all values unset.
+        */
+       BoolSet();
+
+       /** This constructor copies the default bitmask from a char
+        */
+       BoolSet(char bitmask);
+
+       /** The Set method sets one bool in the set.
+        *
+        * @param number The number of the item to set. This must be between 0 and 7.
+        */
+       void Set(int number);
+
+       /** The Get method returns the value of one bool in the set
+        *
+        * @param number The number of the item to retrieve. This must be between 0 and 7.
+        *
+        * @return True if the item is set, false if it is unset.
+        */
+       bool Get(int number);
+
+       /** The Unset method unsets one value in the set
+        *
+        * @param number The number of the item to set. This must be between 0 and 7.
+        */
+       void Unset(int number);
+
+       /** The Unset method inverts (flips) one value in the set
+        *
+        * @param number The number of the item to invert. This must be between 0 and 7.
+        */
+       void Invert(int number);
+
+       /** Compare two BoolSets
+        */
+       bool operator==(BoolSet other);
+
+       /** OR two BoolSets together
+        */
+       BoolSet operator|(BoolSet other);
+       
+       /** AND two BoolSets together
+        */
+       BoolSet operator&(BoolSet other);
+
+       /** Assign one BoolSet to another
+        */
+       bool operator=(BoolSet other);
 };
 
+
 #endif