Initial unit test plus fixes
[shibboleth/cpp-xmltooling.git] / xmltooling / Namespace.h
index 984df21..3e9bfc8 100644 (file)
@@ -35,10 +35,11 @@ namespace xmltooling {
     public:\r
         /**\r
          * Constructor\r
-         * @param uri       namespace URI\r
-         * @param prefix    namespace prefix (without the colon)\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(const XMLCh* uri=NULL, const XMLCh* prefix=NULL);\r
+        Namespace(const XMLCh* uri=NULL, const XMLCh* prefix=NULL, bool alwaysDeclare=false);\r
         \r
         ~Namespace();\r
 #ifndef HAVE_GOOD_STL\r
@@ -80,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
@@ -90,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