X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fbase.h;h=0626e81aadd98bb8a90b6e897af815c110ef810e;hb=81b488b2790e7bdeb2f43560b1d4a7d22c3dfdf5;hp=b6d3ba3d4eb4579706b50f51d3c56e7abbee32bb;hpb=f6221acce6ee490b9189dd2f5efabda3b9e64fb1;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/base.h b/xmltooling/base.h index b6d3ba3..0626e81 100644 --- a/xmltooling/base.h +++ b/xmltooling/base.h @@ -1,29 +1,38 @@ -/* - * Copyright 2001-2007 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 +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + * + * UCAID licenses this file to you 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 + * 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. + * 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 xmltooling/base.h - * - * Base header file definitions - * Must be included prior to including any other header + * + * Base header file definitions. + * Must be included prior to including any other header. */ #ifndef __xmltooling_base_h__ #define __xmltooling_base_h__ +#include + +/* Required for sprintf, used by integer XML attribute macros. */ +#include + #if defined (_MSC_VER) || defined(__BORLANDC__) #include #else @@ -34,6 +43,19 @@ # define XMLTOOLING_NO_XMLSEC 1 #endif +#ifndef HAVE_NULLPTR +# define nullptr 0 +#endif + +#if defined(XMLTOOLING_NO_XMLSEC) || !defined(HAVE_XSECSIZE_T) +# ifdef XMLTOOLING_XERCESC_64BITSAFE +# include + typedef XMLSize_t xsecsize_t; +# else + typedef unsigned int xsecsize_t; +# endif +#endif + // Windows and GCC4 Symbol Visibility Macros #ifdef WIN32 #define XMLTOOL_IMPORT __declspec(dllimport) @@ -206,7 +228,7 @@ * Begins the declaration of an XMLObject specialization for an abstract element/type. * Basic boilerplate includes a protected constructor, empty virtual destructor, * and Unicode constants for the default associated element's name and prefix. - * + * * @param linkage linkage specifier for the class * @param cname the name of the class to declare * @param base the base class to derive from using public virtual inheritance @@ -227,7 +249,7 @@ * Begins the declaration of an XMLObject specialization. * Basic boilerplate includes a protected constructor, empty virtual destructor, * and Unicode constants for the default associated element's name and prefix. - * + * * @param linkage linkage specifier for the class * @param cname the name of the class to declare * @param base the base class to derive from using public virtual inheritance @@ -249,7 +271,7 @@ * Begins the declaration of an XMLObject specialization with two base classes. * Basic boilerplate includes a protected constructor, empty virtual destructor, * and Unicode constants for the default associated element's name and prefix. - * + * * @param linkage linkage specifier for the class * @param cname the name of the class to declare * @param base the first base class to derive from using public virtual inheritance @@ -272,7 +294,7 @@ * Begins the declaration of an XMLObject specialization with three base classes. * Basic boilerplate includes a protected constructor, empty virtual destructor, * and Unicode constants for the default associated element's name and prefix. - * + * * @param linkage linkage specifier for the class * @param cname the name of the class to declare * @param base the first base class to derive from using public virtual inheritance @@ -296,7 +318,7 @@ * Begins the declaration of an XMLObject specialization with four base classes. * Basic boilerplate includes a protected constructor, empty virtual destructor, * and Unicode constants for the default associated element's name and prefix. - * + * * @param linkage linkage specifier for the class * @param cname the name of the class to declare * @param base the first base class to derive from using public virtual inheritance @@ -321,7 +343,7 @@ * Begins the declaration of an XMLObject specialization with five base classes. * Basic boilerplate includes a protected constructor, empty virtual destructor, * and Unicode constants for the default associated element's name and prefix. - * + * * @param linkage linkage specifier for the class * @param cname the name of the class to declare * @param base the first base class to derive from using public virtual inheritance @@ -366,7 +388,7 @@ /** * 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 @@ -376,7 +398,7 @@ /** * 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 @@ -387,7 +409,7 @@ /** * Declares abstract set method for a typed XML attribute. * The get method is omitted. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute * @param type the attribute's data type @@ -401,7 +423,7 @@ /** * Declares abstract get/set methods for a typed XML attribute. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute * @param type the attribute's data type @@ -418,7 +440,7 @@ /** * Declares abstract set method for a string XML attribute. * The get method is omitted. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute */ @@ -427,7 +449,7 @@ /** * Declares abstract get/set methods for a string XML attribute. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute */ @@ -437,7 +459,7 @@ /** * Declares abstract set method for a DateTime XML attribute. * The get method is omitted. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute */ @@ -450,7 +472,7 @@ /** * Declares abstract get/set methods for a DateTime XML attribute. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute */ @@ -466,7 +488,7 @@ /** * Declares abstract set method for an integer XML attribute. * The get method is omitted. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute */ @@ -481,7 +503,7 @@ /** * Declares abstract get/set methods for an integer XML attribute. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute */ @@ -498,7 +520,7 @@ /** * Declares abstract get/set methods for a boolean XML attribute. - * + * * @param proper the proper name of the attribute * @param upcased the upcased name of the attribute * @param def the default/presumed value, if no explicit value has been set @@ -554,7 +576,7 @@ /** * Implements get/set methods and a private member for a typed XML attribute. - * + * * @param proper the proper name of the attribute * @param type the attribute's data type */ @@ -571,7 +593,7 @@ /** * Implements get/set methods and a private member for a string XML attribute. - * + * * @param proper the proper name of the attribute */ #define IMPL_STRING_ATTRIB(proper) \ @@ -580,7 +602,7 @@ /** * Implements get/set methods and a private member for a string XML attribute, * plus a getXMLID override. - * + * * @param proper the proper name of the attribute */ #define IMPL_ID_ATTRIB(proper) \ @@ -590,12 +612,50 @@ } /** + * Implements get/set methods and a private member for a string XML attribute, + * plus a getXMLID override and attribute node clearance when DOM is dropped. + * + * @param proper the proper name of the attribute + * @param ucase the upcased name of the attribute + * @param namespaceURI the XML namespace of the attribute + */ +#define IMPL_ID_ATTRIB_EX(proper, ucase, namespaceURI) \ + IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \ + const XMLCh* getXMLID() const { \ + return m_##proper; \ + } \ + void releaseDOM() const { \ + if (getDOM()) \ + getDOM()->removeAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \ + AbstractDOMCachingXMLObject::releaseDOM(); \ + } + +/** * Implements get/set methods and a private member for a DateTime XML attribute. - * + * * @param proper the proper name of the attribute * @param fallback epoch to return when attribute is NULL */ #define IMPL_DATETIME_ATTRIB(proper,fallback) \ + IMPL_DATETIME_ATTRIB_EX(proper,fallback,false) + +/** + * Implements get/set methods and a private member for a duration-valued DateTime XML attribute. + * + * @param proper the proper name of the attribute + * @param fallback epoch to return when attribute is NULL + */ +#define IMPL_DURATION_ATTRIB(proper,fallback) \ + IMPL_DATETIME_ATTRIB_EX(proper,fallback,true) + +/** + * Implements get/set methods and a private member for a DateTime XML attribute. + * + * @param proper the proper name of the attribute + * @param fallback epoch to return when attribute is NULL + * @param duration true iff the attribute should be handled as a duration + */ +#define IMPL_DATETIME_ATTRIB_EX(proper,fallback,duration) \ protected: \ DateTime* m_##proper; \ time_t m_##proper##Epoch; \ @@ -609,21 +669,21 @@ void set##proper(const DateTime* proper) { \ m_##proper = prepareForAssignment(m_##proper,proper); \ if (m_##proper) \ - m_##proper##Epoch=m_##proper->getEpoch(); \ + m_##proper##Epoch=m_##proper->getEpoch(duration); \ } \ void set##proper(time_t proper) { \ - m_##proper = prepareForAssignment(m_##proper,proper); \ + m_##proper = prepareForAssignment(m_##proper,proper,duration); \ m_##proper##Epoch = proper; \ } \ void set##proper(const XMLCh* proper) { \ - m_##proper = prepareForAssignment(m_##proper,proper); \ + m_##proper = prepareForAssignment(m_##proper,proper,duration); \ if (m_##proper) \ - m_##proper##Epoch=m_##proper->getEpoch(); \ + m_##proper##Epoch=m_##proper->getEpoch(duration); \ } /** * Implements get/set methods and a private member for an integer XML attribute. - * + * * @param proper the proper name of the attribute */ #define IMPL_INTEGER_ATTRIB(proper) \ @@ -631,7 +691,7 @@ XMLCh* m_##proper; \ public: \ pair get##proper() const { \ - return make_pair((m_##proper!=NULL),(m_##proper!=NULL ? xercesc::XMLString::parseInt(m_##proper): 0)); \ + return make_pair((m_##proper!=nullptr),(m_##proper!=nullptr ? xercesc::XMLString::parseInt(m_##proper): 0)); \ } \ void set##proper(const XMLCh* proper) { \ m_##proper = prepareForAssignment(m_##proper,proper); \ @@ -645,7 +705,7 @@ /** * Implements get/set methods and a private member for a boolean XML attribute. - * + * * @param proper the proper name of the attribute */ #define IMPL_BOOLEAN_ATTRIB(proper) \ @@ -663,9 +723,29 @@ } /** + * Implements get/set methods and a private member for a typed, qualified XML attribute. + * + * @param proper the proper name of the attribute + * @param type the attribute's data type + */ +#define IMPL_XMLOBJECT_FOREIGN_ATTRIB(proper,type) \ + protected: \ + XMLCh* m_##proper##Prefix; \ + type* m_##proper; \ + public: \ + const type* get##proper() const { \ + return m_##proper; \ + } \ + void set##proper(const type* proper) { \ + m_##proper = prepareForAssignment(m_##proper,proper); \ + XMLString::release(&m_##proper##Prefix); \ + m_##proper##Prefix = nullptr; \ + } + +/** * Declares abstract set method for a typed XML child object in a foreign namespace. * The get method is omitted. - * + * * @param proper the proper name of the child type * @param ns the C++ namespace for the type */ @@ -676,7 +756,7 @@ /** * Declares abstract get/set methods for a typed XML child object in a foreign namespace. - * + * * @param proper the proper name of the child type * @param ns the C++ namespace for the type */ @@ -690,7 +770,7 @@ /** * Declares abstract set method for a typed XML child object. * The get method is omitted. - * + * * @param proper the proper name of the child type */ #define DECL_INHERITED_TYPED_CHILD(proper) \ @@ -700,7 +780,7 @@ /** * Declares abstract get/set methods for a typed XML child object. - * + * * @param proper the proper name of the child type */ #define DECL_TYPED_CHILD(proper) \ @@ -712,7 +792,7 @@ /** * Declares abstract get/set methods for a generic XML child object. - * + * * @param proper the proper name of the child */ #define DECL_XMLOBJECT_CHILD(proper) \ @@ -725,7 +805,7 @@ /** * Implements get/set methods and a private list iterator member for a typed XML child object. - * + * * @param proper the proper name of the child type */ #define IMPL_TYPED_CHILD(proper) \ @@ -744,7 +824,7 @@ /** * Implements get/set methods and a private list iterator member for * a typed XML child object in a foreign namespace - * + * * @param proper the proper name of the child type * @param ns the C++ namespace for the type */ @@ -763,7 +843,7 @@ /** * Implements get/set methods and a private list iterator member for a generic XML child object. - * + * * @param proper the proper name of the child */ #define IMPL_XMLOBJECT_CHILD(proper) \ @@ -781,7 +861,7 @@ /** * Declares abstract get/set methods for a typed XML child collection. - * + * * @param proper the proper name of the child type */ #define DECL_TYPED_CHILDREN(proper) \ @@ -793,7 +873,7 @@ /** * Declares abstract get/set methods for a typed XML child collection in a foreign namespace. - * + * * @param proper the proper name of the child type * @param ns the C++ namespace for the type */ @@ -806,7 +886,7 @@ /** * Declares abstract get/set methods for a generic XML child collection. - * + * * @param proper the proper name of the child */ #define DECL_XMLOBJECT_CHILDREN(proper) \ @@ -818,7 +898,7 @@ /** * Implements get method and a private vector member for a typed XML child collection. - * + * * @param proper the proper name of the child type * @param fence insertion fence for new objects of the child collection in backing list */ @@ -831,12 +911,12 @@ } \ const std::vector& get##proper##s() const { \ return m_##proper##s; \ - } + } /** * Implements get method and a private vector member for a typed XML child collection * in a foreign namespace. - * + * * @param proper the proper name of the child type * @param ns the C++ namespace for the type * @param fence insertion fence for new objects of the child collection in backing list @@ -850,11 +930,11 @@ } \ const std::vector& get##proper##s() const { \ return m_##proper##s; \ - } + } /** * Implements get method and a private vector member for a generic XML child collection. - * + * * @param proper the proper name of the child * @param fence insertion fence for new objects of the child collection in backing list */ @@ -867,11 +947,11 @@ } \ const std::vector& get##proper##s() const { \ return m_##proper##s; \ - } + } /** * Implements marshalling for a string attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -883,7 +963,7 @@ /** * Implements marshalling for a DateTime attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -895,7 +975,7 @@ /** * Implements marshalling for an integer attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -907,7 +987,7 @@ /** * Implements marshalling for a boolean attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -932,7 +1012,7 @@ /** * Implements marshalling for a QName attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -943,22 +1023,37 @@ domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \ } +#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE /** * Implements marshalling for an ID attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute */ -#define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \ +# define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \ + if (m_##proper && *m_##proper) { \ + domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \ + domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, true); \ + } +#else +/** + * Implements marshalling for an ID attribute + * + * @param proper the proper name of the attribute + * @param ucase the upcased name of the attribute + * @param namespaceURI the XML namespace of the attribute + */ +# define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \ if (m_##proper && *m_##proper) { \ domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \ domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \ } +#endif /** * Implements unmarshalling process branch for a string attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -969,23 +1064,39 @@ return; \ } +#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE +/** + * Implements unmarshalling process branch for an ID attribute + * + * @param proper the proper name of the attribute + * @param ucase the upcased name of the attribute + * @param namespaceURI the XML namespace of the attribute + */ +# define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \ + if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \ + set##proper(attribute->getValue()); \ + attribute->getOwnerElement()->setIdAttributeNode(attribute, true); \ + return; \ + } +#else /** * Implements unmarshalling process branch for an ID attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute */ -#define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \ +# define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \ if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \ set##proper(attribute->getValue()); \ attribute->getOwnerElement()->setIdAttributeNode(attribute); \ return; \ } +#endif /** * Implements unmarshalling process branch for a DateTime attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -995,7 +1106,7 @@ /** * Implements unmarshalling process branch for a DateTime attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -1008,7 +1119,7 @@ /** * Implements unmarshalling process branch for an integer attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -1018,7 +1129,7 @@ /** * Implements unmarshalling process branch for a boolean attribute - * + * * @param proper the proper name of the attribute * @param ucase the upcased name of the attribute * @param namespaceURI the XML namespace of the attribute @@ -1028,7 +1139,7 @@ /** * Implements unmarshalling process branch for typed child collection element - * + * * @param proper the proper name of the child type * @param namespaceURI the XML namespace of the child element * @param force bypass use of hint and just cast down to check child @@ -1045,7 +1156,7 @@ /** * Implements unmarshalling process branch for typed child collection element * in a foreign namespace. - * + * * @param proper the proper name of the child type * @param ns the C++ namespace for the type * @param namespaceURI the XML namespace of the child element @@ -1062,7 +1173,7 @@ /** * Implements unmarshalling process branch for typed child singleton element - * + * * @param proper the proper name of the child type * @param namespaceURI the XML namespace of the child element * @param force bypass use of hint and just cast down to check child @@ -1080,7 +1191,7 @@ /** * Implements unmarshalling process branch for typed child singleton element * in a foreign namespace. - * + * * @param proper the proper name of the child type * @param ns the C++ namespace for the type * @param namespaceURI the XML namespace of the child element @@ -1098,7 +1209,7 @@ /** * Implements unmarshalling process branch for a generic child singleton element - * + * * @param proper the proper name of the child type * @param namespaceURI the XML namespace of the child element */ @@ -1113,7 +1224,7 @@ /** * Declares aliased get/set methods for named XML element simple content. - * + * * @param proper the proper name to label the element's content */ #define DECL_SIMPLE_CONTENT(proper) \ @@ -1128,13 +1239,13 @@ /** * Declares aliased get/set methods for named integer XML element content. - * + * * @param proper the proper name to label the element's content */ #define DECL_INTEGER_CONTENT(proper) \ XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \ std::pair get##proper() const { \ - return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \ + return std::make_pair((getTextContent()!=nullptr), (getTextContent()!=nullptr ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \ } \ XMLTOOLING_DOXYGEN(Sets proper.) \ void set##proper(int proper) { \ @@ -1150,7 +1261,7 @@ /** * Implements cloning methods for an XMLObject specialization implementation class. - * + * * @param cname the name of the XMLObject specialization */ #define IMPL_XMLOBJECT_CLONE(cname) \ @@ -1170,7 +1281,7 @@ /** * Declares an XMLObject specialization with a simple content model and type, * handling it as string data. - * + * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization * @param proper the proper name to label the element's content @@ -1184,7 +1295,7 @@ /** * Declares and defines an implementation class for an XMLObject with * a simple content model and type, handling it as string data. - * + * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization */ @@ -1198,7 +1309,7 @@ { \ public: \ virtual ~cname##Impl() {} \ - cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \ + cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) \ : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \ } \ cname##Impl(const cname##Impl& src) \ @@ -1214,7 +1325,7 @@ * Begins the declaration of an XMLObjectBuilder specialization. * Basic boilerplate includes an empty virtual destructor, and * a default builder that defaults the element name. - * + * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization * @param namespaceURI the XML namespace of the default associated element @@ -1231,7 +1342,7 @@ } \ XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \ virtual cname* buildObject( \ - const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \ + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \ ) const /** @@ -1241,7 +1352,7 @@ /** * Declares a generic XMLObjectBuilder specialization. - * + * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization * @param namespaceURI the XML namespace of the default associated element @@ -1261,13 +1372,13 @@ END_XMLOBJECTBUILDER /** - * Implements the standard XMLObjectBuilder specialization function. - * + * Implements the standard XMLObjectBuilder specialization function. + * * @param cname the name of the XMLObject specialization */ #define IMPL_XMLOBJECTBUILDER(cname) \ cname* cname##Builder::buildObject( \ - const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \ + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \ ) const \ { \ return new cname##Impl(nsURI,localName,prefix,schemaType); \ @@ -1279,7 +1390,7 @@ * Begins the declaration of an XMLObjectBuilder specialization. * Basic boilerplate includes an empty virtual destructor, and * a default builder that defaults the element name. - * + * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization * @param namespaceURI the XML namespace of the default associated element @@ -1296,7 +1407,7 @@ } \ XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \ virtual xmltooling::XMLObject* buildObject( \ - const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \ + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \ ) const /** @@ -1306,7 +1417,7 @@ /** * Declares a generic XMLObjectBuilder specialization. - * + * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization * @param namespaceURI the XML namespace of the default associated element @@ -1326,13 +1437,13 @@ END_XMLOBJECTBUILDER /** - * Implements the standard XMLObjectBuilder specialization function. - * + * Implements the standard XMLObjectBuilder specialization function. + * * @param cname the name of the XMLObject specialization */ #define IMPL_XMLOBJECTBUILDER(cname) \ xmltooling::XMLObject* cname##Builder::buildObject( \ - const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \ + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \ ) const \ { \ return new cname##Impl(nsURI,localName,prefix,schemaType); \ @@ -1342,7 +1453,7 @@ /** * Begins the declaration of a Schema Validator specialization. - * + * * @param linkage linkage specifier for the class * @param cname the base name of the Validator specialization */ @@ -1360,7 +1471,7 @@ /** * Begins the declaration of a Schema Validator specialization subclass. - * + * * @param linkage linkage specifier for the class * @param cname the base name of the Validator specialization * @param base base class for the validator @@ -1382,7 +1493,7 @@ /** * Validator code that checks the object type. - * + * * @param cname the name of the XMLObject specialization */ #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \ @@ -1392,9 +1503,9 @@ /** * Validator code that checks for a required attribute, content, or singleton. - * + * * @param cname the name of the XMLObject specialization - * @param proper the proper name of the attribute, content, or singleton member + * @param proper the proper name of the attribute, content, or singleton member */ #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \ if (!ptr->get##proper()) \ @@ -1402,9 +1513,9 @@ /** * Validator code that checks for a required integer attribute - * + * * @param cname the name of the XMLObject specialization - * @param proper the proper name of the attribute, content, or singleton member + * @param proper the proper name of the attribute, content, or singleton member */ #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \ if (!ptr->get##proper().first) \ @@ -1413,10 +1524,10 @@ /** * Validator code that checks for one of a pair of * required attributes, content, or singletons. - * + * * @param cname the name of the XMLObject specialization - * @param proper1 the proper name of the first attribute, content, or singleton member - * @param proper2 the proper name of the second attribute, content, or singleton member + * @param proper1 the proper name of the first attribute, content, or singleton member + * @param proper2 the proper name of the second attribute, content, or singleton member */ #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \ if (!ptr->get##proper1() && !ptr->get##proper2()) \ @@ -1425,10 +1536,10 @@ /** * Validator code that checks for one of a pair of * required attributes, content, or singletons, but disallows both. - * + * * @param cname the name of the XMLObject specialization - * @param proper1 the proper name of the first attribute, content, or singleton member - * @param proper2 the proper name of the second attribute, content, or singleton member + * @param proper1 the proper name of the first attribute, content, or singleton member + * @param proper2 the proper name of the second attribute, content, or singleton member */ #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \ if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \ @@ -1437,7 +1548,7 @@ /** * Validator code that checks for one of a set of three * required attributes, content, or singletons. - * + * * @param cname the name of the XMLObject specialization * @param proper1 the proper name of the first attribute, content, or singleton member * @param proper2 the proper name of the second attribute, content, or singleton member @@ -1450,7 +1561,7 @@ /** * Validator code that checks for one of a set of three * required attributes, content, or singletons but disallows more than one. - * + * * @param cname the name of the XMLObject specialization * @param proper1 the proper name of the first attribute, content, or singleton member * @param proper2 the proper name of the second attribute, content, or singleton member @@ -1458,11 +1569,11 @@ */ #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \ int c##proper1##proper2##proper3=0; \ - if (ptr->get##proper1()!=NULL) \ + if (ptr->get##proper1()!=nullptr) \ c##proper1##proper2##proper3++; \ - if (ptr->get##proper2()!=NULL) \ + if (ptr->get##proper2()!=nullptr) \ c##proper1##proper2##proper3++; \ - if (ptr->get##proper3()!=NULL) \ + if (ptr->get##proper3()!=nullptr) \ c##proper1##proper2##proper3++; \ if (c##proper1##proper2##proper3 != 1) \ throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".") @@ -1470,10 +1581,10 @@ /** * Validator code that checks a co-constraint (if one present, the other must be) * between a pair of attributes, content, or singletons. - * + * * @param cname the name of the XMLObject specialization - * @param proper1 the proper name of the first attribute, content, or singleton member - * @param proper2 the proper name of the second attribute, content, or singleton member + * @param proper1 the proper name of the first attribute, content, or singleton member + * @param proper2 the proper name of the second attribute, content, or singleton member */ #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \ if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \ @@ -1481,9 +1592,9 @@ /** * Validator code that checks for a non-empty collection. - * + * * @param cname the name of the XMLObject specialization - * @param proper the proper name of the collection item + * @param proper the proper name of the collection item */ #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \ if (ptr->get##proper##s().empty()) \ @@ -1492,7 +1603,7 @@ /** * Declares/defines a Validator specialization that checks object type and * a non-empty simple content model. - * + * * @param linkage linkage specifier for the class * @param cname the name of the XMLObject specialization */ @@ -1513,7 +1624,7 @@ namespace xmltooling { * Template function for cloning a sequence of XMLObjects. * Invokes the clone() member on each element of the input sequence and adds the copy to * the output sequence. Order is preserved. - * + * * @param in input sequence to clone * @param out output sequence to copy cloned pointers into */ @@ -1533,14 +1644,14 @@ namespace xmltooling { { /** * Function operator to delete an object. - * + * * @param ptr object to delete */ void operator()(T* ptr) {delete ptr;} - + /** * Function operator to delete an object stored as const. - * + * * @param ptr object to delete after casting away const */ void operator()(const T* ptr) {delete const_cast(ptr);} @@ -1553,7 +1664,7 @@ namespace xmltooling { { /** * Function operator to delete an object. - * + * * @param p a pair in which the second component is the object to delete */ void operator()(const std::pair& p) {delete p.second;} @@ -1566,7 +1677,7 @@ namespace xmltooling { { /** * Function operator to delete an object stored as const - * + * * @param p a pair in which the second component is the const object to delete */ void operator()(const std::pair& p) {delete const_cast(p.second);}