Initial unit test plus fixes
[shibboleth/cpp-xmltooling.git] / xmltooling / QName.h
index 3d9e7f8..779ce70 100644 (file)
@@ -58,6 +58,24 @@ namespace xmltooling {
         \r
 #ifdef HAVE_GOOD_STL\r
         /**\r
+         * Indicates whether the QName has a prefix.\r
+         * @return  true iff the prefix is non-empty\r
+         */\r
+        bool hasPrefix() const { return !m_prefix.empty(); }\r
+\r
+        /**\r
+         * Indicates whether the QName has a non-empty namespace.\r
+         * @return  true iff the namespace is non-empty\r
+         */\r
+        bool hasNamespaceURI() const { return !m_uri.empty(); }\r
+\r
+        /**\r
+         * Indicates whether the QName has a non-empty local name.\r
+         * @return  true iff the local name is non-empty\r
+         */\r
+        bool hasLocalPart() const { return !m_local.empty(); }\r
+\r
+        /**\r
          * Returns the namespace prefix\r
          * @return  Null-terminated Unicode string containing the prefix, without the colon\r
          */\r
@@ -76,6 +94,24 @@ namespace xmltooling {
         const XMLCh* getLocalPart() const { return m_local.c_str(); }\r
 #else\r
         /**\r
+         * Indicates whether the QName has a prefix.\r
+         * @return  true iff the prefix is non-empty\r
+         */\r
+        bool hasPrefix() const { return m_prefix && *m_prefix; }\r
+\r
+        /**\r
+         * Indicates whether the QName has a non-empty namespace.\r
+         * @return  true iff the namespace is non-empty\r
+         */\r
+        bool hasNamespaceURI() const { return m_uri && *m_uri; }\r
+\r
+        /**\r
+         * Indicates whether the QName has a non-empty local name.\r
+         * @return  true iff the local name is non-empty\r
+         */\r
+        bool hasLocalPart() const { return m_local && *m_local; }\r
+\r
+        /**\r
          * Returns the namespace prefix\r
          * @return  Null-terminated Unicode string containing the prefix, without the colon\r
          */\r
@@ -143,14 +179,12 @@ namespace xmltooling {
      */\r
     extern XMLTOOL_API bool operator<(const QName& op1, const QName& op2);\r
 \r
-#ifndef HAVE_GOOD_STL\r
     /**\r
-     * Returns true iff op1's components are equal to op2's components.\r
+     * Returns true iff op1's components are equal to op2's components, excluding prefix.\r
      * @param op1   First qname to compare\r
      * @param op2   Second qname to compare\r
      */\r
     extern XMLTOOL_API bool operator==(const QName& op1, const QName& op2);\r
-#endif\r
 \r
 };\r
 \r