summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-30 14:47:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-30 14:47:34 +0000
commit1899777c6d86544a7775bc96175283957a763326 (patch)
tree0658d4ea96936aebaae74ee99c57df1e4946398e /src
parent9f40c69ca062be39abecc06870824332da558c25 (diff)
Added base.cpp, fixed documentation for userrec::HasPermission
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@757 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/base.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/base.cpp b/src/base.cpp
new file mode 100644
index 000000000..7e545694b
--- /dev/null
+++ b/src/base.cpp
@@ -0,0 +1,38 @@
+#include "base.h"
+#include "inspircd_config.h"
+#include <time.h>
+#include <map>
+#include <string>
+
+bool Extensible::Extend(std::string key, VoidPointer p)
+{
+ // only add an item if it doesnt already exist
+ if (this->Extension_Items.find(key) == this->Extension_Items.end())
+ {
+ this->Extension_Items[key] == p;
+ return true;
+ }
+ // item already exists, return false
+ return false;
+}
+
+bool Extensible::Shrink(std::string key)
+{
+ // only attempt to remove a map item that exists
+ if (this->Extension_Items.find(key) != this->Extension_Items.end())
+ {
+ this->Extension_Items.erase(this->Extension_Items.find(key));
+ return true;
+ }
+ return false;
+}
+
+VoidPointer Extensible::GetExt(std::string key)
+{
+ if (this->Extension_Items.find(key) != this->Extension_Items.end())
+ {
+ return (this->Extension_Items.find(key))->second;
+ }
+ return NULL;
+}
+