OBPlugin::PluginMapType& OBPlugin::GetTypeMap(const char* PluginID) { PluginMapType::iterator itr; itr = PluginMap().find(PluginID); if(itr!=PluginMap().end()) return itr->second->GetMap(); return PluginMap();//error: type not found; return plugins map }
OBPlugin::PluginMapType& OBPlugin::GetTypeMap(const char* PluginID) { PluginMapType::iterator itr; // Make sure the plugins are loaded if (AllPluginsLoaded == 0) { OBPlugin::LoadAllPlugins(); } itr = PluginMap().find(PluginID); if(itr!=PluginMap().end()) return itr->second->GetMap(); return PluginMap();//error: type not found; return plugins map }
OBPlugin* OBPlugin::GetPlugin(const char* Type, const char* ID) { if(Type!=NULL) return BaseFindType(GetTypeMap(Type), ID); //When Type==NULL, search all types for matching ID and stop when found PluginMapType::iterator itr; for(itr=PluginMap().begin();itr!= PluginMap().end();++itr) { OBPlugin* result = BaseFindType(itr->second->GetMap(), ID); if(result) return result; } return NULL; //not found }
bool OBPlugin::ListAsVector(const char* PluginID, const char* param, vector<string>& vlist) { PluginMapType::iterator itr; bool ret=true; // Make sure the plugins are loaded if (AllPluginsLoaded == 0) { LoadAllPlugins(); } if(PluginID) { if(*PluginID!=0 && strcmp(PluginID, "plugins")) { //List the sub classes of the specified type itr = PluginMap().find(PluginID); if(itr!=PluginMap().end()) { bool onlyIDs = param!=NULL && strstr(param,"ids")!=NULL; //Get map of plugin type (like OBFingerprint) and output its contents PluginMapType Map = itr->second->GetMap(); for(itr=Map.begin(); itr!=Map.end(); ++itr) { if(*(itr->first)=='_')//no listing when ID starts with '_' continue; if(onlyIDs) vlist.push_back(itr->first); else { string txt; if((itr->second)->Display(txt, param, itr->first)) vlist.push_back(txt); } } return true; } ret=false; //asked for a type not available; provide plugin types instead } } //List the plugin types for(itr=PluginMap().begin(); itr!= PluginMap().end(); ++itr) vlist.push_back(itr->first); return ret; }