03930625769166b0e75ee75bdae69c3c6cc27b0f
[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             return make_pair((m_##proper!=nullptr),(m_##proper!=nullptr ? xercesc::XMLString::parseInt(m_##proper): 0)); \
815         } \
816         void set##proper(const XMLCh* proper) { \
817             m_##proper = prepareForAssignment(m_##proper,proper); \
818         } \
819         void set##proper(int proper) { \
820             try { \
821                 std::string buf(boost::lexical_cast<std::string>(proper)); \
822                 xmltooling::auto_ptr_XMLCh widen(buf.c_str()); \
823                 set##proper(widen.get()); \
824             } \
825             catch (boost::bad_lexical_cast&) { \
826             } \
827         }
828
829 /**
830  * Implements get/set methods and a private member for a boolean XML attribute.
831  *
832  * @param proper    the proper name of the attribute
833  */
834 #define IMPL_BOOLEAN_ATTRIB(proper) \
835     protected: \
836         xmlconstants::xmltooling_bool_t m_##proper; \
837     public: \
838         xmlconstants::xmltooling_bool_t get##proper() const { \
839             return m_##proper; \
840         } \
841         void proper(xmlconstants::xmltooling_bool_t value) { \
842             if (m_##proper != value) { \
843                 releaseThisandParentDOM(); \
844                 m_##proper = value; \
845             } \
846         }
847
848 /**
849  * Implements get/set methods and a private member for a typed, qualified XML attribute.
850  *
851  * @param proper    the proper name of the attribute
852  * @param type      the attribute's data type
853  */
854 #define IMPL_XMLOBJECT_FOREIGN_ATTRIB(proper,type) \
855     protected: \
856     XMLCh* m_##proper##Prefix; \
857         type* m_##proper; \
858     public: \
859         const type* get##proper() const { \
860             return m_##proper; \
861         } \
862         void set##proper(const type* proper) { \
863             m_##proper = prepareForAssignment(m_##proper,proper); \
864             xercesc::XMLString::release(&m_##proper##Prefix); \
865             m_##proper##Prefix = nullptr; \
866         }
867
868 /**
869  * Declares abstract set method for a typed XML child object in a foreign namespace.
870  * The get method is omitted.
871  *
872  * @param proper    the proper name of the child type
873  * @param ns        the C++ namespace for the type
874  */
875 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
876     public: \
877         XMLTOOLING_DOXYGEN(Sets the proper child.) \
878         virtual void set##proper(ns::proper* child)=0
879
880 /**
881  * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
882  *
883  * @param proper    the proper name of the child type
884  * @param ns        the C++ namespace for the type
885  */
886 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
887     public: \
888         XMLTOOLING_DOXYGEN(Returns the proper child.) \
889         virtual ns::proper* get##proper() const=0; \
890         XMLTOOLING_DOXYGEN(Sets the proper child.) \
891         virtual void set##proper(ns::proper* child)=0
892
893 /**
894  * Declares abstract set method for a typed XML child object.
895  * The get method is omitted.
896  *
897  * @param proper    the proper name of the child type
898  */
899 #define DECL_INHERITED_TYPED_CHILD(proper) \
900     public: \
901         XMLTOOLING_DOXYGEN(Sets the proper child.) \
902         virtual void set##proper(proper* child)=0
903
904 /**
905  * Declares abstract get/set methods for a typed XML child object.
906  *
907  * @param proper    the proper name of the child type
908  */
909 #define DECL_TYPED_CHILD(proper) \
910     public: \
911         XMLTOOLING_DOXYGEN(Returns the proper child.) \
912         virtual proper* get##proper() const=0; \
913         XMLTOOLING_DOXYGEN(Sets the proper child.) \
914         virtual void set##proper(proper* child)=0
915
916 /**
917  * Declares abstract get/set methods for a generic XML child object.
918  *
919  * @param proper    the proper name of the child
920  */
921 #define DECL_XMLOBJECT_CHILD(proper) \
922     public: \
923         XMLTOOLING_DOXYGEN(Returns the proper child.) \
924         virtual xmltooling::XMLObject* get##proper() const=0; \
925         XMLTOOLING_DOXYGEN(Sets the proper child.) \
926         virtual void set##proper(xmltooling::XMLObject* child)=0
927
928
929 /**
930  * Implements get/set methods and a private list iterator member for a typed XML child object.
931  *
932  * @param proper    the proper name of the child type
933  */
934 #define IMPL_TYPED_CHILD(proper) \
935     protected: \
936         proper* m_##proper; \
937         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
938     public: \
939         proper* get##proper() const { \
940             return m_##proper; \
941         } \
942         void set##proper(proper* child) { \
943             prepareForAssignment(m_##proper,child); \
944             *m_pos_##proper = m_##proper = child; \
945         }
946
947 /**
948  * Implements get/set methods and a private list iterator member for
949  * a typed XML child object in a foreign namespace
950  *
951  * @param proper    the proper name of the child type
952  * @param ns        the C++ namespace for the type
953  */
954 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
955     protected: \
956         ns::proper* m_##proper; \
957         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
958     public: \
959         ns::proper* get##proper() const { \
960             return m_##proper; \
961         } \
962         void set##proper(ns::proper* child) { \
963             prepareForAssignment(m_##proper,child); \
964             *m_pos_##proper = m_##proper = child; \
965         }
966
967 /**
968  * Implements get/set methods and a private list iterator member for a generic XML child object.
969  *
970  * @param proper    the proper name of the child
971  */
972 #define IMPL_XMLOBJECT_CHILD(proper) \
973     protected: \
974         xmltooling::XMLObject* m_##proper; \
975         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
976     public: \
977         xmltooling::XMLObject* get##proper() const { \
978             return m_##proper; \
979         } \
980         void set##proper(xmltooling::XMLObject* child) { \
981             prepareForAssignment(m_##proper,child); \
982             *m_pos_##proper = m_##proper = child; \
983         }
984
985 /**
986  * Declares abstract get/set methods for a typed XML child collection.
987  *
988  * @param proper    the proper name of the child type
989  */
990 #define DECL_TYPED_CHILDREN(proper) \
991     public: \
992         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
993         virtual VectorOf(proper) get##proper##s()=0; \
994         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
995         virtual const std::vector<proper*>& get##proper##s() const=0
996
997 /**
998  * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
999  *
1000  * @param proper    the proper name of the child type
1001  * @param ns        the C++ namespace for the type
1002  */
1003 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
1004     public: \
1005         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
1006         virtual VectorOf(ns::proper) get##proper##s()=0; \
1007         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
1008         virtual const std::vector<ns::proper*>& get##proper##s() const=0
1009
1010 /**
1011  * Declares abstract get/set methods for a generic XML child collection.
1012  *
1013  * @param proper    the proper name of the child
1014  */
1015 #define DECL_XMLOBJECT_CHILDREN(proper) \
1016     public: \
1017         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
1018         virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
1019         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
1020         virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
1021
1022 /**
1023  * Implements get method and a private vector member for a typed XML child collection.
1024  *
1025  * @param proper    the proper name of the child type
1026  * @param fence     insertion fence for new objects of the child collection in backing list
1027  */
1028 #define IMPL_TYPED_CHILDREN(proper,fence) \
1029     protected: \
1030         std::vector<proper*> m_##proper##s; \
1031     public: \
1032         VectorOf(proper) get##proper##s() { \
1033             return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
1034         } \
1035         const std::vector<proper*>& get##proper##s() const { \
1036             return m_##proper##s; \
1037         }
1038
1039 /**
1040  * Implements get method and a private vector member for a typed XML child collection
1041  * in a foreign namespace.
1042  *
1043  * @param proper    the proper name of the child type
1044  * @param ns        the C++ namespace for the type
1045  * @param fence     insertion fence for new objects of the child collection in backing list
1046  */
1047 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
1048     protected: \
1049         std::vector<ns::proper*> m_##proper##s; \
1050     public: \
1051         VectorOf(ns::proper) get##proper##s() { \
1052             return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
1053         } \
1054         const std::vector<ns::proper*>& get##proper##s() const { \
1055             return m_##proper##s; \
1056         }
1057
1058 /**
1059  * Implements get method and a private vector member for a generic XML child collection.
1060  *
1061  * @param proper    the proper name of the child
1062  * @param fence     insertion fence for new objects of the child collection in backing list
1063  */
1064 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
1065     protected: \
1066         std::vector<xmltooling::XMLObject*> m_##proper##s; \
1067     public: \
1068         VectorOf(xmltooling::XMLObject) get##proper##s() { \
1069             return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
1070         } \
1071         const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
1072             return m_##proper##s; \
1073         }
1074
1075 /**
1076  * Implements marshalling for a string attribute
1077  *
1078  * @param proper        the proper name of the attribute
1079  * @param ucase         the upcased name of the attribute
1080  * @param namespaceURI  the XML namespace of the attribute
1081  */
1082 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
1083     if (m_##proper && *m_##proper) { \
1084         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1085     }
1086
1087 /**
1088  * Implements marshalling for a DateTime attribute
1089  *
1090  * @param proper        the proper name of the attribute
1091  * @param ucase         the upcased name of the attribute
1092  * @param namespaceURI  the XML namespace of the attribute
1093  */
1094 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
1095     if (m_##proper) { \
1096         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
1097     }
1098
1099 /**
1100  * Implements marshalling for an integer attribute
1101  *
1102  * @param proper        the proper name of the attribute
1103  * @param ucase         the upcased name of the attribute
1104  * @param namespaceURI  the XML namespace of the attribute
1105  */
1106 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
1107     if (m_##proper && *m_##proper) { \
1108         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1109     }
1110
1111 /**
1112  * Implements marshalling for a boolean attribute
1113  *
1114  * @param proper        the proper name of the attribute
1115  * @param ucase         the upcased name of the attribute
1116  * @param namespaceURI  the XML namespace of the attribute
1117  */
1118 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
1119     switch (m_##proper) { \
1120         case xmlconstants::XML_BOOL_TRUE: \
1121             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
1122             break; \
1123         case xmlconstants::XML_BOOL_ONE: \
1124             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
1125             break; \
1126         case xmlconstants::XML_BOOL_FALSE: \
1127             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
1128             break; \
1129         case xmlconstants::XML_BOOL_ZERO: \
1130             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
1131             break; \
1132         case xmlconstants::XML_BOOL_NULL: \
1133             break; \
1134     }
1135
1136 /**
1137  * Implements marshalling for a QName attribute
1138  *
1139  * @param proper        the proper name of the attribute
1140  * @param ucase         the upcased name of the attribute
1141  * @param namespaceURI  the XML namespace of the attribute
1142  */
1143 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
1144     if (m_##proper) { \
1145         xmltooling::auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
1146         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
1147     }
1148
1149 #ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
1150 /**
1151  * Implements marshalling for an ID attribute
1152  *
1153  * @param proper        the proper name of the attribute
1154  * @param ucase         the upcased name of the attribute
1155  * @param namespaceURI  the XML namespace of the attribute
1156  */
1157 # define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
1158     if (m_##proper && *m_##proper) { \
1159         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1160         domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, true); \
1161     }
1162 #else
1163 /**
1164  * Implements marshalling for an ID attribute
1165  *
1166  * @param proper        the proper name of the attribute
1167  * @param ucase         the upcased name of the attribute
1168  * @param namespaceURI  the XML namespace of the attribute
1169  */
1170 # define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
1171     if (m_##proper && *m_##proper) { \
1172         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1173         domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
1174     }
1175 #endif
1176
1177 /**
1178  * Implements unmarshalling process branch for a string attribute
1179  *
1180  * @param proper        the proper name of the attribute
1181  * @param ucase         the upcased name of the attribute
1182  * @param namespaceURI  the XML namespace of the attribute
1183  */
1184 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
1185     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1186         set##proper(attribute->getValue()); \
1187         return; \
1188     }
1189
1190 #ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
1191 /**
1192  * Implements unmarshalling process branch for an ID attribute
1193  *
1194  * @param proper        the proper name of the attribute
1195  * @param ucase         the upcased name of the attribute
1196  * @param namespaceURI  the XML namespace of the attribute
1197  */
1198 # define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
1199     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1200         set##proper(attribute->getValue()); \
1201         attribute->getOwnerElement()->setIdAttributeNode(attribute, true); \
1202         return; \
1203     }
1204 #else
1205 /**
1206  * Implements unmarshalling process branch for an ID attribute
1207  *
1208  * @param proper        the proper name of the attribute
1209  * @param ucase         the upcased name of the attribute
1210  * @param namespaceURI  the XML namespace of the attribute
1211  */
1212 # define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
1213     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1214         set##proper(attribute->getValue()); \
1215         attribute->getOwnerElement()->setIdAttributeNode(attribute); \
1216         return; \
1217     }
1218 #endif
1219
1220 /**
1221  * Implements unmarshalling process branch for a DateTime attribute
1222  *
1223  * @param proper        the proper name of the attribute
1224  * @param ucase         the upcased name of the attribute
1225  * @param namespaceURI  the XML namespace of the attribute
1226  */
1227 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
1228     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1229
1230 /**
1231  * Implements unmarshalling process branch for a DateTime attribute
1232  *
1233  * @param proper        the proper name of the attribute
1234  * @param ucase         the upcased name of the attribute
1235  * @param namespaceURI  the XML namespace of the attribute
1236  */
1237 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
1238     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1239         std::auto_ptr<xmltooling::QName> q(xmltooling::XMLHelper::getAttributeValueAsQName(attribute)); \
1240         set##proper(q.get()); \
1241         return; \
1242     }
1243
1244 /**
1245  * Implements unmarshalling process branch for an integer attribute
1246  *
1247  * @param proper        the proper name of the attribute
1248  * @param ucase         the upcased name of the attribute
1249  * @param namespaceURI  the XML namespace of the attribute
1250  */
1251 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
1252     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1253
1254 /**
1255  * Implements unmarshalling process branch for a boolean attribute
1256  *
1257  * @param proper        the proper name of the attribute
1258  * @param ucase         the upcased name of the attribute
1259  * @param namespaceURI  the XML namespace of the attribute
1260  */
1261 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
1262     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1263
1264 /**
1265  * Implements unmarshalling process branch for typed child collection element
1266  *
1267  * @param proper        the proper name of the child type
1268  * @param namespaceURI  the XML namespace of the child element
1269  * @param force         bypass use of hint and just cast down to check child
1270  */
1271 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
1272     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1273         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1274         if (typesafe) { \
1275             get##proper##s().push_back(typesafe); \
1276             return; \
1277         } \
1278     }
1279
1280 /**
1281  * Implements unmarshalling process branch for typed child collection element
1282  * in a foreign namespace.
1283  *
1284  * @param proper        the proper name of the child type
1285  * @param ns            the C++ namespace for the type
1286  * @param namespaceURI  the XML namespace of the child element
1287  * @param force         bypass use of hint and just cast down to check child
1288  */
1289 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
1290     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1291         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1292         if (typesafe) { \
1293             get##proper##s().push_back(typesafe); \
1294             return; \
1295         } \
1296     }
1297
1298 /**
1299  * Implements unmarshalling process branch for typed child singleton element
1300  *
1301  * @param proper        the proper name of the child type
1302  * @param namespaceURI  the XML namespace of the child element
1303  * @param force         bypass use of hint and just cast down to check child
1304  */
1305 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
1306     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1307         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1308         if (typesafe && !m_##proper) { \
1309             typesafe->setParent(this); \
1310             *m_pos_##proper = m_##proper = typesafe; \
1311             return; \
1312         } \
1313     }
1314
1315 /**
1316  * Implements unmarshalling process branch for typed child singleton element
1317  * in a foreign namespace.
1318  *
1319  * @param proper        the proper name of the child type
1320  * @param ns            the C++ namespace for the type
1321  * @param namespaceURI  the XML namespace of the child element
1322  * @param force         bypass use of hint and just cast down to check child
1323  */
1324 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
1325     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1326         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1327         if (typesafe && !m_##proper) { \
1328             typesafe->setParent(this); \
1329             *m_pos_##proper = m_##proper = typesafe; \
1330             return; \
1331         } \
1332     }
1333
1334 /**
1335  * Implements unmarshalling process branch for a generic child singleton element
1336  *
1337  * @param proper        the proper name of the child type
1338  * @param namespaceURI  the XML namespace of the child element
1339  */
1340 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
1341     if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1342         if (!m_##proper) { \
1343             childXMLObject->setParent(this); \
1344             *m_pos_##proper = m_##proper = childXMLObject; \
1345             return; \
1346         } \
1347     }
1348
1349 /**
1350  * Declares aliased get/set methods for named XML element simple content.
1351  *
1352  * @param proper    the proper name to label the element's content
1353  */
1354 #define DECL_SIMPLE_CONTENT(proper) \
1355     XMLTOOLING_DOXYGEN(Returns proper.) \
1356     const XMLCh* get##proper() const { \
1357         return getTextContent(); \
1358     } \
1359     XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1360     void set##proper(const XMLCh* proper) { \
1361         setTextContent(proper); \
1362     }
1363
1364 /**
1365  * Declares aliased get/set methods for named integer XML element content.
1366  *
1367  * @param proper    the proper name to label the element's content
1368  */
1369 #define DECL_INTEGER_CONTENT(proper) \
1370     XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
1371     std::pair<bool,int> get##proper() const { \
1372         return std::make_pair((getTextContent()!=nullptr), (getTextContent()!=nullptr ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \
1373     } \
1374     XMLTOOLING_DOXYGEN(Sets proper.) \
1375     void set##proper(int proper) { \
1376         try { \
1377             std::string buf(boost::lexical_cast<std::string>(proper)); \
1378             xmltooling::auto_ptr_XMLCh widen(buf.c_str()); \
1379             setTextContent(widen.get()); \
1380         } \
1381         catch (boost::bad_lexical_cast&) { \
1382         } \
1383     } \
1384     XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1385     void set##proper(const XMLCh* proper) { \
1386         setTextContent(proper); \
1387     }
1388
1389 /**
1390  * Implements cloning methods for an XMLObject specialization implementation class.
1391  *
1392  * @param cname the name of the XMLObject specialization
1393  */
1394 #define IMPL_XMLOBJECT_CLONE(cname) \
1395     cname* clone##cname() const { \
1396         return dynamic_cast<cname*>(clone()); \
1397     } \
1398     xmltooling::XMLObject* clone() const { \
1399         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1400         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1401         if (ret) { \
1402             domClone.release(); \
1403             return ret; \
1404         } \
1405         return new cname##Impl(*this); \
1406     }
1407
1408 /**
1409  * Implements cloning methods for an XMLObject specialization implementation class
1410  * that must override a base class clone method.
1411  *
1412  * @param cname the name of the XMLObject specialization
1413  * @param base  name of base type.
1414  */
1415 #define IMPL_XMLOBJECT_CLONE2(cname,base) \
1416     cname* clone##cname() const { \
1417         return dynamic_cast<cname*>(clone()); \
1418     } \
1419     base* clone##base() const { \
1420         return dynamic_cast<base*>(clone()); \
1421     } \
1422     xmltooling::XMLObject* clone() const { \
1423         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1424         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1425         if (ret) { \
1426             domClone.release(); \
1427             return ret; \
1428         } \
1429         return new cname##Impl(*this); \
1430     }
1431
1432 /**
1433  * Implements cloning methods for an XMLObject specialization implementation class that
1434  * needs two stage duplication to avoid invoking virtual methods during construction.
1435  *
1436  * @param cname the name of the XMLObject specialization
1437  */
1438 #define IMPL_XMLOBJECT_CLONE_EX(cname) \
1439     cname* clone##cname() const { \
1440         return dynamic_cast<cname*>(clone()); \
1441     } \
1442     xmltooling::XMLObject* clone() const { \
1443         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1444         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1445         if (ret) { \
1446             domClone.release(); \
1447             return ret; \
1448         } \
1449         std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
1450         ret2->_clone(*this); \
1451         return ret2.release(); \
1452     }
1453
1454 /**
1455  * Implements cloning methods for an XMLObject specialization implementation class that
1456  * needs two stage duplication to avoid invoking virtual methods during construction,
1457  * and must override a base class clone method.
1458  *
1459  * @param cname the name of the XMLObject specialization
1460  * @param base  name of base type
1461  */
1462 #define IMPL_XMLOBJECT_CLONE_EX2(cname,base) \
1463     cname* clone##cname() const { \
1464         return dynamic_cast<cname*>(clone()); \
1465     } \
1466     base* clone##base() const { \
1467         return dynamic_cast<base*>(clone()); \
1468     } \
1469     xmltooling::XMLObject* clone() const { \
1470         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1471         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1472         if (ret) { \
1473             domClone.release(); \
1474             return ret; \
1475         } \
1476         std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
1477         ret2->_clone(*this); \
1478         return ret2.release(); \
1479     }
1480
1481 /**
1482  * Implements cloning of a child attribute, for use in copy constructor or
1483  * deferred clone methods.
1484  *
1485  * proper   the proper name of the attribute to clone
1486  */
1487 #define IMPL_CLONE_ATTRIB(proper) \
1488     set##proper(src.get##proper())
1489
1490 /**
1491  * Implements cloning of a child attribute in a foreign namespace, for use in copy constructor or
1492  * deferred clone methods.
1493  *
1494  * proper   the proper name of the attribute to clone
1495  */
1496 #define IMPL_CLONE_FOREIGN_ATTRIB(proper) \
1497     set##proper(src.get##proper()); \
1498     if (src.m_##proper##Prefix) \
1499         m_##proper##Prefix = xercesc::XMLString::replicate(src.m_##proper##Prefix)
1500
1501 /**
1502  * Implements cloning of an integer child attribute, for use in copy constructor or
1503  * deferred clone methods.
1504  *
1505  * proper   the proper name of the attribute to clone
1506  */
1507 #define IMPL_CLONE_INTEGER_ATTRIB(proper) \
1508     set##proper(src.m_##proper)
1509
1510 /**
1511  * Implements cloning of a boolean child attribute, for use in copy constructor or
1512  * deferred clone methods.
1513  *
1514  * proper   the proper name of the attribute to clone
1515  */
1516 #define IMPL_CLONE_BOOLEAN_ATTRIB(proper) \
1517     proper(src.m_##proper)
1518
1519 /**
1520  * Implements cloning of a child object, for use in copy constructor or
1521  * deferred clone methods.
1522  *
1523  * proper   the proper name of the child object to clone
1524  */
1525 #define IMPL_CLONE_XMLOBJECT_CHILD(proper) \
1526     if (src.get##proper()) \
1527         set##proper(src.get##proper()->clone())
1528
1529 /**
1530  * Implements cloning of a typed child object, for use in copy constructor or
1531  * deferred clone methods.
1532  *
1533  * proper   the proper name of the child type to clone
1534  */
1535 #define IMPL_CLONE_TYPED_CHILD(proper) \
1536     if (src.get##proper()) \
1537         set##proper(src.get##proper()->clone##proper())
1538
1539 /**
1540  * Implements cloning of an untyped child collection, for use in copy constructor or
1541  * deferred clone methods.
1542  *
1543  * proper   the proper name of the child type to clone
1544  */
1545 #define IMPL_CLONE_XMLOBJECT_CHILDREN(proper) \
1546     static void (VectorOf(XMLObject)::* XMLObject_push_back)(XMLObject* const&) = &VectorOf(XMLObject)::push_back; \
1547     VectorOf(XMLObject) c##proper = get##proper##s(); \
1548     std::for_each( \
1549         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1550         boost::lambda::if_(boost::lambda::_1 != ((XMLObject*)nullptr)) \
1551             [boost::lambda::bind(XMLObject_push_back, boost::ref(c##proper), boost::lambda::bind(&XMLObject::clone, boost::lambda::_1))] \
1552         )
1553
1554 /**
1555  * Implements cloning of a child collection, for use in copy constructor or
1556  * deferred clone methods.
1557  *
1558  * proper   the proper name of the child type to clone
1559  */
1560 #define IMPL_CLONE_TYPED_CHILDREN(proper) \
1561     static void (VectorOf(proper)::* proper##_push_back)(proper* const&) = &VectorOf(proper)::push_back; \
1562     VectorOf(proper) c##proper = get##proper##s(); \
1563     std::for_each( \
1564         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1565         boost::lambda::if_(boost::lambda::_1 != ((proper*)nullptr)) \
1566             [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&proper::clone##proper, boost::lambda::_1))] \
1567         )
1568
1569 /**
1570  * Implements cloning of a child collection in a foreign namespace, for use in copy constructor or
1571  * deferred clone methods.
1572  *
1573  * proper   the proper name of the child type to clone
1574  * ns       the namespace of the child type
1575  */
1576 #define IMPL_CLONE_TYPED_FOREIGN_CHILDREN(proper,ns) \
1577     static void (VectorOf(ns::proper)::* proper##_push_back)(ns::proper* const&) = &VectorOf(ns::proper)::push_back; \
1578     VectorOf(ns::proper) c##proper = get##proper##s(); \
1579     std::for_each( \
1580         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1581         boost::lambda::if_(boost::lambda::_1 != ((ns::proper*)nullptr)) \
1582             [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&ns::proper::clone##proper, boost::lambda::_1))] \
1583         )
1584
1585 /**
1586  * Opens an iteration loop over all of the children of an object.
1587  */
1588 #define IMPL_CLONE_CHILDBAG_BEGIN \
1589     for (list<xmltooling::XMLObject*>::const_iterator _bagit = src.m_children.begin(); _bagit != src.m_children.end(); ++_bagit) {
1590
1591 /**
1592  * Closes an iteration loop over all of the children of an object.
1593  */
1594 #define IMPL_CLONE_CHILDBAG_END }
1595
1596 /**
1597  * Implements cloning of a typed child in a bag iteration loop based on a cast check.
1598  *
1599  * @param proper    the proper name of the child type to clone
1600  */
1601 #define IMPL_CLONE_TYPED_CHILD_IN_BAG(proper) \
1602     proper* _##proper##cast = dynamic_cast<proper*>(*_bagit); \
1603     if (_##proper##cast) { \
1604         get##proper##s().push_back(_##proper##cast->clone##proper()); \
1605         continue; \
1606     }
1607
1608 /**
1609  * Implements cloning of a typed child in a forign namespace in a bag iteration loop based on a cast check.
1610  *
1611  * @param proper    the proper name of the child type to clone
1612  * @param ns        the namespace of the child type
1613  */
1614 #define IMPL_CLONE_TYPED_FOREIGN_CHILD_IN_BAG(proper,ns) \
1615     ns::proper* _##proper##cast = dynamic_cast<ns::proper*>(*_bagit); \
1616     if (_##proper##cast) { \
1617         get##proper##s().push_back(_##proper##cast->clone##proper()); \
1618         continue; \
1619     }
1620
1621 /**
1622  * Implements cloning of an XMLObject child in a bag iteration loop.
1623  *
1624  * @param proper    the proper name of the child to clone
1625  */
1626 #define IMPL_CLONE_XMLOBJECT_CHILD_IN_BAG(proper) \
1627     if (*_bagit) { \
1628         get##proper##s().push_back((*_bagit)->clone()); \
1629     }
1630
1631 /**
1632  * Declares an XMLObject specialization with a simple content model and type,
1633  * handling it as string data.
1634  *
1635  * @param linkage   linkage specifier for the class
1636  * @param cname     the name of the XMLObject specialization
1637  * @param proper    the proper name to label the element's content
1638  * @param desc      documentation for class
1639  */
1640 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
1641     BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
1642         DECL_SIMPLE_CONTENT(proper); \
1643     END_XMLOBJECT
1644
1645 /**
1646  * Declares and defines an implementation class for an XMLObject with
1647  * a simple content model and type, handling it as string data.
1648  *
1649  * @param linkage   linkage specifier for the class
1650  * @param cname     the name of the XMLObject specialization
1651  */
1652 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
1653     class linkage cname##Impl \
1654         : public virtual cname, \
1655             public xmltooling::AbstractSimpleElement, \
1656             public xmltooling::AbstractDOMCachingXMLObject, \
1657             public xmltooling::AbstractXMLObjectMarshaller, \
1658             public xmltooling::AbstractXMLObjectUnmarshaller \
1659     { \
1660     public: \
1661         virtual ~cname##Impl() {} \
1662         cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) \
1663             : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
1664         } \
1665         cname##Impl(const cname##Impl& src) \
1666             : xmltooling::AbstractXMLObject(src), \
1667                 xmltooling::AbstractSimpleElement(src), \
1668                 xmltooling::AbstractDOMCachingXMLObject(src) {} \
1669         IMPL_XMLOBJECT_CLONE(cname) \
1670     }
1671
1672 #ifdef HAVE_COVARIANT_RETURNS
1673
1674 /**
1675  * Begins the declaration of an XMLObjectBuilder specialization.
1676  * Basic boilerplate includes an empty virtual destructor, and
1677  * a default builder that defaults the element name.
1678  *
1679  * @param linkage           linkage specifier for the class
1680  * @param cname             the name of the XMLObject specialization
1681  * @param namespaceURI      the XML namespace of the default associated element
1682  * @param namespacePrefix   the XML namespace prefix of the default associated element
1683  */
1684 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1685     XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1686     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1687     public: \
1688         virtual ~cname##Builder() {} \
1689         XMLTOOLING_DOXYGEN(Default builder.) \
1690         virtual cname* buildObject() const { \
1691             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1692         } \
1693         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1694         virtual cname* buildObject( \
1695             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \
1696             ) const
1697
1698 /**
1699  * Ends the declaration of an XMLObjectBuilder specialization.
1700  */
1701 #define END_XMLOBJECTBUILDER }
1702
1703 /**
1704  * Declares a generic XMLObjectBuilder specialization.
1705  *
1706  * @param linkage           linkage specifier for the class
1707  * @param cname             the name of the XMLObject specialization
1708  * @param namespaceURI      the XML namespace of the default associated element
1709  * @param namespacePrefix   the XML namespace prefix of the default associated element
1710  */
1711  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1712     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1713     XMLTOOLING_DOXYGEN(Singleton builder.) \
1714     static cname* build##cname() { \
1715         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1716             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1717             ); \
1718         if (b) \
1719             return b->buildObject(); \
1720         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1721     } \
1722     END_XMLOBJECTBUILDER
1723
1724 /**
1725  * Implements the standard XMLObjectBuilder specialization function.
1726  *
1727  * @param cname the name of the XMLObject specialization
1728  */
1729 #define IMPL_XMLOBJECTBUILDER(cname) \
1730     cname* cname##Builder::buildObject( \
1731         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \
1732         ) const \
1733     { \
1734         return new cname##Impl(nsURI,localName,prefix,schemaType); \
1735     }
1736
1737 #else   /* !HAVE_COVARIANT_RETURNS */
1738
1739 /**
1740  * Begins the declaration of an XMLObjectBuilder specialization.
1741  * Basic boilerplate includes an empty virtual destructor, and
1742  * a default builder that defaults the element name.
1743  *
1744  * @param linkage           linkage specifier for the class
1745  * @param cname             the name of the XMLObject specialization
1746  * @param namespaceURI      the XML namespace of the default associated element
1747  * @param namespacePrefix   the XML namespace prefix of the default associated element
1748  */
1749 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1750     XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1751     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1752     public: \
1753         virtual ~cname##Builder() {} \
1754         XMLTOOLING_DOXYGEN(Default builder.) \
1755         virtual xmltooling::XMLObject* buildObject() const { \
1756             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1757         } \
1758         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1759         virtual xmltooling::XMLObject* buildObject( \
1760             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \
1761             ) const
1762
1763 /**
1764  * Ends the declaration of an XMLObjectBuilder specialization.
1765  */
1766 #define END_XMLOBJECTBUILDER }
1767
1768 /**
1769  * Declares a generic XMLObjectBuilder specialization.
1770  *
1771  * @param linkage           linkage specifier for the class
1772  * @param cname             the name of the XMLObject specialization
1773  * @param namespaceURI      the XML namespace of the default associated element
1774  * @param namespacePrefix   the XML namespace prefix of the default associated element
1775  */
1776  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1777     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1778     XMLTOOLING_DOXYGEN(Singleton builder.) \
1779     static cname* build##cname() { \
1780         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1781             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1782             ); \
1783         if (b) \
1784             return dynamic_cast<cname*>(b->buildObject()); \
1785         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1786     } \
1787     END_XMLOBJECTBUILDER
1788
1789 /**
1790  * Implements the standard XMLObjectBuilder specialization function.
1791  *
1792  * @param cname the name of the XMLObject specialization
1793  */
1794 #define IMPL_XMLOBJECTBUILDER(cname) \
1795     xmltooling::XMLObject* cname##Builder::buildObject( \
1796         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \
1797         ) const \
1798     { \
1799         return new cname##Impl(nsURI,localName,prefix,schemaType); \
1800     }
1801
1802 #endif  /* HAVE_COVARIANT_RETURNS */
1803
1804 /**
1805  * Begins the declaration of a Schema Validator specialization.
1806  *
1807  * @param linkage           linkage specifier for the class
1808  * @param cname the base name of the Validator specialization
1809  */
1810  #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
1811     class linkage cname##SchemaValidator : public xmltooling::Validator \
1812     { \
1813     public: \
1814         virtual ~cname##SchemaValidator() {} \
1815         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1816             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1817             if (!ptr) \
1818                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name())); \
1819             if (ptr->nil() && (ptr->hasChildren() || ptr->getTextContent())) \
1820                 throw xmltooling::ValidationException("Object has nil property but with children or content.")
1821
1822 /**
1823  * Begins the declaration of a Schema Validator specialization subclass.
1824  *
1825  * @param linkage   linkage specifier for the class
1826  * @param cname     the base name of the Validator specialization
1827  * @param base      base class for the validator
1828  */
1829  #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
1830     class linkage cname##SchemaValidator : public base##SchemaValidator \
1831     { \
1832     public: \
1833         virtual ~cname##SchemaValidator() {} \
1834         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1835             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1836             if (!ptr) \
1837                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()));
1838
1839 /**
1840  * Ends the declaration of a Validator specialization.
1841  */
1842 #define END_XMLOBJECTVALIDATOR } }
1843
1844 /**
1845  * Validator code that checks the object type.
1846  *
1847  * @param cname     the name of the XMLObject specialization
1848  */
1849 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
1850     const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1851     if (!ptr) \
1852         throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1853
1854 /**
1855  * Validator code that checks for a required attribute, content, or singleton.
1856  *
1857  * @param cname     the name of the XMLObject specialization
1858  * @param proper    the proper name of the attribute, content, or singleton member
1859  */
1860 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
1861     if (!ptr->get##proper()) \
1862         throw xmltooling::ValidationException(#cname" must have "#proper".")
1863
1864 /**
1865  * Validator code that checks for a required integer attribute
1866  *
1867  * @param cname     the name of the XMLObject specialization
1868  * @param proper    the proper name of the attribute, content, or singleton member
1869  */
1870 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
1871     if (!ptr->get##proper().first) \
1872         throw xmltooling::ValidationException(#cname" must have "#proper".")
1873
1874 /**
1875  * Validator code that checks for one of a pair of
1876  * required attributes, content, or singletons.
1877  *
1878  * @param cname     the name of the XMLObject specialization
1879  * @param proper1   the proper name of the first attribute, content, or singleton member
1880  * @param proper2   the proper name of the second attribute, content, or singleton member
1881  */
1882 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
1883     if (!ptr->get##proper1() && !ptr->get##proper2()) \
1884         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
1885
1886 /**
1887  * Validator code that checks for one of a pair of
1888  * required attributes, content, or singletons, but disallows both.
1889  *
1890  * @param cname     the name of the XMLObject specialization
1891  * @param proper1   the proper name of the first attribute, content, or singleton member
1892  * @param proper2   the proper name of the second attribute, content, or singleton member
1893  */
1894 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
1895     if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
1896         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
1897
1898 /**
1899  * Validator code that checks for one of a set of three
1900  * required attributes, content, or singletons.
1901  *
1902  * @param cname     the name of the XMLObject specialization
1903  * @param proper1   the proper name of the first attribute, content, or singleton member
1904  * @param proper2   the proper name of the second attribute, content, or singleton member
1905  * @param proper3   the proper name of the third attribute, content, or singleton member
1906  */
1907 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
1908     if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
1909         throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
1910
1911 /**
1912  * Validator code that checks for one of a set of three
1913  * required attributes, content, or singletons but disallows more than one.
1914  *
1915  * @param cname     the name of the XMLObject specialization
1916  * @param proper1   the proper name of the first attribute, content, or singleton member
1917  * @param proper2   the proper name of the second attribute, content, or singleton member
1918  * @param proper3   the proper name of the third attribute, content, or singleton member
1919  */
1920 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
1921     int c##proper1##proper2##proper3=0; \
1922     if (ptr->get##proper1()!=nullptr) \
1923         c##proper1##proper2##proper3++; \
1924     if (ptr->get##proper2()!=nullptr) \
1925         c##proper1##proper2##proper3++; \
1926     if (ptr->get##proper3()!=nullptr) \
1927         c##proper1##proper2##proper3++; \
1928     if (c##proper1##proper2##proper3 != 1) \
1929         throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
1930
1931 /**
1932  * Validator code that checks a co-constraint (if one present, the other must be)
1933  * between a pair of attributes, content, or singletons.
1934  *
1935  * @param cname     the name of the XMLObject specialization
1936  * @param proper1   the proper name of the first attribute, content, or singleton member
1937  * @param proper2   the proper name of the second attribute, content, or singleton member
1938  */
1939 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
1940     if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
1941         throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
1942
1943 /**
1944  * Validator code that checks for a non-empty collection.
1945  *
1946  * @param cname     the name of the XMLObject specialization
1947  * @param proper    the proper name of the collection item
1948  */
1949 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
1950     if (ptr->get##proper##s().empty()) \
1951         throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
1952
1953 /**
1954  * Declares/defines a Validator specialization that checks object type and
1955  * a non-empty simple content model.
1956  *
1957  * @param linkage   linkage specifier for the class
1958  * @param cname     the name of the XMLObject specialization
1959  */
1960 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
1961     BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
1962         XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
1963     END_XMLOBJECTVALIDATOR
1964
1965 #include <utility>
1966
1967 /**
1968  * @namespace xmltooling
1969  * Public namespace of XML Tooling library
1970  */
1971 namespace xmltooling {
1972
1973     /**
1974      * Template function for cloning a sequence of XMLObjects.
1975      * Invokes the clone() member on each element of the input sequence and adds the copy to
1976      * the output sequence. Order is preserved.
1977      *
1978      * @param in    input sequence to clone
1979      * @param out   output sequence to copy cloned pointers into
1980      */
1981     template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
1982         for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
1983             if (*i)
1984                 out.push_back((*i)->clone());
1985             else
1986                 out.push_back(*i);
1987         }
1988     }
1989
1990     /**
1991      * Functor for cleaning up heap objects in containers.
1992      */
1993     template<class T> struct cleanup
1994     {
1995         /**
1996          * Function operator to delete an object.
1997          *
1998          * @param ptr   object to delete
1999          */
2000         void operator()(T* ptr) {delete ptr;}
2001
2002         /**
2003          * Function operator to delete an object stored as const.
2004          *
2005          * @param ptr   object to delete after casting away const
2006          */
2007         void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
2008     };
2009
2010     /**
2011      * Functor for cleaning up heap objects in key/value containers.
2012      */
2013     template<class A,class B> struct cleanup_pair
2014     {
2015         /**
2016          * Function operator to delete an object.
2017          *
2018          * @param p   a pair in which the second component is the object to delete
2019          */
2020         void operator()(const std::pair<const A,B*>& p) {delete p.second;}
2021     };
2022
2023     /**
2024      * Functor for cleaning up const heap objects in key/value containers.
2025      */
2026     template<class A,class B> struct cleanup_const_pair
2027     {
2028         /**
2029          * Function operator to delete an object stored as const
2030          *
2031          * @param p   a pair in which the second component is the const object to delete
2032          */
2033         void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
2034     };
2035 };
2036
2037 #endif /* __xmltooling_base_h__ */