Initial unit test plus fixes
[shibboleth/cpp-xmltooling.git] / xmltooling / Namespace.h
index d94c845..3e9bfc8 100644 (file)
@@ -23,8 +23,7 @@
 #if !defined(__xmltooling_namespace_h__)\r
 #define __xmltooling_namespace_h__\r
 \r
-#include <string>\r
-#include <xmltooling/Namespace.h>\r
+#include <xmltooling/unicode.h>\r
 \r
 namespace xmltooling {\r
     \r
@@ -35,28 +34,24 @@ namespace xmltooling {
     {\r
     public:\r
         /**\r
-         * Default constructor\r
+         * Constructor\r
+         * @param uri               namespace URI\r
+         * @param prefix            namespace prefix (without the colon)\r
+         * @param alwaysDeclare     true iff the namespace should always be declared regardless of in-scope declarations\r
          */\r
-        Namespace();\r
-        \r
-        /**\r
-         * Constructor that takes an existing declaration\r
-         * @param uri       namespace URI\r
-         * @param prefix    namespace prefix (without the colon)\r
-         */\r
-        Namespace(const XMLCh* uri, const XMLCh* prefix);\r
+        Namespace(const XMLCh* uri=NULL, const XMLCh* prefix=NULL, bool alwaysDeclare=false);\r
         \r
         ~Namespace();\r
 #ifndef HAVE_GOOD_STL\r
         /**\r
          * Deep copy constructor\r
          */\r
-        Namespace(const Namespace&);\r
+        Namespace(const Namespace& src);\r
 \r
         /**\r
          * Deep assignment operator\r
          */\r
-        Namespace& operator=(const Namespace&);\r
+        Namespace& operator=(const Namespace& src);\r
 #endif\r
         \r
 #ifdef HAVE_GOOD_STL\r
@@ -86,6 +81,12 @@ namespace xmltooling {
 #endif\r
 \r
         /**\r
+         * Returns true iff the namespace should always be declared regardless of in-scope declarations\r
+         * @return the alwaysDeclared setting\r
+         */\r
+        const bool alwaysDeclare() const { return m_pinned; } \r
+\r
+        /**\r
          * Sets the namespace prefix\r
          * @param prefix    Null-terminated Unicode string containing the prefix, without the colon\r
          */\r
@@ -96,8 +97,15 @@ namespace xmltooling {
          * @param uri  Null-terminated Unicode string containing the URI\r
          */\r
         void setNamespaceURI(const XMLCh* uri);\r
+\r
+        /**\r
+         * Sets the alwaysDeclared property\r
+         * @param alwaysDeclare     true iff the namespace should always be declared regardless of in-scope declarations\r
+         */\r
+        void setAlwaysDeclare(bool alwaysDeclare) { m_pinned = alwaysDeclare; } \r
         \r
     private:\r
+        bool m_pinned;\r
 #ifdef HAVE_GOOD_STL\r
         xstring m_uri;\r
         xstring m_prefix;\r