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"
27 bool Extensible::Extend(std::string key, char* p)
29 // only add an item if it doesnt already exist
30 if (this->Extension_Items.find(key) == this->Extension_Items.end())
32 this->Extension_Items[key] = p;
33 log(DEBUG,"Extending object with item %s",key.c_str());
36 // item already exists, return false
40 bool Extensible::Shrink(std::string key)
42 // only attempt to remove a map item that exists
43 if (this->Extension_Items.find(key) != this->Extension_Items.end())
45 this->Extension_Items.erase(this->Extension_Items.find(key));
46 log(DEBUG,"Shrinking object with item %s",key.c_str());
52 char* Extensible::GetExt(std::string key)
54 if (this->Extension_Items.find(key) != this->Extension_Items.end())
56 return (this->Extension_Items.find(key))->second;
58 log(DEBUG,"Cant find item %s",key.c_str());