From: Scott Cantor Date: Mon, 31 Jul 2006 19:47:28 +0000 (+0000) Subject: Change type indicator to a string reference. X-Git-Tag: 1.0-alpha1~204 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-xmltooling.git;a=commitdiff_plain;h=5086646061286fedc8bf70ecc7c02ab41aa572cf Change type indicator to a string reference. --- diff --git a/xmltooling/PluginManager.h b/xmltooling/PluginManager.h index 67323c8..5f248e0 100644 --- a/xmltooling/PluginManager.h +++ b/xmltooling/PluginManager.h @@ -58,8 +58,8 @@ namespace xmltooling { * @param type the name of the plugin type * @param factory the factory function for the plugin type */ - void registerFactory(const char* type, typename PluginManager::Factory* factory) { - if (type && factory) + void registerFactory(const std::string& type, typename PluginManager::Factory* factory) { + if (!type.empty() && factory) m_map[type]=factory; } @@ -68,8 +68,8 @@ namespace xmltooling { * * @param type the name of the plugin type */ - void deregisterFactory(const char* type) { - if (type) + void deregisterFactory(const std::string& type) { + if (!type.empty()) m_map.erase(type); } @@ -88,10 +88,10 @@ namespace xmltooling { * @param p parameters to configure plugin * @return the constructed plugin */ - T* newPlugin(const char* type, const Params& p) { + T* newPlugin(const std::string& type, const Params& p) { typename std::map::const_iterator i=m_map.find(type); if (i==m_map.end()) - throw UnknownExtensionException("Unable to build plugin of type '$1'",params(1,type)); + throw UnknownExtensionException("Unable to build plugin of type '$1'",params(1,type.c_str())); return i->second(p); }