2 #include "inspircd_config.h"
9 bool Extensible::Extend(std::string key, char* p)
11 // only add an item if it doesnt already exist
12 if (this->Extension_Items.find(key) == this->Extension_Items.end())
14 this->Extension_Items[key] = p;
15 log(DEBUG,"Extending object with item %s",key.c_str());
18 // item already exists, return false
22 bool Extensible::Shrink(std::string key)
24 // only attempt to remove a map item that exists
25 if (this->Extension_Items.find(key) != this->Extension_Items.end())
27 this->Extension_Items.erase(this->Extension_Items.find(key));
28 log(DEBUG,"Shrinking object with item %s",key.c_str());
34 char* Extensible::GetExt(std::string key)
36 log(DEBUG,"Checking extension items for %s",key.c_str());
37 if (this->Extension_Items.find(key) != this->Extension_Items.end())
39 log(DEBUG,"Found item %s %s",key.c_str(),(this->Extension_Items.find(key))->second);
40 return (this->Extension_Items.find(key))->second;
42 log(DEBUG,"Cant find item %s",key.c_str());