Fix linefeeds
[shibboleth/cpp-opensaml.git] / saml / binding / SAMLArtifact.h
index aadac32..3c9f3e5 100644 (file)
-/*\r
- *  Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/binding/SAMLArtifact.h\r
- * \r
- * Base class for SAML 1.x and 2.0 artifacts \r
- */\r
-\r
-#ifndef __saml_artifact_h__\r
-#define __saml_artifact_h__\r
-\r
-#include <saml/base.h>\r
-\r
-#include <string>\r
-#include <xmltooling/unicode.h>\r
-\r
-namespace opensaml {\r
-\r
-    /**\r
-     * Base class for SAML 1.x and 2.0 artifacts.\r
-     */\r
-    class SAML_API SAMLArtifact\r
-    {\r
-        SAMLArtifact& operator=(const SAMLArtifact& src);\r
-    public:\r
-        virtual ~SAMLArtifact() {}\r
-\r
-        /**\r
-         * Returns artifact encoded into null-terminated base64 for transmission.\r
-         */\r
-        virtual std::string encode() const;\r
-        \r
-        /**\r
-         * Builds a duplicate, independent artifact of the same type.\r
-         * \r
-         * @return the new artifact\r
-         */\r
-        virtual SAMLArtifact* clone() const=0;\r
-        \r
-        /**\r
-         * Returns all of the raw binary data that makes up the artifact.\r
-         * The result is NOT null-terminated.\r
-         * \r
-         * @return the binary artifact data\r
-         */\r
-        virtual std::string getBytes() const {\r
-            return m_raw;\r
-        }\r
-\r
-        /**\r
-         * Returns the binary type code of the artifact.\r
-         * The result MAY contain embedded null characters.\r
-         * \r
-         * @return the binary type code\r
-         */\r
-        virtual std::string getTypeCode() const {\r
-            return m_raw.substr(0,TYPECODE_LENGTH);\r
-        }\r
-        \r
-        /**\r
-         * Returns the binary artifact data following the type code.\r
-         * The result MAY contain embedded null characters.\r
-         * \r
-         * @return the binary artifact data\r
-         */\r
-        virtual std::string getRemainingArtifact() const {\r
-            return m_raw.substr(TYPECODE_LENGTH);\r
-        }\r
-        \r
-        /**\r
-         * Returns a string that identifies the source of the artifact.\r
-         * The exact form this takes depends on the type but should match\r
-         * the syntax needed for metadata lookup.\r
-         * \r
-         * @return null-terminated source string\r
-         */\r
-        virtual std::string getSource() const=0;\r
-        \r
-        /**\r
-         * Returns the binary data that references the message (2.0) or assertion (1.x)\r
-         * The exact form this takes depends on the type.\r
-         * The result MAY contain embedded null characters.\r
-         * \r
-         * @return the binary reference data\r
-         */\r
-        virtual std::string getMessageHandle() const=0;\r
-\r
-        /** Length of type code */            \r
-        static const unsigned int TYPECODE_LENGTH;\r
-\r
-        /**\r
-         * Parses a base64-encoded null-terminated string into an artifact,\r
-         * if the type is known.\r
-         * \r
-         * @param s base64-encoded artifact\r
-         * @return the decoded artifact\r
-         */\r
-        static SAMLArtifact* parse(const char* s);\r
-        \r
-        /**\r
-         * Parses a base64-encoded null-terminated string into an artifact,\r
-         * if the type is known.\r
-         * \r
-         * @param s base64-encoded artifact\r
-         * @return the decoded artifact\r
-         */\r
-        static SAMLArtifact* parse(const XMLCh* s) {\r
-            xmltooling::auto_ptr_char temp(s);\r
-            return parse(temp.get());\r
-        }\r
-\r
-        /**\r
-         * Converts binary data to hex notation.\r
-         * \r
-         * @param s the bytes to convert\r
-         * @return  the data in hex form, 2 characters per byte\r
-         */\r
-        static std::string toHex(const std::string& s);\r
-        \r
-    protected:\r
-        SAMLArtifact() {}\r
-\r
-        /**\r
-         * Decodes a base64-encoded artifact into its raw form.\r
-         * \r
-         * @param s NULL-terminated base64-encoded string \r
-         */        \r
-        SAMLArtifact(const char* s);\r
-\r
-        SAMLArtifact(const SAMLArtifact& src) : m_raw(src.m_raw) {}\r
-        \r
-        /** Raw binary data that makes up an artifact. */\r
-        std::string m_raw;\r
-    };\r
-\r
-    DECL_XMLTOOLING_EXCEPTION(ArtifactException,SAML_EXCEPTIONAPI(SAML_API),opensaml,xmltooling::XMLToolingException,Exceptions related to artifact parsing);\r
-    \r
-    /**\r
-     * Registers SAMLArtifact subclasses into the runtime.\r
-     */\r
-    void SAML_API registerSAMLArtifacts();\r
-};\r
-\r
-#endif /* __saml_artifact_h__ */\r
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file saml/binding/SAMLArtifact.h
+ * 
+ * Base class for SAML 1.x and 2.0 artifacts 
+ */
+
+#ifndef __saml_artifact_h__
+#define __saml_artifact_h__
+
+#include <saml/base.h>
+
+#include <string>
+#include <xmltooling/unicode.h>
+
+namespace opensaml {
+
+    /**
+     * Base class for SAML 1.x and 2.0 artifacts.
+     */
+    class SAML_API SAMLArtifact
+    {
+        SAMLArtifact& operator=(const SAMLArtifact& src);
+    public:
+        virtual ~SAMLArtifact() {}
+
+        /**
+         * Returns artifact encoded into null-terminated base64 for transmission.
+         */
+        virtual std::string encode() const;
+        
+        /**
+         * Builds a duplicate, independent artifact of the same type.
+         * 
+         * @return the new artifact
+         */
+        virtual SAMLArtifact* clone() const=0;
+        
+        /**
+         * Returns all of the raw binary data that makes up the artifact.
+         * The result is NOT null-terminated.
+         * 
+         * @return the binary artifact data
+         */
+        virtual std::string getBytes() const {
+            return m_raw;
+        }
+
+        /**
+         * Returns the binary type code of the artifact.
+         * The result MAY contain embedded null characters.
+         * 
+         * @return the binary type code
+         */
+        virtual std::string getTypeCode() const {
+            return m_raw.substr(0,TYPECODE_LENGTH);
+        }
+        
+        /**
+         * Returns the binary artifact data following the type code.
+         * The result MAY contain embedded null characters.
+         * 
+         * @return the binary artifact data
+         */
+        virtual std::string getRemainingArtifact() const {
+            return m_raw.substr(TYPECODE_LENGTH);
+        }
+        
+        /**
+         * Returns a string that identifies the source of the artifact.
+         * The exact form this takes depends on the type but should match
+         * the syntax needed for metadata lookup.
+         * 
+         * @return null-terminated source string
+         */
+        virtual std::string getSource() const=0;
+        
+        /**
+         * Returns the binary data that references the message (2.0) or assertion (1.x)
+         * The exact form this takes depends on the type.
+         * The result MAY contain embedded null characters.
+         * 
+         * @return the binary reference data
+         */
+        virtual std::string getMessageHandle() const=0;
+
+        /** Length of type code */            
+        static const unsigned int TYPECODE_LENGTH;
+
+        /**
+         * Parses a base64-encoded null-terminated string into an artifact,
+         * if the type is known.
+         * 
+         * @param s base64-encoded artifact
+         * @return the decoded artifact
+         */
+        static SAMLArtifact* parse(const char* s);
+        
+        /**
+         * Parses a base64-encoded null-terminated string into an artifact,
+         * if the type is known.
+         * 
+         * @param s base64-encoded artifact
+         * @return the decoded artifact
+         */
+        static SAMLArtifact* parse(const XMLCh* s) {
+            xmltooling::auto_ptr_char temp(s);
+            return parse(temp.get());
+        }
+
+        /**
+         * Converts binary data to hex notation.
+         * 
+         * @param s the bytes to convert
+         * @return  the data in hex form, 2 characters per byte
+         */
+        static std::string toHex(const std::string& s);
+        
+    protected:
+        SAMLArtifact() {}
+
+        /**
+         * Decodes a base64-encoded artifact into its raw form.
+         * 
+         * @param s NULL-terminated base64-encoded string 
+         */        
+        SAMLArtifact(const char* s);
+
+        SAMLArtifact(const SAMLArtifact& src) : m_raw(src.m_raw) {}
+        
+        /** Raw binary data that makes up an artifact. */
+        std::string m_raw;
+    };
+
+    DECL_XMLTOOLING_EXCEPTION(ArtifactException,SAML_EXCEPTIONAPI(SAML_API),opensaml,xmltooling::XMLToolingException,Exceptions related to artifact parsing);
+    
+    /**
+     * Registers SAMLArtifact subclasses into the runtime.
+     */
+    void SAML_API registerSAMLArtifacts();
+};
+
+#endif /* __saml_artifact_h__ */