Moved URLEncoder into separate header, made it a global service.
[shibboleth/cpp-opensaml.git] / saml / SAMLConfig.h
index 90e00ad..1d0dbd1 100644 (file)
@@ -24,7 +24,6 @@
 #define __saml_config_h__\r
 \r
 #include <saml/base.h>\r
-#include <saml/binding/ArtifactMap.h>\r
 \r
 #include <xmltooling/PluginManager.h>\r
 #include <xmltooling/XMLToolingConfig.h>\r
  */\r
 namespace opensaml {\r
 \r
+    class SAML_API ArtifactMap;\r
     class SAML_API MessageEncoder;\r
     class SAML_API MessageDecoder;\r
     class SAML_API SAMLArtifact;\r
     class SAML_API TrustEngine;\r
+    class SAML_API URLEncoder;\r
 \r
     namespace saml2md {\r
         class SAML_API MetadataProvider;\r
@@ -100,10 +101,7 @@ namespace opensaml {
          * \r
          * @param artifactMap   new ArtifactMap instance to store\r
          */\r
-        void setArtifactMap(ArtifactMap* artifactMap) {\r
-            delete m_artifactMap;\r
-            m_artifactMap = artifactMap;\r
-        }\r
+        void setArtifactMap(ArtifactMap* artifactMap);\r
         \r
         /**\r
          * Returns the global ArtifactMap instance.\r
@@ -113,6 +111,24 @@ namespace opensaml {
         ArtifactMap* getArtifactMap() const {\r
             return m_artifactMap;\r
         }\r
+\r
+        /**\r
+         * Sets the global URLEncoder instance.\r
+         * This method must be externally synchronized with any code that uses the object.\r
+         * Any previously set object is destroyed.\r
+         * \r
+         * @param urlEncoder   new URLEncoder instance to store\r
+         */\r
+        void setURLEncoder(URLEncoder* urlEncoder);\r
+        \r
+        /**\r
+         * Returns the global URLEncoder instance.\r
+         * \r
+         * @return  global URLEncoder\r
+         */\r
+        URLEncoder* getURLEncoder() const {\r
+            return m_urlEncoder;\r
+        }\r
         \r
         /**\r
          * Generate random information using the underlying security library\r
@@ -179,10 +195,13 @@ namespace opensaml {
         xmltooling::PluginManager<saml2md::MetadataFilter,const DOMElement*> MetadataFilterManager;\r
 \r
     protected:\r
-        SAMLConfig() : m_artifactMap(NULL) {}\r
+        SAMLConfig() : m_artifactMap(NULL), m_urlEncoder(NULL) {}\r
         \r
         /** Global ArtifactMap instance for use by artifact-related functions. */\r
         ArtifactMap* m_artifactMap;\r
+\r
+        /** Global URLEncoder instance for use by URL-related functions. */\r
+        URLEncoder* m_urlEncoder;\r
     };\r
 \r
 #if defined (_MSC_VER)\r