Rework iterator template again for Sun's broken STL.
[shibboleth/xmltooling.git] / xmltooling / base.h
index cb13d98..31e9edf 100644 (file)
   #include <xmltooling/config_pub.h>
 #endif
 
+#ifdef XMLTOOLING_LITE
+# define XMLTOOLING_NO_XMLSEC 1
+#endif
+
 // Windows and GCC4 Symbol Visibility Macros
 #ifdef WIN32
   #define XMLTOOL_IMPORT __declspec(dllimport)
 #define END_XMLOBJECT }
 
 /**
+ * Declares a static variable holding the XMLObject's element QName.
+ */
+#define DECL_ELEMENT_QNAME \
+    public: \
+        XMLTOOLING_DOXYGEN(Element QName) \
+        static xmltooling::QName ELEMENT_QNAME
+
+/**
+ * Declares a static variable holding the XMLObject's schema type QName.
+ */
+#define DECL_TYPE_QNAME \
+    public: \
+        XMLTOOLING_DOXYGEN(Type QName) \
+        static xmltooling::QName TYPE_QNAME
+
+/**
+ * Implements a static variable holding an XMLObject's element QName.
+ * 
+ * @param cname             the name of the XMLObject specialization
+ * @param namespaceURI      the XML namespace of the default associated element
+ * @param namespacePrefix   the XML namespace prefix of the default associated element
+ */
+#define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \
+    xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)
+
+/**
+ * Implements a static variable holding an XMLObject's schema type QName.
+ * 
+ * @param cname             the name of the XMLObject specialization
+ * @param namespaceURI      the XML namespace of the default associated element
+ * @param namespacePrefix   the XML namespace prefix of the default associated element
+ */
+#define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \
+    xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)
+
+/**
  * Declares abstract set method for a typed XML attribute.
  * The get method is omitted.
  * 
  * @param namespaceURI  the XML namespace of the attribute
  */
 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
-    if (m_##proper) { \
+    if (m_##proper && *m_##proper) { \
         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
     }
 
  * @param namespaceURI  the XML namespace of the attribute
  */
 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
-    if (m_##proper) { \
+    if (m_##proper && *m_##proper) { \
         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
     }
 
  * @param namespaceURI  the XML namespace of the attribute
  */
 #define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
-    if (m_##proper) { \
+    if (m_##proper && *m_##proper) { \
         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
         domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
     }
 #define DECL_INTEGER_CONTENT(proper) \
     XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
     std::pair<bool,int> get##proper() const { \
-        return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : NULL)); \
+        return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \
     } \
     XMLTOOLING_DOXYGEN(Sets proper.) \
     void set##proper(int proper) { \