1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
18 #include "inspircd_config.h"
24 #include "helperfuncs.h"
28 bool Extensible::Extend(std::string key, char* p)
30 // only add an item if it doesnt already exist
31 if (this->Extension_Items.find(key) == this->Extension_Items.end())
33 this->Extension_Items[key] = p;
34 log(DEBUG,"Extending object with item %s",key.c_str());
37 // item already exists, return false
41 bool Extensible::Shrink(std::string key)
43 // only attempt to remove a map item that exists
44 if (this->Extension_Items.find(key) != this->Extension_Items.end())
46 this->Extension_Items.erase(this->Extension_Items.find(key));
47 log(DEBUG,"Shrinking object with item %s",key.c_str());
53 char* Extensible::GetExt(std::string key)
55 if (this->Extension_Items.find(key) != this->Extension_Items.end())
57 return (this->Extension_Items.find(key))->second;
59 log(DEBUG,"Cant find item %s",key.c_str());