summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-30 12:26:20 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-30 12:26:20 +0000
commita89b0ed42d90f714e4fa01265f5cd4995686ba82 (patch)
treea96668cfa83979741a67e96bb1f9a794526fb8df /include
parentf61345bd0eed92ccc4882a190a19c902fbbfc5fb (diff)
Added Extensible classes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@754 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/base.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/base.h b/include/base.h
index dbe4588e9..e755fc951 100644
--- a/include/base.h
+++ b/include/base.h
@@ -40,6 +40,29 @@ class Extensible : public classbase
/** Private data store
*/
std::map<std::string,VoidPointer> 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, VoidPointer 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.
+ */
+ VoidPointer GetExt(std::string key);
};
#endif