Set fourth file version digit to signify rebuild.
[shibboleth/cpp-xmltooling.git] / xmltooling / base.h
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20
21 /**
22  * @file xmltooling/base.h
23  *
24  * Base header file definitions.
25  * Must be included prior to including any other header.
26  */
27
28 #ifndef __xmltooling_base_h__
29 #define __xmltooling_base_h__
30
31 #include <typeinfo>
32
33 /* Required for sprintf, used by integer XML attribute macros. */
34 #include <cstdio>
35
36 #if defined (_MSC_VER) || defined(__BORLANDC__)
37   #include <xmltooling/config_pub_win32.h>
38 #else
39   #include <xmltooling/config_pub.h>
40 #endif
41
42 #ifdef XMLTOOLING_LITE
43 # define XMLTOOLING_NO_XMLSEC 1
44 #endif
45
46 #ifndef HAVE_NULLPTR
47 # define nullptr 0
48 #endif
49
50 #if defined(XMLTOOLING_NO_XMLSEC) || !defined(HAVE_XSECSIZE_T)
51 # ifdef XMLTOOLING_XERCESC_64BITSAFE
52 #   include <xercesc/util/XercesDefs.hpp>
53     typedef XMLSize_t xsecsize_t;
54 # else
55     typedef unsigned int xsecsize_t;
56 # endif
57 #endif
58
59 // Windows and GCC4 Symbol Visibility Macros
60 #ifdef WIN32
61   #define XMLTOOL_IMPORT __declspec(dllimport)
62   #define XMLTOOL_EXPORT __declspec(dllexport)
63   #define XMLTOOL_DLLLOCAL
64   #define XMLTOOL_DLLPUBLIC
65 #else
66   #define XMLTOOL_IMPORT
67   #ifdef GCC_HASCLASSVISIBILITY
68     #define XMLTOOL_EXPORT __attribute__ ((visibility("default")))
69     #define XMLTOOL_DLLLOCAL __attribute__ ((visibility("hidden")))
70     #define XMLTOOL_DLLPUBLIC __attribute__ ((visibility("default")))
71   #else
72     #define XMLTOOL_EXPORT
73     #define XMLTOOL_DLLLOCAL
74     #define XMLTOOL_DLLPUBLIC
75   #endif
76 #endif
77
78 // Define XMLTOOL_API for DLL builds
79 #ifdef XMLTOOLING_EXPORTS
80   #define XMLTOOL_API XMLTOOL_EXPORT
81 #else
82   #define XMLTOOL_API XMLTOOL_IMPORT
83 #endif
84
85 // Throwable classes must always be visible on GCC in all binaries
86 #ifdef WIN32
87   #define XMLTOOL_EXCEPTIONAPI(api) api
88 #elif defined(GCC_HASCLASSVISIBILITY)
89   #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT
90 #else
91   #define XMLTOOL_EXCEPTIONAPI(api)
92 #endif
93
94 #ifdef _MSC_VER
95     #define XMLTOOLING_DOXYGEN(desc) /##** desc */
96 #else
97     #define XMLTOOLING_DOXYGEN(desc)
98 #endif
99
100 /**
101  * Blocks copy c'tor and assignment operator for a class.
102  */
103 #define MAKE_NONCOPYABLE(type) \
104     private: \
105         type(const type&); \
106         type& operator=(const type&)
107
108 #ifndef DOXYGEN_SKIP
109 #ifndef NULL
110 #define NULL    0
111 #endif
112 #define UNICODE_LITERAL_1(a) {xercesc::chLatin_##a, xercesc::chNull}
113 #define UNICODE_LITERAL_2(a,b) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chNull}
114 #define UNICODE_LITERAL_3(a,b,c) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chNull}
115 #define UNICODE_LITERAL_4(a,b,c,d) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chNull}
116 #define UNICODE_LITERAL_5(a,b,c,d,e) \
117     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chNull}
118 #define UNICODE_LITERAL_6(a,b,c,d,e,f) \
119     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chNull}
120 #define UNICODE_LITERAL_7(a,b,c,d,e,f,g) \
121     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chNull}
122 #define UNICODE_LITERAL_8(a,b,c,d,e,f,g,h) \
123     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chNull}
124 #define UNICODE_LITERAL_9(a,b,c,d,e,f,g,h,i) \
125     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, xercesc::chNull}
126 #define UNICODE_LITERAL_10(a,b,c,d,e,f,g,h,i,j) \
127     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
128         xercesc::chLatin_##j, xercesc::chNull}
129 #define UNICODE_LITERAL_11(a,b,c,d,e,f,g,h,i,j,k) \
130     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
131         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chNull}
132 #define UNICODE_LITERAL_12(a,b,c,d,e,f,g,h,i,j,k,l) \
133     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
134         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chNull}
135 #define UNICODE_LITERAL_13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
136     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
137         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chNull}
138 #define UNICODE_LITERAL_14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
139     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
140         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chNull}
141 #define UNICODE_LITERAL_15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
142     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
143         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chNull}
144 #define UNICODE_LITERAL_16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
145     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
146         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chNull}
147 #define UNICODE_LITERAL_17(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) \
148     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
149         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chNull}
150 #define UNICODE_LITERAL_18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) \
151     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
152         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, xercesc::chNull}
153 #define UNICODE_LITERAL_19(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) \
154     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
155         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
156         xercesc::chLatin_##s, xercesc::chNull}
157 #define UNICODE_LITERAL_20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) \
158     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
159         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
160         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chNull}
161 #define UNICODE_LITERAL_21(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) \
162     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
163         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
164         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chNull}
165 #define UNICODE_LITERAL_22(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) \
166     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
167         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
168         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chNull}
169 #define UNICODE_LITERAL_23(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) \
170     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
171         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
172         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chNull}
173 #define UNICODE_LITERAL_24(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) \
174     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
175         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
176         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chNull}
177 #define UNICODE_LITERAL_25(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) \
178     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
179         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
180         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chNull}
181 #define UNICODE_LITERAL_26(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) \
182     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
183         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
184         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, xercesc::chNull}
185 #define UNICODE_LITERAL_27(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa) \
186     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
187         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
188         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
189         xercesc::chLatin_##aa, xercesc::chNull}
190 #define UNICODE_LITERAL_28(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb) \
191     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
192         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
193         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
194         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chNull}
195 #define UNICODE_LITERAL_29(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc) \
196     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
197         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
198         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
199         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chNull}
200 #define UNICODE_LITERAL_30(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd) \
201     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
202         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
203         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
204         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chNull}
205 #define UNICODE_LITERAL_31(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee) \
206     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
207         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
208         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
209         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chNull}
210 #define UNICODE_LITERAL_32(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff) \
211     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
212         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
213         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
214         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chNull}
215 #define UNICODE_LITERAL_33(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg) \
216     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
217         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
218         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
219         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chNull}
220 #define UNICODE_LITERAL_34(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh) \
221     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
222         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
223         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
224         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, xercesc::chNull}
225 #define UNICODE_LITERAL_35(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii) \
226     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
227         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
228         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
229         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
230         xercesc::chLatin_##ii, xercesc::chNull}
231 #define UNICODE_LITERAL_36(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj) \
232     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
233         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
234         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
235         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
236         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chNull}
237 #define UNICODE_LITERAL_37(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk) \
238     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
239         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
240         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
241         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
242         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chNull}
243 #define UNICODE_LITERAL_38(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll) \
244     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
245         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
246         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
247         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
248         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chNull}
249 #define UNICODE_LITERAL_39(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm) \
250     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
251         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
252         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
253         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
254         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chNull}
255 #define UNICODE_LITERAL_40(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn) \
256     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
257         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
258         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
259         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
260         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chNull}
261 #define UNICODE_LITERAL_41(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo) \
262     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
263         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
264         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
265         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
266         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chNull}
267 #define UNICODE_LITERAL_42(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp) \
268     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
269         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
270         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
271         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
272         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, xercesc::chNull}
273 #define UNICODE_LITERAL_43(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq) \
274     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
275         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
276         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
277         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
278         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
279         xercesc::chLatin_##qq, xercesc::chNull}
280 #define UNICODE_LITERAL_44(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr) \
281     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
282         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
283         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
284         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
285         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
286         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chNull}
287 #define UNICODE_LITERAL_45(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss) \
288     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
289         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
290         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
291         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
292         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
293         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chNull}
294 #define UNICODE_LITERAL_46(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt) \
295     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
296         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
297         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
298         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
299         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
300         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chNull}
301 #define UNICODE_LITERAL_47(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu) \
302     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
303         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
304         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
305         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
306         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
307         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chNull}
308 #define UNICODE_LITERAL_48(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv) \
309     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
310         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
311         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
312         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
313         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
314         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chNull}
315 #define UNICODE_LITERAL_49(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww) \
316     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
317         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
318         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
319         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
320         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
321         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chNull}
322 #define UNICODE_LITERAL_50(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx) \
323     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
324         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
325         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
326         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
327         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
328         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chLatin_##xx, xercesc::chNull}
329 #define UNICODE_LITERAL_51(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy) \
330     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
331         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
332         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
333         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
334         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
335         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chLatin_##xx, \
336         xercesc::chLatin_##yy, xercesc::chNull}
337 #define UNICODE_LITERAL_52(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz) \
338     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
339         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
340         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
341         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
342         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
343         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chLatin_##xx, \
344         xercesc::chLatin_##yy, xercesc::chLatin_##zz, xercesc::chNull}
345 #endif /* DOXYGEN_SKIP */
346
347 /**
348  * Begins the declaration of an XMLObject specialization for an abstract element/type.
349  * Basic boilerplate includes a protected constructor, empty virtual destructor,
350  * and Unicode constants for the default associated element's name and prefix.
351  *
352  * @param linkage   linkage specifier for the class
353  * @param cname     the name of the class to declare
354  * @param base      the base class to derive from using public virtual inheritance
355  * @param desc      documentation comment for class
356  */
357 #define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \
358     XMLTOOLING_DOXYGEN(desc) \
359     class linkage cname : public virtual base { \
360     protected: \
361         cname() {} \
362     public: \
363         virtual ~cname() {} \
364         XMLTOOLING_DOXYGEN(Element local name) \
365         static const XMLCh LOCAL_NAME[]; \
366     }
367
368 /**
369  * Begins the declaration of an XMLObject specialization.
370  * Basic boilerplate includes a protected constructor, empty virtual destructor,
371  * and Unicode constants for the default associated element's name and prefix.
372  *
373  * @param linkage   linkage specifier for the class
374  * @param cname     the name of the class to declare
375  * @param base      the base class to derive from using public virtual inheritance
376  * @param desc      documentation comment for class
377  */
378 #define BEGIN_XMLOBJECT(linkage,cname,base,desc) \
379     XMLTOOLING_DOXYGEN(desc) \
380     class linkage cname : public virtual base { \
381     protected: \
382         cname() {} \
383     public: \
384         virtual ~cname() {} \
385         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
386         virtual cname* clone##cname() const=0; \
387         XMLTOOLING_DOXYGEN(Element local name) \
388         static const XMLCh LOCAL_NAME[]
389
390 /**
391  * Begins the declaration of an XMLObject specialization with two base classes.
392  * Basic boilerplate includes a protected constructor, empty virtual destructor,
393  * and Unicode constants for the default associated element's name and prefix.
394  *
395  * @param linkage   linkage specifier for the class
396  * @param cname     the name of the class to declare
397  * @param base      the first base class to derive from using public virtual inheritance
398  * @param base2     the second base class to derive from using public virtual inheritance
399  * @param desc      documentation comment for class
400  */
401 #define BEGIN_XMLOBJECT2(linkage,cname,base,base2,desc) \
402     XMLTOOLING_DOXYGEN(desc) \
403     class linkage cname : public virtual base, public virtual base2 { \
404     protected: \
405         cname() {} \
406     public: \
407         virtual ~cname() {} \
408         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
409         virtual cname* clone##cname() const=0; \
410         XMLTOOLING_DOXYGEN(Element local name) \
411         static const XMLCh LOCAL_NAME[]
412
413 /**
414  * Begins the declaration of an XMLObject specialization with three base classes.
415  * Basic boilerplate includes a protected constructor, empty virtual destructor,
416  * and Unicode constants for the default associated element's name and prefix.
417  *
418  * @param linkage   linkage specifier for the class
419  * @param cname     the name of the class to declare
420  * @param base      the first base class to derive from using public virtual inheritance
421  * @param base2     the second base class to derive from using public virtual inheritance
422  * @param base3     the third base class to derive from using public virtual inheritance
423  * @param desc      documentation comment for class
424  */
425 #define BEGIN_XMLOBJECT3(linkage,cname,base,base2,base3,desc) \
426     XMLTOOLING_DOXYGEN(desc) \
427     class linkage cname : public virtual base, public virtual base2, public virtual base3 { \
428     protected: \
429         cname() {} \
430     public: \
431         virtual ~cname() {} \
432         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
433         virtual cname* clone##cname() const=0; \
434         XMLTOOLING_DOXYGEN(Element local name) \
435         static const XMLCh LOCAL_NAME[]
436
437 /**
438  * Begins the declaration of an XMLObject specialization with four base classes.
439  * Basic boilerplate includes a protected constructor, empty virtual destructor,
440  * and Unicode constants for the default associated element's name and prefix.
441  *
442  * @param linkage   linkage specifier for the class
443  * @param cname     the name of the class to declare
444  * @param base      the first base class to derive from using public virtual inheritance
445  * @param base2     the second base class to derive from using public virtual inheritance
446  * @param base3     the third base class to derive from using public virtual inheritance
447  * @param base4     the fourth base class to derive from using public virtual inheritance
448  * @param desc      documentation comment for class
449  */
450 #define BEGIN_XMLOBJECT4(linkage,cname,base,base2,base3,base4,desc) \
451     XMLTOOLING_DOXYGEN(desc) \
452     class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4 { \
453     protected: \
454         cname() {} \
455     public: \
456         virtual ~cname() {} \
457         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
458         virtual cname* clone##cname() const=0; \
459         XMLTOOLING_DOXYGEN(Element local name) \
460         static const XMLCh LOCAL_NAME[]
461
462 /**
463  * Begins the declaration of an XMLObject specialization with five base classes.
464  * Basic boilerplate includes a protected constructor, empty virtual destructor,
465  * and Unicode constants for the default associated element's name and prefix.
466  *
467  * @param linkage   linkage specifier for the class
468  * @param cname     the name of the class to declare
469  * @param base      the first base class to derive from using public virtual inheritance
470  * @param base2     the second base class to derive from using public virtual inheritance
471  * @param base3     the third base class to derive from using public virtual inheritance
472  * @param base4     the fourth base class to derive from using public virtual inheritance
473  * @param base5     the fifth base class to derive from using public virtual inheritance
474  * @param desc      documentation comment for class
475  */
476 #define BEGIN_XMLOBJECT5(linkage,cname,base,base2,base3,base4,base5,desc) \
477     XMLTOOLING_DOXYGEN(desc) \
478     class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4, public virtual base5 { \
479     protected: \
480         cname() {} \
481     public: \
482         virtual ~cname() {} \
483         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
484         virtual cname* clone##cname() const=0; \
485         XMLTOOLING_DOXYGEN(Element local name) \
486         static const XMLCh LOCAL_NAME[]
487
488 /**
489  * Ends the declaration of an XMLObject specialization.
490  */
491 #define END_XMLOBJECT }
492
493 /**
494  * Declares a static variable holding the XMLObject's element QName.
495  */
496 #define DECL_ELEMENT_QNAME \
497     public: \
498         XMLTOOLING_DOXYGEN(Element QName) \
499         static xmltooling::QName ELEMENT_QNAME
500
501 /**
502  * Declares a static variable holding the XMLObject's schema type QName.
503  */
504 #define DECL_TYPE_QNAME \
505     public: \
506         XMLTOOLING_DOXYGEN(Type QName) \
507         static xmltooling::QName TYPE_QNAME
508
509 /**
510  * Implements a static variable holding an XMLObject's element QName.
511  *
512  * @param cname             the name of the XMLObject specialization
513  * @param namespaceURI      the XML namespace of the default associated element
514  * @param namespacePrefix   the XML namespace prefix of the default associated element
515  */
516 #define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \
517     xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)
518
519 /**
520  * Implements a static variable holding an XMLObject's schema type QName.
521  *
522  * @param cname             the name of the XMLObject specialization
523  * @param namespaceURI      the XML namespace of the default associated element
524  * @param namespacePrefix   the XML namespace prefix of the default associated element
525  */
526 #define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \
527     xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)
528
529 /**
530  * Declares abstract set method for a typed XML attribute.
531  * The get method is omitted.
532  *
533  * @param proper    the proper name of the attribute
534  * @param upcased   the upcased name of the attribute
535  * @param type      the attribute's data type
536  */
537 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \
538     public: \
539         XMLTOOLING_DOXYGEN(proper attribute name) \
540         static const XMLCh upcased##_ATTRIB_NAME[]; \
541         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
542         virtual void set##proper(const type* proper)=0
543
544 /**
545  * Declares abstract get/set methods for a typed XML attribute.
546  *
547  * @param proper    the proper name of the attribute
548  * @param upcased   the upcased name of the attribute
549  * @param type      the attribute's data type
550  */
551 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \
552     public: \
553         XMLTOOLING_DOXYGEN(proper attribute name) \
554         static const XMLCh upcased##_ATTRIB_NAME[]; \
555         XMLTOOLING_DOXYGEN(Returns the proper attribute.) \
556         virtual const type* get##proper() const=0; \
557         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
558         virtual void set##proper(const type* proper)=0
559
560 /**
561  * Declares abstract set method for a string XML attribute.
562  * The get method is omitted.
563  *
564  * @param proper    the proper name of the attribute
565  * @param upcased   the upcased name of the attribute
566  */
567 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \
568     DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
569
570 /**
571  * Declares abstract get/set methods for a string XML attribute.
572  *
573  * @param proper    the proper name of the attribute
574  * @param upcased   the upcased name of the attribute
575  */
576 #define DECL_STRING_ATTRIB(proper,upcased) \
577     DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
578
579 /**
580  * Declares abstract set method for a DateTime XML attribute.
581  * The get method is omitted.
582  *
583  * @param proper    the proper name of the attribute
584  * @param upcased   the upcased name of the attribute
585  */
586 #define DECL_INHERITED_DATETIME_ATTRIB(proper,upcased) \
587     DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
588     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
589     virtual void set##proper(time_t proper)=0; \
590     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
591     virtual void set##proper(const XMLCh* proper)=0
592
593 /**
594  * Declares abstract get/set methods for a DateTime XML attribute.
595  *
596  * @param proper    the proper name of the attribute
597  * @param upcased   the upcased name of the attribute
598  */
599 #define DECL_DATETIME_ATTRIB(proper,upcased) \
600     DECL_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
601     XMLTOOLING_DOXYGEN(Returns the proper attribute in epoch form.) \
602     virtual time_t get##proper##Epoch() const=0; \
603     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
604     virtual void set##proper(time_t proper)=0; \
605     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
606     virtual void set##proper(const XMLCh* proper)=0
607
608 /**
609  * Declares abstract set method for an integer XML attribute.
610  * The get method is omitted.
611  *
612  * @param proper    the proper name of the attribute
613  * @param upcased   the upcased name of the attribute
614  */
615 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \
616     public: \
617         XMLTOOLING_DOXYGEN(proper attribute name) \
618         static const XMLCh upcased##_ATTRIB_NAME[]; \
619         XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
620         virtual void set##proper(const XMLCh* proper)=0; \
621         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
622         virtual void set##proper(int proper)=0
623
624 /**
625  * Declares abstract get/set methods for an integer XML attribute.
626  *
627  * @param proper    the proper name of the attribute
628  * @param upcased   the upcased name of the attribute
629  */
630 #define DECL_INTEGER_ATTRIB(proper,upcased) \
631     public: \
632         XMLTOOLING_DOXYGEN(proper attribute name) \
633         static const XMLCh upcased##_ATTRIB_NAME[]; \
634         XMLTOOLING_DOXYGEN(Returns the proper attribute after a NULL indicator.) \
635         virtual std::pair<bool,int> get##proper() const=0; \
636         XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
637         virtual void set##proper(const XMLCh* proper)=0; \
638         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
639         virtual void set##proper(int proper)=0
640
641 /**
642  * Declares abstract get/set methods for a boolean XML attribute.
643  *
644  * @param proper    the proper name of the attribute
645  * @param upcased   the upcased name of the attribute
646  * @param def       the default/presumed value, if no explicit value has been set
647  */
648 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \
649     public: \
650         XMLTOOLING_DOXYGEN(proper attribute name) \
651         static const XMLCh upcased##_ATTRIB_NAME[]; \
652         XMLTOOLING_DOXYGEN(Returns the proper attribute or def if not set.) \
653         bool proper() const { \
654             switch (get##proper()) { \
655                 case xmlconstants::XML_BOOL_TRUE: \
656                 case xmlconstants::XML_BOOL_ONE: \
657                     return true; \
658                 case xmlconstants::XML_BOOL_FALSE: \
659                 case xmlconstants::XML_BOOL_ZERO: \
660                     return false; \
661                 default: \
662                     return def; \
663             } \
664         } \
665         XMLTOOLING_DOXYGEN(Returns the proper attribute as an explicit enumerated value.) \
666         virtual xmlconstants::xmltooling_bool_t get##proper() const=0; \
667         XMLTOOLING_DOXYGEN(Sets the proper attribute using an enumerated value.) \
668         virtual void proper(xmlconstants::xmltooling_bool_t value)=0; \
669         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
670         void proper(bool value) { \
671             proper(value ? xmlconstants::XML_BOOL_ONE : xmlconstants::XML_BOOL_ZERO); \
672         } \
673         XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \
674         void set##proper(const XMLCh* value) { \
675             if (value) { \
676                 switch (*value) { \
677                     case xercesc::chLatin_t: \
678                         proper(xmlconstants::XML_BOOL_TRUE); \
679                         break; \
680                     case xercesc::chLatin_f: \
681                         proper(xmlconstants::XML_BOOL_FALSE); \
682                         break; \
683                     case xercesc::chDigit_1: \
684                         proper(xmlconstants::XML_BOOL_ONE); \
685                         break; \
686                     case xercesc::chDigit_0: \
687                         proper(xmlconstants::XML_BOOL_ZERO); \
688                         break; \
689                     default: \
690                         proper(xmlconstants::XML_BOOL_NULL); \
691                 } \
692             } \
693             else \
694                 proper(xmlconstants::XML_BOOL_NULL); \
695         }
696
697 /**
698  * Implements get/set methods and a private member for a typed XML attribute.
699  *
700  * @param proper    the proper name of the attribute
701  * @param type      the attribute's data type
702  */
703 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \
704     protected: \
705         type* m_##proper; \
706     public: \
707         const type* get##proper() const { \
708             return m_##proper; \
709         } \
710         void set##proper(const type* proper) { \
711             m_##proper = prepareForAssignment(m_##proper,proper); \
712         }
713
714 /**
715  * Implements get/set methods and a private member for a string XML attribute.
716  *
717  * @param proper    the proper name of the attribute
718  */
719 #define IMPL_STRING_ATTRIB(proper) \
720     IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)
721
722 /**
723  * Implements get/set methods and a private member for a string XML attribute,
724  * plus a getXMLID override.
725  *
726  * @param proper    the proper name of the attribute
727  */
728 #define IMPL_ID_ATTRIB(proper) \
729     IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
730     const XMLCh* getXMLID() const { \
731         return m_##proper; \
732     }
733
734 /**
735  * Implements get/set methods and a private member for a string XML attribute,
736  * plus a getXMLID override and attribute node clearance when DOM is dropped.
737  *
738  * @param proper    the proper name of the attribute
739  * @param ucase         the upcased name of the attribute
740  * @param namespaceURI  the XML namespace of the attribute
741  */
742 #define IMPL_ID_ATTRIB_EX(proper, ucase, namespaceURI) \
743     IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
744     const XMLCh* getXMLID() const { \
745         return m_##proper; \
746     } \
747     void releaseDOM() const { \
748         if (getDOM()) \
749             getDOM()->removeAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
750         AbstractDOMCachingXMLObject::releaseDOM(); \
751     }
752
753 /**
754  * Implements get/set methods and a private member for a DateTime XML attribute.
755  *
756  * @param proper    the proper name of the attribute
757  * @param fallback  epoch to return when attribute is NULL
758  */
759 #define IMPL_DATETIME_ATTRIB(proper,fallback) \
760     IMPL_DATETIME_ATTRIB_EX(proper,fallback,false)
761
762 /**
763  * Implements get/set methods and a private member for a duration-valued DateTime XML attribute.
764  *
765  * @param proper    the proper name of the attribute
766  * @param fallback  epoch to return when attribute is NULL
767  */
768 #define IMPL_DURATION_ATTRIB(proper,fallback) \
769     IMPL_DATETIME_ATTRIB_EX(proper,fallback,true)
770
771 /**
772  * Implements get/set methods and a private member for a DateTime XML attribute.
773  *
774  * @param proper    the proper name of the attribute
775  * @param fallback  epoch to return when attribute is NULL
776  * @param duration  true iff the attribute should be handled as a duration
777  */
778 #define IMPL_DATETIME_ATTRIB_EX(proper,fallback,duration) \
779     protected: \
780         DateTime* m_##proper; \
781         time_t m_##proper##Epoch; \
782     public: \
783         const DateTime* get##proper() const { \
784             return m_##proper; \
785         } \
786         time_t get##proper##Epoch() const { \
787             return m_##proper ? m_##proper##Epoch : fallback; \
788         } \
789         void set##proper(const DateTime* proper) { \
790             m_##proper = prepareForAssignment(m_##proper,proper); \
791             if (m_##proper) \
792                 m_##proper##Epoch=m_##proper->getEpoch(duration); \
793         } \
794         void set##proper(time_t proper) { \
795             m_##proper = prepareForAssignment(m_##proper,proper,duration); \
796             m_##proper##Epoch = proper; \
797         } \
798         void set##proper(const XMLCh* proper) { \
799             m_##proper = prepareForAssignment(m_##proper,proper,duration); \
800             if (m_##proper) \
801                 m_##proper##Epoch=m_##proper->getEpoch(duration); \
802         }
803
804 /**
805  * Implements get/set methods and a private member for an integer XML attribute.
806  *
807  * @param proper    the proper name of the attribute
808  */
809 #define IMPL_INTEGER_ATTRIB(proper) \
810     protected: \
811         XMLCh* m_##proper; \
812     public: \
813         pair<bool,int> get##proper() const { \
814             if (m_##proper) { \
815                 try { \
816                     return std::make_pair(true, xercesc::XMLString::parseInt(m_##proper)); \
817                 } \
818                 catch (...) { \
819                     return std::make_pair(true, 0); \
820                 } \
821             } else { \
822                 return std::make_pair(false, 0); \
823             } \
824         } \
825         void set##proper(const XMLCh* proper) { \
826             m_##proper = prepareForAssignment(m_##proper,proper); \
827         } \
828         void set##proper(int proper) { \
829             try { \
830                 std::string buf(boost::lexical_cast<std::string>(proper)); \
831                 xmltooling::auto_ptr_XMLCh widen(buf.c_str()); \
832                 set##proper(widen.get()); \
833             } \
834             catch (boost::bad_lexical_cast&) { \
835             } \
836         }
837
838 /**
839  * Implements get/set methods and a private member for a boolean XML attribute.
840  *
841  * @param proper    the proper name of the attribute
842  */
843 #define IMPL_BOOLEAN_ATTRIB(proper) \
844     protected: \
845         xmlconstants::xmltooling_bool_t m_##proper; \
846     public: \
847         xmlconstants::xmltooling_bool_t get##proper() const { \
848             return m_##proper; \
849         } \
850         void proper(xmlconstants::xmltooling_bool_t value) { \
851             if (m_##proper != value) { \
852                 releaseThisandParentDOM(); \
853                 m_##proper = value; \
854             } \
855         }
856
857 /**
858  * Implements get/set methods and a private member for a typed, qualified XML attribute.
859  *
860  * @param proper    the proper name of the attribute
861  * @param type      the attribute's data type
862  */
863 #define IMPL_XMLOBJECT_FOREIGN_ATTRIB(proper,type) \
864     protected: \
865     XMLCh* m_##proper##Prefix; \
866         type* m_##proper; \
867     public: \
868         const type* get##proper() const { \
869             return m_##proper; \
870         } \
871         void set##proper(const type* proper) { \
872             m_##proper = prepareForAssignment(m_##proper,proper); \
873             xercesc::XMLString::release(&m_##proper##Prefix); \
874             m_##proper##Prefix = nullptr; \
875         }
876
877 /**
878  * Declares abstract set method for a typed XML child object in a foreign namespace.
879  * The get method is omitted.
880  *
881  * @param proper    the proper name of the child type
882  * @param ns        the C++ namespace for the type
883  */
884 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
885     public: \
886         XMLTOOLING_DOXYGEN(Sets the proper child.) \
887         virtual void set##proper(ns::proper* child)=0
888
889 /**
890  * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
891  *
892  * @param proper    the proper name of the child type
893  * @param ns        the C++ namespace for the type
894  */
895 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
896     public: \
897         XMLTOOLING_DOXYGEN(Returns the proper child.) \
898         virtual ns::proper* get##proper() const=0; \
899         XMLTOOLING_DOXYGEN(Sets the proper child.) \
900         virtual void set##proper(ns::proper* child)=0
901
902 /**
903  * Declares abstract set method for a typed XML child object.
904  * The get method is omitted.
905  *
906  * @param proper    the proper name of the child type
907  */
908 #define DECL_INHERITED_TYPED_CHILD(proper) \
909     public: \
910         XMLTOOLING_DOXYGEN(Sets the proper child.) \
911         virtual void set##proper(proper* child)=0
912
913 /**
914  * Declares abstract get/set methods for a typed XML child object.
915  *
916  * @param proper    the proper name of the child type
917  */
918 #define DECL_TYPED_CHILD(proper) \
919     public: \
920         XMLTOOLING_DOXYGEN(Returns the proper child.) \
921         virtual proper* get##proper() const=0; \
922         XMLTOOLING_DOXYGEN(Sets the proper child.) \
923         virtual void set##proper(proper* child)=0
924
925 /**
926  * Declares abstract get/set methods for a generic XML child object.
927  *
928  * @param proper    the proper name of the child
929  */
930 #define DECL_XMLOBJECT_CHILD(proper) \
931     public: \
932         XMLTOOLING_DOXYGEN(Returns the proper child.) \
933         virtual xmltooling::XMLObject* get##proper() const=0; \
934         XMLTOOLING_DOXYGEN(Sets the proper child.) \
935         virtual void set##proper(xmltooling::XMLObject* child)=0
936
937
938 /**
939  * Implements get/set methods and a private list iterator member for a typed XML child object.
940  *
941  * @param proper    the proper name of the child type
942  */
943 #define IMPL_TYPED_CHILD(proper) \
944     protected: \
945         proper* m_##proper; \
946         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
947     public: \
948         proper* get##proper() const { \
949             return m_##proper; \
950         } \
951         void set##proper(proper* child) { \
952             prepareForAssignment(m_##proper,child); \
953             *m_pos_##proper = m_##proper = child; \
954         }
955
956 /**
957  * Implements get/set methods and a private list iterator member for
958  * a typed XML child object in a foreign namespace
959  *
960  * @param proper    the proper name of the child type
961  * @param ns        the C++ namespace for the type
962  */
963 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
964     protected: \
965         ns::proper* m_##proper; \
966         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
967     public: \
968         ns::proper* get##proper() const { \
969             return m_##proper; \
970         } \
971         void set##proper(ns::proper* child) { \
972             prepareForAssignment(m_##proper,child); \
973             *m_pos_##proper = m_##proper = child; \
974         }
975
976 /**
977  * Implements get/set methods and a private list iterator member for a generic XML child object.
978  *
979  * @param proper    the proper name of the child
980  */
981 #define IMPL_XMLOBJECT_CHILD(proper) \
982     protected: \
983         xmltooling::XMLObject* m_##proper; \
984         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
985     public: \
986         xmltooling::XMLObject* get##proper() const { \
987             return m_##proper; \
988         } \
989         void set##proper(xmltooling::XMLObject* child) { \
990             prepareForAssignment(m_##proper,child); \
991             *m_pos_##proper = m_##proper = child; \
992         }
993
994 /**
995  * Declares abstract get/set methods for a typed XML child collection.
996  *
997  * @param proper    the proper name of the child type
998  */
999 #define DECL_TYPED_CHILDREN(proper) \
1000     public: \
1001         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
1002         virtual VectorOf(proper) get##proper##s()=0; \
1003         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
1004         virtual const std::vector<proper*>& get##proper##s() const=0
1005
1006 /**
1007  * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
1008  *
1009  * @param proper    the proper name of the child type
1010  * @param ns        the C++ namespace for the type
1011  */
1012 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
1013     public: \
1014         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
1015         virtual VectorOf(ns::proper) get##proper##s()=0; \
1016         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
1017         virtual const std::vector<ns::proper*>& get##proper##s() const=0
1018
1019 /**
1020  * Declares abstract get/set methods for a generic XML child collection.
1021  *
1022  * @param proper    the proper name of the child
1023  */
1024 #define DECL_XMLOBJECT_CHILDREN(proper) \
1025     public: \
1026         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
1027         virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
1028         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
1029         virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
1030
1031 /**
1032  * Implements get method and a private vector member for a typed XML child collection.
1033  *
1034  * @param proper    the proper name of the child type
1035  * @param fence     insertion fence for new objects of the child collection in backing list
1036  */
1037 #define IMPL_TYPED_CHILDREN(proper,fence) \
1038     protected: \
1039         std::vector<proper*> m_##proper##s; \
1040     public: \
1041         VectorOf(proper) get##proper##s() { \
1042             return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
1043         } \
1044         const std::vector<proper*>& get##proper##s() const { \
1045             return m_##proper##s; \
1046         }
1047
1048 /**
1049  * Implements get method and a private vector member for a typed XML child collection
1050  * in a foreign namespace.
1051  *
1052  * @param proper    the proper name of the child type
1053  * @param ns        the C++ namespace for the type
1054  * @param fence     insertion fence for new objects of the child collection in backing list
1055  */
1056 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
1057     protected: \
1058         std::vector<ns::proper*> m_##proper##s; \
1059     public: \
1060         VectorOf(ns::proper) get##proper##s() { \
1061             return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
1062         } \
1063         const std::vector<ns::proper*>& get##proper##s() const { \
1064             return m_##proper##s; \
1065         }
1066
1067 /**
1068  * Implements get method and a private vector member for a generic XML child collection.
1069  *
1070  * @param proper    the proper name of the child
1071  * @param fence     insertion fence for new objects of the child collection in backing list
1072  */
1073 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
1074     protected: \
1075         std::vector<xmltooling::XMLObject*> m_##proper##s; \
1076     public: \
1077         VectorOf(xmltooling::XMLObject) get##proper##s() { \
1078             return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
1079         } \
1080         const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
1081             return m_##proper##s; \
1082         }
1083
1084 /**
1085  * Implements marshalling for a string attribute
1086  *
1087  * @param proper        the proper name of the attribute
1088  * @param ucase         the upcased name of the attribute
1089  * @param namespaceURI  the XML namespace of the attribute
1090  */
1091 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
1092     if (m_##proper && *m_##proper) { \
1093         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1094     }
1095
1096 /**
1097  * Implements marshalling for a DateTime attribute
1098  *
1099  * @param proper        the proper name of the attribute
1100  * @param ucase         the upcased name of the attribute
1101  * @param namespaceURI  the XML namespace of the attribute
1102  */
1103 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
1104     if (m_##proper) { \
1105         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
1106     }
1107
1108 /**
1109  * Implements marshalling for an integer attribute
1110  *
1111  * @param proper        the proper name of the attribute
1112  * @param ucase         the upcased name of the attribute
1113  * @param namespaceURI  the XML namespace of the attribute
1114  */
1115 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
1116     if (m_##proper && *m_##proper) { \
1117         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1118     }
1119
1120 /**
1121  * Implements marshalling for a boolean attribute
1122  *
1123  * @param proper        the proper name of the attribute
1124  * @param ucase         the upcased name of the attribute
1125  * @param namespaceURI  the XML namespace of the attribute
1126  */
1127 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
1128     switch (m_##proper) { \
1129         case xmlconstants::XML_BOOL_TRUE: \
1130             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
1131             break; \
1132         case xmlconstants::XML_BOOL_ONE: \
1133             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
1134             break; \
1135         case xmlconstants::XML_BOOL_FALSE: \
1136             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
1137             break; \
1138         case xmlconstants::XML_BOOL_ZERO: \
1139             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
1140             break; \
1141         case xmlconstants::XML_BOOL_NULL: \
1142             break; \
1143     }
1144
1145 /**
1146  * Implements marshalling for a QName attribute
1147  *
1148  * @param proper        the proper name of the attribute
1149  * @param ucase         the upcased name of the attribute
1150  * @param namespaceURI  the XML namespace of the attribute
1151  */
1152 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
1153     if (m_##proper) { \
1154         xmltooling::auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
1155         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
1156     }
1157
1158 #ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
1159 /**
1160  * Implements marshalling for an ID attribute
1161  *
1162  * @param proper        the proper name of the attribute
1163  * @param ucase         the upcased name of the attribute
1164  * @param namespaceURI  the XML namespace of the attribute
1165  */
1166 # define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
1167     if (m_##proper && *m_##proper) { \
1168         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1169         domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, true); \
1170     }
1171 #else
1172 /**
1173  * Implements marshalling for an ID attribute
1174  *
1175  * @param proper        the proper name of the attribute
1176  * @param ucase         the upcased name of the attribute
1177  * @param namespaceURI  the XML namespace of the attribute
1178  */
1179 # define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
1180     if (m_##proper && *m_##proper) { \
1181         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1182         domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
1183     }
1184 #endif
1185
1186 /**
1187  * Implements unmarshalling process branch for a string attribute
1188  *
1189  * @param proper        the proper name of the attribute
1190  * @param ucase         the upcased name of the attribute
1191  * @param namespaceURI  the XML namespace of the attribute
1192  */
1193 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
1194     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1195         set##proper(attribute->getValue()); \
1196         return; \
1197     }
1198
1199 #ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
1200 /**
1201  * Implements unmarshalling process branch for an ID attribute
1202  *
1203  * @param proper        the proper name of the attribute
1204  * @param ucase         the upcased name of the attribute
1205  * @param namespaceURI  the XML namespace of the attribute
1206  */
1207 # define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
1208     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1209         set##proper(attribute->getValue()); \
1210         attribute->getOwnerElement()->setIdAttributeNode(attribute, true); \
1211         return; \
1212     }
1213 #else
1214 /**
1215  * Implements unmarshalling process branch for an ID attribute
1216  *
1217  * @param proper        the proper name of the attribute
1218  * @param ucase         the upcased name of the attribute
1219  * @param namespaceURI  the XML namespace of the attribute
1220  */
1221 # define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
1222     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1223         set##proper(attribute->getValue()); \
1224         attribute->getOwnerElement()->setIdAttributeNode(attribute); \
1225         return; \
1226     }
1227 #endif
1228
1229 /**
1230  * Implements unmarshalling process branch for a DateTime attribute
1231  *
1232  * @param proper        the proper name of the attribute
1233  * @param ucase         the upcased name of the attribute
1234  * @param namespaceURI  the XML namespace of the attribute
1235  */
1236 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
1237     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1238
1239 /**
1240  * Implements unmarshalling process branch for a DateTime attribute
1241  *
1242  * @param proper        the proper name of the attribute
1243  * @param ucase         the upcased name of the attribute
1244  * @param namespaceURI  the XML namespace of the attribute
1245  */
1246 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
1247     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1248         std::auto_ptr<xmltooling::QName> q(xmltooling::XMLHelper::getAttributeValueAsQName(attribute)); \
1249         set##proper(q.get()); \
1250         return; \
1251     }
1252
1253 /**
1254  * Implements unmarshalling process branch for an integer attribute
1255  *
1256  * @param proper        the proper name of the attribute
1257  * @param ucase         the upcased name of the attribute
1258  * @param namespaceURI  the XML namespace of the attribute
1259  */
1260 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
1261     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1262
1263 /**
1264  * Implements unmarshalling process branch for a boolean attribute
1265  *
1266  * @param proper        the proper name of the attribute
1267  * @param ucase         the upcased name of the attribute
1268  * @param namespaceURI  the XML namespace of the attribute
1269  */
1270 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
1271     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1272
1273 /**
1274  * Implements unmarshalling process branch for typed child collection element
1275  *
1276  * @param proper        the proper name of the child type
1277  * @param namespaceURI  the XML namespace of the child element
1278  * @param force         bypass use of hint and just cast down to check child
1279  */
1280 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
1281     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1282         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1283         if (typesafe) { \
1284             get##proper##s().push_back(typesafe); \
1285             return; \
1286         } \
1287     }
1288
1289 /**
1290  * Implements unmarshalling process branch for typed child collection element
1291  * in a foreign namespace.
1292  *
1293  * @param proper        the proper name of the child type
1294  * @param ns            the C++ namespace for the type
1295  * @param namespaceURI  the XML namespace of the child element
1296  * @param force         bypass use of hint and just cast down to check child
1297  */
1298 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
1299     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1300         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1301         if (typesafe) { \
1302             get##proper##s().push_back(typesafe); \
1303             return; \
1304         } \
1305     }
1306
1307 /**
1308  * Implements unmarshalling process branch for typed child singleton element
1309  *
1310  * @param proper        the proper name of the child type
1311  * @param namespaceURI  the XML namespace of the child element
1312  * @param force         bypass use of hint and just cast down to check child
1313  */
1314 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
1315     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1316         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1317         if (typesafe && !m_##proper) { \
1318             typesafe->setParent(this); \
1319             *m_pos_##proper = m_##proper = typesafe; \
1320             return; \
1321         } \
1322     }
1323
1324 /**
1325  * Implements unmarshalling process branch for typed child singleton element
1326  * in a foreign namespace.
1327  *
1328  * @param proper        the proper name of the child type
1329  * @param ns            the C++ namespace for the type
1330  * @param namespaceURI  the XML namespace of the child element
1331  * @param force         bypass use of hint and just cast down to check child
1332  */
1333 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
1334     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1335         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1336         if (typesafe && !m_##proper) { \
1337             typesafe->setParent(this); \
1338             *m_pos_##proper = m_##proper = typesafe; \
1339             return; \
1340         } \
1341     }
1342
1343 /**
1344  * Implements unmarshalling process branch for a generic child singleton element
1345  *
1346  * @param proper        the proper name of the child type
1347  * @param namespaceURI  the XML namespace of the child element
1348  */
1349 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
1350     if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1351         if (!m_##proper) { \
1352             childXMLObject->setParent(this); \
1353             *m_pos_##proper = m_##proper = childXMLObject; \
1354             return; \
1355         } \
1356     }
1357
1358 /**
1359  * Declares aliased get/set methods for named XML element simple content.
1360  *
1361  * @param proper    the proper name to label the element's content
1362  */
1363 #define DECL_SIMPLE_CONTENT(proper) \
1364     XMLTOOLING_DOXYGEN(Returns proper.) \
1365     const XMLCh* get##proper() const { \
1366         return getTextContent(); \
1367     } \
1368     XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1369     void set##proper(const XMLCh* proper) { \
1370         setTextContent(proper); \
1371     }
1372
1373 /**
1374  * Declares aliased get/set methods for named integer XML element content.
1375  *
1376  * @param proper    the proper name to label the element's content
1377  */
1378 #define DECL_INTEGER_CONTENT(proper) \
1379     XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
1380     std::pair<bool,int> get##proper() const { \
1381         if (getTextContent()) { \
1382             try { \
1383                 return std::make_pair(true, xercesc::XMLString::parseInt(getTextContent())); \
1384             } \
1385             catch (...) { \
1386                 return std::make_pair(true, 0); \
1387             } \
1388         } else { \
1389             return std::make_pair(false, 0); \
1390         } \
1391     } \
1392     XMLTOOLING_DOXYGEN(Sets proper.) \
1393     void set##proper(int proper) { \
1394         try { \
1395             std::string buf(boost::lexical_cast<std::string>(proper)); \
1396             xmltooling::auto_ptr_XMLCh widen(buf.c_str()); \
1397             setTextContent(widen.get()); \
1398         } \
1399         catch (boost::bad_lexical_cast&) { \
1400         } \
1401     } \
1402     XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1403     void set##proper(const XMLCh* proper) { \
1404         setTextContent(proper); \
1405     }
1406
1407 /**
1408  * Implements cloning methods for an XMLObject specialization implementation class.
1409  *
1410  * @param cname the name of the XMLObject specialization
1411  */
1412 #define IMPL_XMLOBJECT_CLONE(cname) \
1413     cname* clone##cname() const { \
1414         return dynamic_cast<cname*>(clone()); \
1415     } \
1416     xmltooling::XMLObject* clone() const { \
1417         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1418         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1419         if (ret) { \
1420             domClone.release(); \
1421             return ret; \
1422         } \
1423         return new cname##Impl(*this); \
1424     }
1425
1426 /**
1427  * Implements cloning methods for an XMLObject specialization implementation class
1428  * that must override a base class clone method.
1429  *
1430  * @param cname the name of the XMLObject specialization
1431  * @param base  name of base type.
1432  */
1433 #define IMPL_XMLOBJECT_CLONE2(cname,base) \
1434     cname* clone##cname() const { \
1435         return dynamic_cast<cname*>(clone()); \
1436     } \
1437     base* clone##base() const { \
1438         return dynamic_cast<base*>(clone()); \
1439     } \
1440     xmltooling::XMLObject* clone() const { \
1441         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1442         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1443         if (ret) { \
1444             domClone.release(); \
1445             return ret; \
1446         } \
1447         return new cname##Impl(*this); \
1448     }
1449
1450 /**
1451  * Implements cloning methods for an XMLObject specialization implementation class that
1452  * needs two stage duplication to avoid invoking virtual methods during construction.
1453  *
1454  * @param cname the name of the XMLObject specialization
1455  */
1456 #define IMPL_XMLOBJECT_CLONE_EX(cname) \
1457     cname* clone##cname() const { \
1458         return dynamic_cast<cname*>(clone()); \
1459     } \
1460     xmltooling::XMLObject* clone() const { \
1461         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1462         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1463         if (ret) { \
1464             domClone.release(); \
1465             return ret; \
1466         } \
1467         std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
1468         ret2->_clone(*this); \
1469         return ret2.release(); \
1470     }
1471
1472 /**
1473  * Implements cloning methods for an XMLObject specialization implementation class that
1474  * needs two stage duplication to avoid invoking virtual methods during construction,
1475  * and must override a base class clone method.
1476  *
1477  * @param cname the name of the XMLObject specialization
1478  * @param base  name of base type
1479  */
1480 #define IMPL_XMLOBJECT_CLONE_EX2(cname,base) \
1481     cname* clone##cname() const { \
1482         return dynamic_cast<cname*>(clone()); \
1483     } \
1484     base* clone##base() const { \
1485         return dynamic_cast<base*>(clone()); \
1486     } \
1487     xmltooling::XMLObject* clone() const { \
1488         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1489         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1490         if (ret) { \
1491             domClone.release(); \
1492             return ret; \
1493         } \
1494         std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
1495         ret2->_clone(*this); \
1496         return ret2.release(); \
1497     }
1498
1499 /**
1500  * Implements cloning of a child attribute, for use in copy constructor or
1501  * deferred clone methods.
1502  *
1503  * proper   the proper name of the attribute to clone
1504  */
1505 #define IMPL_CLONE_ATTRIB(proper) \
1506     set##proper(src.get##proper())
1507
1508 /**
1509  * Implements cloning of a child attribute in a foreign namespace, for use in copy constructor or
1510  * deferred clone methods.
1511  *
1512  * proper   the proper name of the attribute to clone
1513  */
1514 #define IMPL_CLONE_FOREIGN_ATTRIB(proper) \
1515     set##proper(src.get##proper()); \
1516     if (src.m_##proper##Prefix) \
1517         m_##proper##Prefix = xercesc::XMLString::replicate(src.m_##proper##Prefix)
1518
1519 /**
1520  * Implements cloning of an integer child attribute, for use in copy constructor or
1521  * deferred clone methods.
1522  *
1523  * proper   the proper name of the attribute to clone
1524  */
1525 #define IMPL_CLONE_INTEGER_ATTRIB(proper) \
1526     set##proper(src.m_##proper)
1527
1528 /**
1529  * Implements cloning of a boolean child attribute, for use in copy constructor or
1530  * deferred clone methods.
1531  *
1532  * proper   the proper name of the attribute to clone
1533  */
1534 #define IMPL_CLONE_BOOLEAN_ATTRIB(proper) \
1535     proper(src.m_##proper)
1536
1537 /**
1538  * Implements cloning of a child object, for use in copy constructor or
1539  * deferred clone methods.
1540  *
1541  * proper   the proper name of the child object to clone
1542  */
1543 #define IMPL_CLONE_XMLOBJECT_CHILD(proper) \
1544     if (src.get##proper()) \
1545         set##proper(src.get##proper()->clone())
1546
1547 /**
1548  * Implements cloning of a typed child object, for use in copy constructor or
1549  * deferred clone methods.
1550  *
1551  * proper   the proper name of the child type to clone
1552  */
1553 #define IMPL_CLONE_TYPED_CHILD(proper) \
1554     if (src.get##proper()) \
1555         set##proper(src.get##proper()->clone##proper())
1556
1557 /**
1558  * Implements cloning of an untyped child collection, for use in copy constructor or
1559  * deferred clone methods.
1560  *
1561  * proper   the proper name of the child type to clone
1562  */
1563 #define IMPL_CLONE_XMLOBJECT_CHILDREN(proper) \
1564     static void (VectorOf(XMLObject)::* XMLObject_push_back)(XMLObject* const&) = &VectorOf(XMLObject)::push_back; \
1565     VectorOf(XMLObject) c##proper = get##proper##s(); \
1566     std::for_each( \
1567         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1568         boost::lambda::if_(boost::lambda::_1 != ((XMLObject*)nullptr)) \
1569             [boost::lambda::bind(XMLObject_push_back, boost::ref(c##proper), boost::lambda::bind(&XMLObject::clone, boost::lambda::_1))] \
1570         )
1571
1572 /**
1573  * Implements cloning of a child collection, for use in copy constructor or
1574  * deferred clone methods.
1575  *
1576  * proper   the proper name of the child type to clone
1577  */
1578 #define IMPL_CLONE_TYPED_CHILDREN(proper) \
1579     static void (VectorOf(proper)::* proper##_push_back)(proper* const&) = &VectorOf(proper)::push_back; \
1580     VectorOf(proper) c##proper = get##proper##s(); \
1581     std::for_each( \
1582         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1583         boost::lambda::if_(boost::lambda::_1 != ((proper*)nullptr)) \
1584             [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&proper::clone##proper, boost::lambda::_1))] \
1585         )
1586
1587 /**
1588  * Implements cloning of a child collection in a foreign namespace, for use in copy constructor or
1589  * deferred clone methods.
1590  *
1591  * proper   the proper name of the child type to clone
1592  * ns       the namespace of the child type
1593  */
1594 #define IMPL_CLONE_TYPED_FOREIGN_CHILDREN(proper,ns) \
1595     static void (VectorOf(ns::proper)::* proper##_push_back)(ns::proper* const&) = &VectorOf(ns::proper)::push_back; \
1596     VectorOf(ns::proper) c##proper = get##proper##s(); \
1597     std::for_each( \
1598         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1599         boost::lambda::if_(boost::lambda::_1 != ((ns::proper*)nullptr)) \
1600             [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&ns::proper::clone##proper, boost::lambda::_1))] \
1601         )
1602
1603 /**
1604  * Opens an iteration loop over all of the children of an object.
1605  */
1606 #define IMPL_CLONE_CHILDBAG_BEGIN \
1607     for (list<xmltooling::XMLObject*>::const_iterator _bagit = src.m_children.begin(); _bagit != src.m_children.end(); ++_bagit) {
1608
1609 /**
1610  * Closes an iteration loop over all of the children of an object.
1611  */
1612 #define IMPL_CLONE_CHILDBAG_END }
1613
1614 /**
1615  * Implements cloning of a typed child in a bag iteration loop based on a cast check.
1616  *
1617  * @param proper    the proper name of the child type to clone
1618  */
1619 #define IMPL_CLONE_TYPED_CHILD_IN_BAG(proper) \
1620     proper* _##proper##cast = dynamic_cast<proper*>(*_bagit); \
1621     if (_##proper##cast) { \
1622         get##proper##s().push_back(_##proper##cast->clone##proper()); \
1623         continue; \
1624     }
1625
1626 /**
1627  * Implements cloning of a typed child in a forign namespace in a bag iteration loop based on a cast check.
1628  *
1629  * @param proper    the proper name of the child type to clone
1630  * @param ns        the namespace of the child type
1631  */
1632 #define IMPL_CLONE_TYPED_FOREIGN_CHILD_IN_BAG(proper,ns) \
1633     ns::proper* _##proper##cast = dynamic_cast<ns::proper*>(*_bagit); \
1634     if (_##proper##cast) { \
1635         get##proper##s().push_back(_##proper##cast->clone##proper()); \
1636         continue; \
1637     }
1638
1639 /**
1640  * Implements cloning of an XMLObject child in a bag iteration loop.
1641  *
1642  * @param proper    the proper name of the child to clone
1643  */
1644 #define IMPL_CLONE_XMLOBJECT_CHILD_IN_BAG(proper) \
1645     if (*_bagit) { \
1646         get##proper##s().push_back((*_bagit)->clone()); \
1647     }
1648
1649 /**
1650  * Declares an XMLObject specialization with a simple content model and type,
1651  * handling it as string data.
1652  *
1653  * @param linkage   linkage specifier for the class
1654  * @param cname     the name of the XMLObject specialization
1655  * @param proper    the proper name to label the element's content
1656  * @param desc      documentation for class
1657  */
1658 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
1659     BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
1660         DECL_SIMPLE_CONTENT(proper); \
1661     END_XMLOBJECT
1662
1663 /**
1664  * Declares and defines an implementation class for an XMLObject with
1665  * a simple content model and type, handling it as string data.
1666  *
1667  * @param linkage   linkage specifier for the class
1668  * @param cname     the name of the XMLObject specialization
1669  */
1670 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
1671     class linkage cname##Impl \
1672         : public virtual cname, \
1673             public xmltooling::AbstractSimpleElement, \
1674             public xmltooling::AbstractDOMCachingXMLObject, \
1675             public xmltooling::AbstractXMLObjectMarshaller, \
1676             public xmltooling::AbstractXMLObjectUnmarshaller \
1677     { \
1678     public: \
1679         virtual ~cname##Impl() {} \
1680         cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) \
1681             : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
1682         } \
1683         cname##Impl(const cname##Impl& src) \
1684             : xmltooling::AbstractXMLObject(src), \
1685                 xmltooling::AbstractSimpleElement(src), \
1686                 xmltooling::AbstractDOMCachingXMLObject(src) {} \
1687         IMPL_XMLOBJECT_CLONE(cname) \
1688     }
1689
1690 #ifdef HAVE_COVARIANT_RETURNS
1691
1692 /**
1693  * Begins the declaration of an XMLObjectBuilder specialization.
1694  * Basic boilerplate includes an empty virtual destructor, and
1695  * a default builder that defaults the element name.
1696  *
1697  * @param linkage           linkage specifier for the class
1698  * @param cname             the name of the XMLObject specialization
1699  * @param namespaceURI      the XML namespace of the default associated element
1700  * @param namespacePrefix   the XML namespace prefix of the default associated element
1701  */
1702 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1703     XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1704     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1705     public: \
1706         virtual ~cname##Builder() {} \
1707         XMLTOOLING_DOXYGEN(Default builder.) \
1708         virtual cname* buildObject() const { \
1709             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1710         } \
1711         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1712         virtual cname* buildObject( \
1713             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \
1714             ) const
1715
1716 /**
1717  * Ends the declaration of an XMLObjectBuilder specialization.
1718  */
1719 #define END_XMLOBJECTBUILDER }
1720
1721 /**
1722  * Declares a generic XMLObjectBuilder specialization.
1723  *
1724  * @param linkage           linkage specifier for the class
1725  * @param cname             the name of the XMLObject specialization
1726  * @param namespaceURI      the XML namespace of the default associated element
1727  * @param namespacePrefix   the XML namespace prefix of the default associated element
1728  */
1729  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1730     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1731     XMLTOOLING_DOXYGEN(Singleton builder.) \
1732     static cname* build##cname() { \
1733         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1734             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1735             ); \
1736         if (b) \
1737             return b->buildObject(); \
1738         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1739     } \
1740     END_XMLOBJECTBUILDER
1741
1742 /**
1743  * Implements the standard XMLObjectBuilder specialization function.
1744  *
1745  * @param cname the name of the XMLObject specialization
1746  */
1747 #define IMPL_XMLOBJECTBUILDER(cname) \
1748     cname* cname##Builder::buildObject( \
1749         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \
1750         ) const \
1751     { \
1752         return new cname##Impl(nsURI,localName,prefix,schemaType); \
1753     }
1754
1755 #else   /* !HAVE_COVARIANT_RETURNS */
1756
1757 /**
1758  * Begins the declaration of an XMLObjectBuilder specialization.
1759  * Basic boilerplate includes an empty virtual destructor, and
1760  * a default builder that defaults the element name.
1761  *
1762  * @param linkage           linkage specifier for the class
1763  * @param cname             the name of the XMLObject specialization
1764  * @param namespaceURI      the XML namespace of the default associated element
1765  * @param namespacePrefix   the XML namespace prefix of the default associated element
1766  */
1767 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1768     XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1769     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1770     public: \
1771         virtual ~cname##Builder() {} \
1772         XMLTOOLING_DOXYGEN(Default builder.) \
1773         virtual xmltooling::XMLObject* buildObject() const { \
1774             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1775         } \
1776         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1777         virtual xmltooling::XMLObject* buildObject( \
1778             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \
1779             ) const
1780
1781 /**
1782  * Ends the declaration of an XMLObjectBuilder specialization.
1783  */
1784 #define END_XMLOBJECTBUILDER }
1785
1786 /**
1787  * Declares a generic XMLObjectBuilder specialization.
1788  *
1789  * @param linkage           linkage specifier for the class
1790  * @param cname             the name of the XMLObject specialization
1791  * @param namespaceURI      the XML namespace of the default associated element
1792  * @param namespacePrefix   the XML namespace prefix of the default associated element
1793  */
1794  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1795     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1796     XMLTOOLING_DOXYGEN(Singleton builder.) \
1797     static cname* build##cname() { \
1798         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1799             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1800             ); \
1801         if (b) \
1802             return dynamic_cast<cname*>(b->buildObject()); \
1803         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1804     } \
1805     END_XMLOBJECTBUILDER
1806
1807 /**
1808  * Implements the standard XMLObjectBuilder specialization function.
1809  *
1810  * @param cname the name of the XMLObject specialization
1811  */
1812 #define IMPL_XMLOBJECTBUILDER(cname) \
1813     xmltooling::XMLObject* cname##Builder::buildObject( \
1814         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \
1815         ) const \
1816     { \
1817         return new cname##Impl(nsURI,localName,prefix,schemaType); \
1818     }
1819
1820 #endif  /* HAVE_COVARIANT_RETURNS */
1821
1822 /**
1823  * Begins the declaration of a Schema Validator specialization.
1824  *
1825  * @param linkage           linkage specifier for the class
1826  * @param cname the base name of the Validator specialization
1827  */
1828  #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
1829     class linkage cname##SchemaValidator : public xmltooling::Validator \
1830     { \
1831     public: \
1832         virtual ~cname##SchemaValidator() {} \
1833         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1834             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1835             if (!ptr) \
1836                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name())); \
1837             if (ptr->nil() && (ptr->hasChildren() || ptr->getTextContent())) \
1838                 throw xmltooling::ValidationException("Object has nil property but with children or content.")
1839
1840 /**
1841  * Begins the declaration of a Schema Validator specialization subclass.
1842  *
1843  * @param linkage   linkage specifier for the class
1844  * @param cname     the base name of the Validator specialization
1845  * @param base      base class for the validator
1846  */
1847  #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
1848     class linkage cname##SchemaValidator : public base##SchemaValidator \
1849     { \
1850     public: \
1851         virtual ~cname##SchemaValidator() {} \
1852         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1853             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1854             if (!ptr) \
1855                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()));
1856
1857 /**
1858  * Ends the declaration of a Validator specialization.
1859  */
1860 #define END_XMLOBJECTVALIDATOR } }
1861
1862 /**
1863  * Validator code that checks the object type.
1864  *
1865  * @param cname     the name of the XMLObject specialization
1866  */
1867 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
1868     const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1869     if (!ptr) \
1870         throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1871
1872 /**
1873  * Validator code that checks for a required attribute, content, or singleton.
1874  *
1875  * @param cname     the name of the XMLObject specialization
1876  * @param proper    the proper name of the attribute, content, or singleton member
1877  */
1878 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
1879     if (!ptr->get##proper()) \
1880         throw xmltooling::ValidationException(#cname" must have "#proper".")
1881
1882 /**
1883  * Validator code that checks for a required integer attribute
1884  *
1885  * @param cname     the name of the XMLObject specialization
1886  * @param proper    the proper name of the attribute, content, or singleton member
1887  */
1888 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
1889     if (!ptr->get##proper().first) \
1890         throw xmltooling::ValidationException(#cname" must have "#proper".")
1891
1892 /**
1893  * Validator code that checks for one of a pair of
1894  * required attributes, content, or singletons.
1895  *
1896  * @param cname     the name of the XMLObject specialization
1897  * @param proper1   the proper name of the first attribute, content, or singleton member
1898  * @param proper2   the proper name of the second attribute, content, or singleton member
1899  */
1900 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
1901     if (!ptr->get##proper1() && !ptr->get##proper2()) \
1902         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
1903
1904 /**
1905  * Validator code that checks for one of a pair of
1906  * required attributes, content, or singletons, but disallows both.
1907  *
1908  * @param cname     the name of the XMLObject specialization
1909  * @param proper1   the proper name of the first attribute, content, or singleton member
1910  * @param proper2   the proper name of the second attribute, content, or singleton member
1911  */
1912 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
1913     if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
1914         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
1915
1916 /**
1917  * Validator code that checks for one of a set of three
1918  * required attributes, content, or singletons.
1919  *
1920  * @param cname     the name of the XMLObject specialization
1921  * @param proper1   the proper name of the first attribute, content, or singleton member
1922  * @param proper2   the proper name of the second attribute, content, or singleton member
1923  * @param proper3   the proper name of the third attribute, content, or singleton member
1924  */
1925 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
1926     if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
1927         throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
1928
1929 /**
1930  * Validator code that checks for one of a set of three
1931  * required attributes, content, or singletons but disallows more than one.
1932  *
1933  * @param cname     the name of the XMLObject specialization
1934  * @param proper1   the proper name of the first attribute, content, or singleton member
1935  * @param proper2   the proper name of the second attribute, content, or singleton member
1936  * @param proper3   the proper name of the third attribute, content, or singleton member
1937  */
1938 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
1939     int c##proper1##proper2##proper3=0; \
1940     if (ptr->get##proper1()!=nullptr) \
1941         c##proper1##proper2##proper3++; \
1942     if (ptr->get##proper2()!=nullptr) \
1943         c##proper1##proper2##proper3++; \
1944     if (ptr->get##proper3()!=nullptr) \
1945         c##proper1##proper2##proper3++; \
1946     if (c##proper1##proper2##proper3 != 1) \
1947         throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
1948
1949 /**
1950  * Validator code that checks a co-constraint (if one present, the other must be)
1951  * between a pair of attributes, content, or singletons.
1952  *
1953  * @param cname     the name of the XMLObject specialization
1954  * @param proper1   the proper name of the first attribute, content, or singleton member
1955  * @param proper2   the proper name of the second attribute, content, or singleton member
1956  */
1957 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
1958     if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
1959         throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
1960
1961 /**
1962  * Validator code that checks for a non-empty collection.
1963  *
1964  * @param cname     the name of the XMLObject specialization
1965  * @param proper    the proper name of the collection item
1966  */
1967 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
1968     if (ptr->get##proper##s().empty()) \
1969         throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
1970
1971 /**
1972  * Declares/defines a Validator specialization that checks object type and
1973  * a non-empty simple content model.
1974  *
1975  * @param linkage   linkage specifier for the class
1976  * @param cname     the name of the XMLObject specialization
1977  */
1978 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
1979     BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
1980         XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
1981     END_XMLOBJECTVALIDATOR
1982
1983 #include <utility>
1984
1985 /**
1986  * @namespace xmltooling
1987  * Public namespace of XML Tooling library
1988  */
1989 namespace xmltooling {
1990
1991     /**
1992      * Template function for cloning a sequence of XMLObjects.
1993      * Invokes the clone() member on each element of the input sequence and adds the copy to
1994      * the output sequence. Order is preserved.
1995      *
1996      * @param in    input sequence to clone
1997      * @param out   output sequence to copy cloned pointers into
1998      */
1999     template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
2000         for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
2001             if (*i)
2002                 out.push_back((*i)->clone());
2003             else
2004                 out.push_back(*i);
2005         }
2006     }
2007
2008     /**
2009      * Functor for cleaning up heap objects in containers.
2010      */
2011     template<class T> struct cleanup
2012     {
2013         /**
2014          * Function operator to delete an object.
2015          *
2016          * @param ptr   object to delete
2017          */
2018         void operator()(T* ptr) {delete ptr;}
2019
2020         /**
2021          * Function operator to delete an object stored as const.
2022          *
2023          * @param ptr   object to delete after casting away const
2024          */
2025         void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
2026     };
2027
2028     /**
2029      * Functor for cleaning up heap objects in key/value containers.
2030      */
2031     template<class A,class B> struct cleanup_pair
2032     {
2033         /**
2034          * Function operator to delete an object.
2035          *
2036          * @param p   a pair in which the second component is the object to delete
2037          */
2038         void operator()(const std::pair<const A,B*>& p) {delete p.second;}
2039     };
2040
2041     /**
2042      * Functor for cleaning up const heap objects in key/value containers.
2043      */
2044     template<class A,class B> struct cleanup_const_pair
2045     {
2046         /**
2047          * Function operator to delete an object stored as const
2048          *
2049          * @param p   a pair in which the second component is the const object to delete
2050          */
2051         void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
2052     };
2053 };
2054
2055 #endif /* __xmltooling_base_h__ */