diff options
Diffstat (limited to 'meowpp/oo/ObjSelector.h')
-rw-r--r-- | meowpp/oo/ObjSelector.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/meowpp/oo/ObjSelector.h b/meowpp/oo/ObjSelector.h index e70c496..58debcb 100644 --- a/meowpp/oo/ObjSelector.h +++ b/meowpp/oo/ObjSelector.h @@ -34,11 +34,22 @@ namespace meow{ funcs().erase(s); } } + static ObjBase const* access(std::string s){ + if(funcs().find(s) == funcs().end()) return NULL; + return funcs()[s]; + } static ObjBase* get(std::string s){ if(funcs().find(s) == funcs().end() || funcs()[s] == NULL) return NULL; return funcs()[s]->create(); } + static std::string find(ObjBase* o){ + for(Funcs::iterator it = funcs().begin(); it != funcs().end(); it++) + if(it->second != NULL && it->second->type() == o->type()){ + return it->first; + } + return std::string(); + } static Types lst(){ Types ret; for(Funcs::iterator it = funcs().begin(); it != funcs().end(); it++) |