]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/base.h
Fixed recursive 'splat' in the actors table
[user/henk/code/inspircd.git] / include / base.h
index dbe4588e97e8c172b836a4c061aa2942f5647bbd..c959cf8698ff8096acaba47efbfb0197feb36b78 100644 (file)
@@ -1,6 +1,18 @@
-/*
-Defines the base classes used by InspIRCd
-*/
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *                       E-mail:
+ *                <brain@chatspike.net>
+ *               <Craig@chatspike.net>
+ *     
+ * Written by Craig Edwards, Craig McLure, and others.
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
 
 #ifndef __BASE_H__ 
 #define __BASE_H__ 
@@ -39,7 +51,30 @@ class Extensible : public classbase
 {
        /** Private data store
         */
-       std::map<std::string,VoidPointer> Extension_Items;
+       std::map<std::string,char*> Extension_Items;
+       
+public:
+
+       /** Extend an Extensible class.
+        * You must provide a key to store the data as, and a void* to the data (typedef VoidPointer)
+        * The data will be inserted into the map. If the data already exists, you may not insert it
+        * twice, Extensible::Extend will return false in this case.
+        * On successful extension, Extend returns true.
+        */
+       bool Extend(std::string key, char* p);
+
+       /** Shrink an Extensible class.
+        * You must provide a key name. The given key name will be removed from the classes data. If
+        * you provide a nonexistent key (case is important) then the function will return false.
+        * Returns true on success.
+        */
+       bool Shrink(std::string key);
+       
+       /** Get an extension item.
+        * You must provide a key name, which is case sensitive. 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);
 };
 
 #endif