Change type indicator to a string reference.
authorScott Cantor <cantor.2@osu.edu>
Mon, 31 Jul 2006 19:47:28 +0000 (19:47 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 31 Jul 2006 19:47:28 +0000 (19:47 +0000)
xmltooling/PluginManager.h

index 67323c8..5f248e0 100644 (file)
@@ -58,8 +58,8 @@ namespace xmltooling {
          * @param type      the name of the plugin type\r
          * @param factory   the factory function for the plugin type\r
          */\r
-        void registerFactory(const char* type, typename PluginManager::Factory* factory) {\r
-            if (type && factory)\r
+        void registerFactory(const std::string& type, typename PluginManager::Factory* factory) {\r
+            if (!type.empty() && factory)\r
                 m_map[type]=factory;\r
         }\r
 \r
@@ -68,8 +68,8 @@ namespace xmltooling {
          * \r
          * @param type  the name of the plugin type\r
          */\r
-        void deregisterFactory(const char* type) {\r
-            if (type)\r
+        void deregisterFactory(const std::string& type) {\r
+            if (!type.empty())\r
                 m_map.erase(type);\r
         }\r
 \r
@@ -88,10 +88,10 @@ namespace xmltooling {
          * @param p     parameters to configure plugin\r
          * @return      the constructed plugin  \r
          */\r
-        T* newPlugin(const char* type, const Params& p) {\r
+        T* newPlugin(const std::string& type, const Params& p) {\r
             typename std::map<std::string, typename PluginManager::Factory*>::const_iterator i=m_map.find(type);\r
             if (i==m_map.end())\r
-                throw UnknownExtensionException("Unable to build plugin of type '$1'",params(1,type));\r
+                throw UnknownExtensionException("Unable to build plugin of type '$1'",params(1,type.c_str()));\r
             return i->second(p);\r
         }\r
         \r