From 33d419e4d54d969798af80f05e05f0c447a99594 Mon Sep 17 00:00:00 2001 From: cathook Date: Fri, 2 May 2014 04:10:56 +0800 Subject: big change about dir structure --- meowpp/oo/ObjSelector.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'meowpp/oo/ObjSelector.h') 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++) -- cgit v1.2.3