2 * Copyright 2001-2007 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file xmltooling/base.h
20 * Base header file definitions
21 * Must be included prior to including any other header
24 #ifndef __xmltooling_base_h__
25 #define __xmltooling_base_h__
27 #if defined (_MSC_VER) || defined(__BORLANDC__)
28 #include <xmltooling/config_pub_win32.h>
30 #include <xmltooling/config_pub.h>
33 #ifdef XMLTOOLING_LITE
34 # define XMLTOOLING_NO_XMLSEC 1
37 // Windows and GCC4 Symbol Visibility Macros
39 #define XMLTOOL_IMPORT __declspec(dllimport)
40 #define XMLTOOL_EXPORT __declspec(dllexport)
41 #define XMLTOOL_DLLLOCAL
42 #define XMLTOOL_DLLPUBLIC
44 #define XMLTOOL_IMPORT
45 #ifdef GCC_HASCLASSVISIBILITY
46 #define XMLTOOL_EXPORT __attribute__ ((visibility("default")))
47 #define XMLTOOL_DLLLOCAL __attribute__ ((visibility("hidden")))
48 #define XMLTOOL_DLLPUBLIC __attribute__ ((visibility("default")))
50 #define XMLTOOL_EXPORT
51 #define XMLTOOL_DLLLOCAL
52 #define XMLTOOL_DLLPUBLIC
56 // Define XMLTOOL_API for DLL builds
57 #ifdef XMLTOOLING_EXPORTS
58 #define XMLTOOL_API XMLTOOL_EXPORT
60 #define XMLTOOL_API XMLTOOL_IMPORT
63 // Throwable classes must always be visible on GCC in all binaries
65 #define XMLTOOL_EXCEPTIONAPI(api) api
66 #elif defined(GCC_HASCLASSVISIBILITY)
67 #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT
69 #define XMLTOOL_EXCEPTIONAPI(api)
73 #define XMLTOOLING_DOXYGEN(desc) /##** desc */
75 #define XMLTOOLING_DOXYGEN(desc)
79 * Blocks copy c'tor and assignment operator for a class.
81 #define MAKE_NONCOPYABLE(type) \
84 type& operator=(const type&)
90 #define UNICODE_LITERAL_1(a) {xercesc::chLatin_##a, xercesc::chNull}
91 #define UNICODE_LITERAL_2(a,b) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chNull}
92 #define UNICODE_LITERAL_3(a,b,c) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chNull}
93 #define UNICODE_LITERAL_4(a,b,c,d) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chNull}
94 #define UNICODE_LITERAL_5(a,b,c,d,e) \
95 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chNull}
96 #define UNICODE_LITERAL_6(a,b,c,d,e,f) \
97 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chNull}
98 #define UNICODE_LITERAL_7(a,b,c,d,e,f,g) \
99 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chNull}
100 #define UNICODE_LITERAL_8(a,b,c,d,e,f,g,h) \
101 {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}
102 #define UNICODE_LITERAL_9(a,b,c,d,e,f,g,h,i) \
103 {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}
104 #define UNICODE_LITERAL_10(a,b,c,d,e,f,g,h,i,j) \
105 {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, \
106 xercesc::chLatin_##j, xercesc::chNull}
107 #define UNICODE_LITERAL_11(a,b,c,d,e,f,g,h,i,j,k) \
108 {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, \
109 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chNull}
110 #define UNICODE_LITERAL_12(a,b,c,d,e,f,g,h,i,j,k,l) \
111 {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, \
112 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chNull}
113 #define UNICODE_LITERAL_13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
114 {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, \
115 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chNull}
116 #define UNICODE_LITERAL_14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
117 {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, \
118 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chNull}
119 #define UNICODE_LITERAL_15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
120 {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, \
121 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chNull}
122 #define UNICODE_LITERAL_16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
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::chLatin_##i, \
124 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chNull}
125 #define UNICODE_LITERAL_17(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) \
126 {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, \
127 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}
128 #define UNICODE_LITERAL_18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) \
129 {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, \
130 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}
131 #define UNICODE_LITERAL_19(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) \
132 {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, \
133 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, \
134 xercesc::chLatin_##s, xercesc::chNull}
135 #define UNICODE_LITERAL_20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) \
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::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
138 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chNull}
139 #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) \
140 {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, \
141 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, \
142 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chNull}
143 #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) \
144 {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, \
145 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, \
146 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chNull}
147 #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) \
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::chLatin_##r, \
150 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chNull}
151 #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) \
152 {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, \
153 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, \
154 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chNull}
155 #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) \
156 {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, \
157 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, \
158 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chNull}
159 #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) \
160 {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, \
161 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, \
162 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}
163 #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) \
164 {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, \
165 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, \
166 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
167 xercesc::chLatin_##aa, xercesc::chNull}
168 #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) \
169 {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, \
170 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, \
171 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
172 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chNull}
173 #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) \
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::chLatin_##y, xercesc::chLatin_##z, \
177 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chNull}
178 #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) \
179 {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, \
180 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, \
181 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
182 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chNull}
183 #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) \
184 {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, \
185 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, \
186 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
187 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chNull}
188 #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) \
189 {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, \
190 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, \
191 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
192 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chNull}
193 #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) \
194 {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, \
195 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, \
196 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
197 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chNull}
198 #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) \
199 {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, \
200 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, \
201 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
202 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}
203 #endif /* DOXYGEN_SKIP */
206 * Begins the declaration of an XMLObject specialization for an abstract element/type.
207 * Basic boilerplate includes a protected constructor, empty virtual destructor,
208 * and Unicode constants for the default associated element's name and prefix.
210 * @param linkage linkage specifier for the class
211 * @param cname the name of the class to declare
212 * @param base the base class to derive from using public virtual inheritance
213 * @param desc documentation comment for class
215 #define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \
216 XMLTOOLING_DOXYGEN(desc) \
217 class linkage cname : public virtual base { \
221 virtual ~cname() {} \
222 XMLTOOLING_DOXYGEN(Element local name) \
223 static const XMLCh LOCAL_NAME[]; \
227 * Begins the declaration of an XMLObject specialization.
228 * Basic boilerplate includes a protected constructor, empty virtual destructor,
229 * and Unicode constants for the default associated element's name and prefix.
231 * @param linkage linkage specifier for the class
232 * @param cname the name of the class to declare
233 * @param base the base class to derive from using public virtual inheritance
234 * @param desc documentation comment for class
236 #define BEGIN_XMLOBJECT(linkage,cname,base,desc) \
237 XMLTOOLING_DOXYGEN(desc) \
238 class linkage cname : public virtual base { \
242 virtual ~cname() {} \
243 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
244 virtual cname* clone##cname() const=0; \
245 XMLTOOLING_DOXYGEN(Element local name) \
246 static const XMLCh LOCAL_NAME[]
249 * Begins the declaration of an XMLObject specialization with two base classes.
250 * Basic boilerplate includes a protected constructor, empty virtual destructor,
251 * and Unicode constants for the default associated element's name and prefix.
253 * @param linkage linkage specifier for the class
254 * @param cname the name of the class to declare
255 * @param base the first base class to derive from using public virtual inheritance
256 * @param base2 the second base class to derive from using public virtual inheritance
257 * @param desc documentation comment for class
259 #define BEGIN_XMLOBJECT2(linkage,cname,base,base2,desc) \
260 XMLTOOLING_DOXYGEN(desc) \
261 class linkage cname : public virtual base, public virtual base2 { \
265 virtual ~cname() {} \
266 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
267 virtual cname* clone##cname() const=0; \
268 XMLTOOLING_DOXYGEN(Element local name) \
269 static const XMLCh LOCAL_NAME[]
272 * Begins the declaration of an XMLObject specialization with three base classes.
273 * Basic boilerplate includes a protected constructor, empty virtual destructor,
274 * and Unicode constants for the default associated element's name and prefix.
276 * @param linkage linkage specifier for the class
277 * @param cname the name of the class to declare
278 * @param base the first base class to derive from using public virtual inheritance
279 * @param base2 the second base class to derive from using public virtual inheritance
280 * @param base3 the third base class to derive from using public virtual inheritance
281 * @param desc documentation comment for class
283 #define BEGIN_XMLOBJECT3(linkage,cname,base,base2,base3,desc) \
284 XMLTOOLING_DOXYGEN(desc) \
285 class linkage cname : public virtual base, public virtual base2, public virtual base3 { \
289 virtual ~cname() {} \
290 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
291 virtual cname* clone##cname() const=0; \
292 XMLTOOLING_DOXYGEN(Element local name) \
293 static const XMLCh LOCAL_NAME[]
296 * Begins the declaration of an XMLObject specialization with four base classes.
297 * Basic boilerplate includes a protected constructor, empty virtual destructor,
298 * and Unicode constants for the default associated element's name and prefix.
300 * @param linkage linkage specifier for the class
301 * @param cname the name of the class to declare
302 * @param base the first base class to derive from using public virtual inheritance
303 * @param base2 the second base class to derive from using public virtual inheritance
304 * @param base3 the third base class to derive from using public virtual inheritance
305 * @param base4 the fourth base class to derive from using public virtual inheritance
306 * @param desc documentation comment for class
308 #define BEGIN_XMLOBJECT4(linkage,cname,base,base2,base3,base4,desc) \
309 XMLTOOLING_DOXYGEN(desc) \
310 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4 { \
314 virtual ~cname() {} \
315 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
316 virtual cname* clone##cname() const=0; \
317 XMLTOOLING_DOXYGEN(Element local name) \
318 static const XMLCh LOCAL_NAME[]
321 * Begins the declaration of an XMLObject specialization with five base classes.
322 * Basic boilerplate includes a protected constructor, empty virtual destructor,
323 * and Unicode constants for the default associated element's name and prefix.
325 * @param linkage linkage specifier for the class
326 * @param cname the name of the class to declare
327 * @param base the first base class to derive from using public virtual inheritance
328 * @param base2 the second base class to derive from using public virtual inheritance
329 * @param base3 the third base class to derive from using public virtual inheritance
330 * @param base4 the fourth base class to derive from using public virtual inheritance
331 * @param base5 the fifth base class to derive from using public virtual inheritance
332 * @param desc documentation comment for class
334 #define BEGIN_XMLOBJECT5(linkage,cname,base,base2,base3,base4,base5,desc) \
335 XMLTOOLING_DOXYGEN(desc) \
336 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4, public virtual base5 { \
340 virtual ~cname() {} \
341 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
342 virtual cname* clone##cname() const=0; \
343 XMLTOOLING_DOXYGEN(Element local name) \
344 static const XMLCh LOCAL_NAME[]
347 * Ends the declaration of an XMLObject specialization.
349 #define END_XMLOBJECT }
352 * Declares a static variable holding the XMLObject's element QName.
354 #define DECL_ELEMENT_QNAME \
356 XMLTOOLING_DOXYGEN(Element QName) \
357 static xmltooling::QName ELEMENT_QNAME
360 * Declares a static variable holding the XMLObject's schema type QName.
362 #define DECL_TYPE_QNAME \
364 XMLTOOLING_DOXYGEN(Type QName) \
365 static xmltooling::QName TYPE_QNAME
368 * Implements a static variable holding an XMLObject's element QName.
370 * @param cname the name of the XMLObject specialization
371 * @param namespaceURI the XML namespace of the default associated element
372 * @param namespacePrefix the XML namespace prefix of the default associated element
374 #define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \
375 xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)
378 * Implements a static variable holding an XMLObject's schema type QName.
380 * @param cname the name of the XMLObject specialization
381 * @param namespaceURI the XML namespace of the default associated element
382 * @param namespacePrefix the XML namespace prefix of the default associated element
384 #define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \
385 xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)
388 * Declares abstract set method for a typed XML attribute.
389 * The get method is omitted.
391 * @param proper the proper name of the attribute
392 * @param upcased the upcased name of the attribute
393 * @param type the attribute's data type
395 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \
397 XMLTOOLING_DOXYGEN(proper attribute name) \
398 static const XMLCh upcased##_ATTRIB_NAME[]; \
399 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
400 virtual void set##proper(const type* proper)=0
403 * Declares abstract get/set methods for a typed XML attribute.
405 * @param proper the proper name of the attribute
406 * @param upcased the upcased name of the attribute
407 * @param type the attribute's data type
409 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \
411 XMLTOOLING_DOXYGEN(proper attribute name) \
412 static const XMLCh upcased##_ATTRIB_NAME[]; \
413 XMLTOOLING_DOXYGEN(Returns the proper attribute.) \
414 virtual const type* get##proper() const=0; \
415 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
416 virtual void set##proper(const type* proper)=0
419 * Declares abstract set method for a string XML attribute.
420 * The get method is omitted.
422 * @param proper the proper name of the attribute
423 * @param upcased the upcased name of the attribute
425 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \
426 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
429 * Declares abstract get/set methods for a string XML attribute.
431 * @param proper the proper name of the attribute
432 * @param upcased the upcased name of the attribute
434 #define DECL_STRING_ATTRIB(proper,upcased) \
435 DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
438 * Declares abstract set method for a DateTime XML attribute.
439 * The get method is omitted.
441 * @param proper the proper name of the attribute
442 * @param upcased the upcased name of the attribute
444 #define DECL_INHERITED_DATETIME_ATTRIB(proper,upcased) \
445 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
446 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
447 virtual void set##proper(time_t proper)=0; \
448 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
449 virtual void set##proper(const XMLCh* proper)=0
452 * Declares abstract get/set methods for a DateTime XML attribute.
454 * @param proper the proper name of the attribute
455 * @param upcased the upcased name of the attribute
457 #define DECL_DATETIME_ATTRIB(proper,upcased) \
458 DECL_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
459 XMLTOOLING_DOXYGEN(Returns the proper attribute in epoch form.) \
460 virtual time_t get##proper##Epoch() const=0; \
461 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
462 virtual void set##proper(time_t proper)=0; \
463 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
464 virtual void set##proper(const XMLCh* proper)=0
467 * Declares abstract set method for an integer XML attribute.
468 * The get method is omitted.
470 * @param proper the proper name of the attribute
471 * @param upcased the upcased name of the attribute
473 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \
475 XMLTOOLING_DOXYGEN(proper attribute name) \
476 static const XMLCh upcased##_ATTRIB_NAME[]; \
477 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
478 virtual void set##proper(const XMLCh* proper)=0; \
479 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
480 virtual void set##proper(int proper)=0
483 * Declares abstract get/set methods for an integer XML attribute.
485 * @param proper the proper name of the attribute
486 * @param upcased the upcased name of the attribute
488 #define DECL_INTEGER_ATTRIB(proper,upcased) \
490 XMLTOOLING_DOXYGEN(proper attribute name) \
491 static const XMLCh upcased##_ATTRIB_NAME[]; \
492 XMLTOOLING_DOXYGEN(Returns the proper attribute after a NULL indicator.) \
493 virtual std::pair<bool,int> get##proper() const=0; \
494 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
495 virtual void set##proper(const XMLCh* proper)=0; \
496 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
497 virtual void set##proper(int proper)=0
500 * Declares abstract get/set methods for a boolean XML attribute.
502 * @param proper the proper name of the attribute
503 * @param upcased the upcased name of the attribute
504 * @param def the default/presumed value, if no explicit value has been set
506 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \
508 XMLTOOLING_DOXYGEN(proper attribute name) \
509 static const XMLCh upcased##_ATTRIB_NAME[]; \
510 XMLTOOLING_DOXYGEN(Returns the proper attribute or def if not set.) \
511 bool proper() const { \
512 switch (get##proper()) { \
513 case xmlconstants::XML_BOOL_TRUE: \
514 case xmlconstants::XML_BOOL_ONE: \
516 case xmlconstants::XML_BOOL_FALSE: \
517 case xmlconstants::XML_BOOL_ZERO: \
523 XMLTOOLING_DOXYGEN(Returns the proper attribute as an explicit enumerated value.) \
524 virtual xmlconstants::xmltooling_bool_t get##proper() const=0; \
525 XMLTOOLING_DOXYGEN(Sets the proper attribute using an enumerated value.) \
526 virtual void proper(xmlconstants::xmltooling_bool_t value)=0; \
527 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
528 void proper(bool value) { \
529 proper(value ? xmlconstants::XML_BOOL_ONE : xmlconstants::XML_BOOL_ZERO); \
531 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \
532 void set##proper(const XMLCh* value) { \
535 case xercesc::chLatin_t: \
536 proper(xmlconstants::XML_BOOL_TRUE); \
538 case xercesc::chLatin_f: \
539 proper(xmlconstants::XML_BOOL_FALSE); \
541 case xercesc::chDigit_1: \
542 proper(xmlconstants::XML_BOOL_ONE); \
544 case xercesc::chDigit_0: \
545 proper(xmlconstants::XML_BOOL_ZERO); \
548 proper(xmlconstants::XML_BOOL_NULL); \
552 proper(xmlconstants::XML_BOOL_NULL); \
556 * Implements get/set methods and a private member for a typed XML attribute.
558 * @param proper the proper name of the attribute
559 * @param type the attribute's data type
561 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \
565 const type* get##proper() const { \
568 void set##proper(const type* proper) { \
569 m_##proper = prepareForAssignment(m_##proper,proper); \
573 * Implements get/set methods and a private member for a string XML attribute.
575 * @param proper the proper name of the attribute
577 #define IMPL_STRING_ATTRIB(proper) \
578 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)
581 * Implements get/set methods and a private member for a string XML attribute,
582 * plus a getXMLID override.
584 * @param proper the proper name of the attribute
586 #define IMPL_ID_ATTRIB(proper) \
587 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
588 const XMLCh* getXMLID() const { \
593 * Implements get/set methods and a private member for a DateTime XML attribute.
595 * @param proper the proper name of the attribute
596 * @param fallback epoch to return when attribute is NULL
598 #define IMPL_DATETIME_ATTRIB(proper,fallback) \
600 DateTime* m_##proper; \
601 time_t m_##proper##Epoch; \
603 const DateTime* get##proper() const { \
606 time_t get##proper##Epoch() const { \
607 return m_##proper ? m_##proper##Epoch : fallback; \
609 void set##proper(const DateTime* proper) { \
610 m_##proper = prepareForAssignment(m_##proper,proper); \
612 m_##proper##Epoch=m_##proper->getEpoch(); \
614 void set##proper(time_t proper) { \
615 m_##proper = prepareForAssignment(m_##proper,proper); \
616 m_##proper##Epoch = proper; \
618 void set##proper(const XMLCh* proper) { \
619 m_##proper = prepareForAssignment(m_##proper,proper); \
621 m_##proper##Epoch=m_##proper->getEpoch(); \
625 * Implements get/set methods and a private member for an integer XML attribute.
627 * @param proper the proper name of the attribute
629 #define IMPL_INTEGER_ATTRIB(proper) \
633 pair<bool,int> get##proper() const { \
634 return make_pair((m_##proper!=NULL),(m_##proper!=NULL ? xercesc::XMLString::parseInt(m_##proper): 0)); \
636 void set##proper(const XMLCh* proper) { \
637 m_##proper = prepareForAssignment(m_##proper,proper); \
639 void set##proper(int proper) { \
640 char buf##proper[64]; \
641 sprintf(buf##proper,"%d",proper); \
642 auto_ptr_XMLCh wide##proper(buf##proper); \
643 set##proper(wide##proper.get()); \
647 * Implements get/set methods and a private member for a boolean XML attribute.
649 * @param proper the proper name of the attribute
651 #define IMPL_BOOLEAN_ATTRIB(proper) \
653 xmlconstants::xmltooling_bool_t m_##proper; \
655 xmlconstants::xmltooling_bool_t get##proper() const { \
658 void proper(xmlconstants::xmltooling_bool_t value) { \
659 if (m_##proper != value) { \
660 releaseThisandParentDOM(); \
661 m_##proper = value; \
666 * Declares abstract set method for a typed XML child object in a foreign namespace.
667 * The get method is omitted.
669 * @param proper the proper name of the child type
670 * @param ns the C++ namespace for the type
672 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
674 XMLTOOLING_DOXYGEN(Sets the proper child.) \
675 virtual void set##proper(ns::proper* child)=0
678 * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
680 * @param proper the proper name of the child type
681 * @param ns the C++ namespace for the type
683 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
685 XMLTOOLING_DOXYGEN(Returns the proper child.) \
686 virtual ns::proper* get##proper() const=0; \
687 XMLTOOLING_DOXYGEN(Sets the proper child.) \
688 virtual void set##proper(ns::proper* child)=0
691 * Declares abstract set method for a typed XML child object.
692 * The get method is omitted.
694 * @param proper the proper name of the child type
696 #define DECL_INHERITED_TYPED_CHILD(proper) \
698 XMLTOOLING_DOXYGEN(Sets the proper child.) \
699 virtual void set##proper(proper* child)=0
702 * Declares abstract get/set methods for a typed XML child object.
704 * @param proper the proper name of the child type
706 #define DECL_TYPED_CHILD(proper) \
708 XMLTOOLING_DOXYGEN(Returns the proper child.) \
709 virtual proper* get##proper() const=0; \
710 XMLTOOLING_DOXYGEN(Sets the proper child.) \
711 virtual void set##proper(proper* child)=0
714 * Declares abstract get/set methods for a generic XML child object.
716 * @param proper the proper name of the child
718 #define DECL_XMLOBJECT_CHILD(proper) \
720 XMLTOOLING_DOXYGEN(Returns the proper child.) \
721 virtual xmltooling::XMLObject* get##proper() const=0; \
722 XMLTOOLING_DOXYGEN(Sets the proper child.) \
723 virtual void set##proper(xmltooling::XMLObject* child)=0
727 * Implements get/set methods and a private list iterator member for a typed XML child object.
729 * @param proper the proper name of the child type
731 #define IMPL_TYPED_CHILD(proper) \
733 proper* m_##proper; \
734 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
736 proper* get##proper() const { \
739 void set##proper(proper* child) { \
740 prepareForAssignment(m_##proper,child); \
741 *m_pos_##proper = m_##proper = child; \
745 * Implements get/set methods and a private list iterator member for
746 * a typed XML child object in a foreign namespace
748 * @param proper the proper name of the child type
749 * @param ns the C++ namespace for the type
751 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
753 ns::proper* m_##proper; \
754 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
756 ns::proper* get##proper() const { \
759 void set##proper(ns::proper* child) { \
760 prepareForAssignment(m_##proper,child); \
761 *m_pos_##proper = m_##proper = child; \
765 * Implements get/set methods and a private list iterator member for a generic XML child object.
767 * @param proper the proper name of the child
769 #define IMPL_XMLOBJECT_CHILD(proper) \
771 xmltooling::XMLObject* m_##proper; \
772 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
774 xmltooling::XMLObject* get##proper() const { \
777 void set##proper(xmltooling::XMLObject* child) { \
778 prepareForAssignment(m_##proper,child); \
779 *m_pos_##proper = m_##proper = child; \
783 * Declares abstract get/set methods for a typed XML child collection.
785 * @param proper the proper name of the child type
787 #define DECL_TYPED_CHILDREN(proper) \
789 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
790 virtual VectorOf(proper) get##proper##s()=0; \
791 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
792 virtual const std::vector<proper*>& get##proper##s() const=0
795 * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
797 * @param proper the proper name of the child type
798 * @param ns the C++ namespace for the type
800 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
802 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
803 virtual VectorOf(ns::proper) get##proper##s()=0; \
804 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
805 virtual const std::vector<ns::proper*>& get##proper##s() const=0
808 * Declares abstract get/set methods for a generic XML child collection.
810 * @param proper the proper name of the child
812 #define DECL_XMLOBJECT_CHILDREN(proper) \
814 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
815 virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
816 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
817 virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
820 * Implements get method and a private vector member for a typed XML child collection.
822 * @param proper the proper name of the child type
823 * @param fence insertion fence for new objects of the child collection in backing list
825 #define IMPL_TYPED_CHILDREN(proper,fence) \
827 std::vector<proper*> m_##proper##s; \
829 VectorOf(proper) get##proper##s() { \
830 return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
832 const std::vector<proper*>& get##proper##s() const { \
833 return m_##proper##s; \
837 * Implements get method and a private vector member for a typed XML child collection
838 * in a foreign namespace.
840 * @param proper the proper name of the child type
841 * @param ns the C++ namespace for the type
842 * @param fence insertion fence for new objects of the child collection in backing list
844 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
846 std::vector<ns::proper*> m_##proper##s; \
848 VectorOf(ns::proper) get##proper##s() { \
849 return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
851 const std::vector<ns::proper*>& get##proper##s() const { \
852 return m_##proper##s; \
856 * Implements get method and a private vector member for a generic XML child collection.
858 * @param proper the proper name of the child
859 * @param fence insertion fence for new objects of the child collection in backing list
861 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
863 std::vector<xmltooling::XMLObject*> m_##proper##s; \
865 VectorOf(xmltooling::XMLObject) get##proper##s() { \
866 return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
868 const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
869 return m_##proper##s; \
873 * Implements marshalling for a string attribute
875 * @param proper the proper name of the attribute
876 * @param ucase the upcased name of the attribute
877 * @param namespaceURI the XML namespace of the attribute
879 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
880 if (m_##proper && *m_##proper) { \
881 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
885 * Implements marshalling for a DateTime attribute
887 * @param proper the proper name of the attribute
888 * @param ucase the upcased name of the attribute
889 * @param namespaceURI the XML namespace of the attribute
891 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
893 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
897 * Implements marshalling for an integer attribute
899 * @param proper the proper name of the attribute
900 * @param ucase the upcased name of the attribute
901 * @param namespaceURI the XML namespace of the attribute
903 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
904 if (m_##proper && *m_##proper) { \
905 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
909 * Implements marshalling for a boolean attribute
911 * @param proper the proper name of the attribute
912 * @param ucase the upcased name of the attribute
913 * @param namespaceURI the XML namespace of the attribute
915 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
916 switch (m_##proper) { \
917 case xmlconstants::XML_BOOL_TRUE: \
918 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
920 case xmlconstants::XML_BOOL_ONE: \
921 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
923 case xmlconstants::XML_BOOL_FALSE: \
924 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
926 case xmlconstants::XML_BOOL_ZERO: \
927 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
929 case xmlconstants::XML_BOOL_NULL: \
934 * Implements marshalling for a QName attribute
936 * @param proper the proper name of the attribute
937 * @param ucase the upcased name of the attribute
938 * @param namespaceURI the XML namespace of the attribute
940 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
942 auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
943 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
947 * Implements marshalling for an ID attribute
949 * @param proper the proper name of the attribute
950 * @param ucase the upcased name of the attribute
951 * @param namespaceURI the XML namespace of the attribute
953 #define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
954 if (m_##proper && *m_##proper) { \
955 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
956 domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
960 * Implements unmarshalling process branch for a string attribute
962 * @param proper the proper name of the attribute
963 * @param ucase the upcased name of the attribute
964 * @param namespaceURI the XML namespace of the attribute
966 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
967 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
968 set##proper(attribute->getValue()); \
973 * Implements unmarshalling process branch for an ID attribute
975 * @param proper the proper name of the attribute
976 * @param ucase the upcased name of the attribute
977 * @param namespaceURI the XML namespace of the attribute
979 #define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
980 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
981 set##proper(attribute->getValue()); \
982 attribute->getOwnerElement()->setIdAttributeNode(attribute); \
987 * Implements unmarshalling process branch for a DateTime attribute
989 * @param proper the proper name of the attribute
990 * @param ucase the upcased name of the attribute
991 * @param namespaceURI the XML namespace of the attribute
993 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
994 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
997 * Implements unmarshalling process branch for a DateTime attribute
999 * @param proper the proper name of the attribute
1000 * @param ucase the upcased name of the attribute
1001 * @param namespaceURI the XML namespace of the attribute
1003 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
1004 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1005 set##proper(XMLHelper::getAttributeValueAsQName(attribute)); \
1010 * Implements unmarshalling process branch for an integer attribute
1012 * @param proper the proper name of the attribute
1013 * @param ucase the upcased name of the attribute
1014 * @param namespaceURI the XML namespace of the attribute
1016 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
1017 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1020 * Implements unmarshalling process branch for a boolean attribute
1022 * @param proper the proper name of the attribute
1023 * @param ucase the upcased name of the attribute
1024 * @param namespaceURI the XML namespace of the attribute
1026 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
1027 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1030 * Implements unmarshalling process branch for typed child collection element
1032 * @param proper the proper name of the child type
1033 * @param namespaceURI the XML namespace of the child element
1034 * @param force bypass use of hint and just cast down to check child
1036 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
1037 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1038 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1040 get##proper##s().push_back(typesafe); \
1046 * Implements unmarshalling process branch for typed child collection element
1047 * in a foreign namespace.
1049 * @param proper the proper name of the child type
1050 * @param ns the C++ namespace for the type
1051 * @param namespaceURI the XML namespace of the child element
1052 * @param force bypass use of hint and just cast down to check child
1054 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
1055 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1056 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1058 get##proper##s().push_back(typesafe); \
1064 * Implements unmarshalling process branch for typed child singleton element
1066 * @param proper the proper name of the child type
1067 * @param namespaceURI the XML namespace of the child element
1068 * @param force bypass use of hint and just cast down to check child
1070 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
1071 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1072 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1073 if (typesafe && !m_##proper) { \
1074 typesafe->setParent(this); \
1075 *m_pos_##proper = m_##proper = typesafe; \
1081 * Implements unmarshalling process branch for typed child singleton element
1082 * in a foreign namespace.
1084 * @param proper the proper name of the child type
1085 * @param ns the C++ namespace for the type
1086 * @param namespaceURI the XML namespace of the child element
1087 * @param force bypass use of hint and just cast down to check child
1089 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
1090 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1091 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1092 if (typesafe && !m_##proper) { \
1093 typesafe->setParent(this); \
1094 *m_pos_##proper = m_##proper = typesafe; \
1100 * Implements unmarshalling process branch for a generic child singleton element
1102 * @param proper the proper name of the child type
1103 * @param namespaceURI the XML namespace of the child element
1105 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
1106 if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1107 if (!m_##proper) { \
1108 childXMLObject->setParent(this); \
1109 *m_pos_##proper = m_##proper = childXMLObject; \
1115 * Declares aliased get/set methods for named XML element simple content.
1117 * @param proper the proper name to label the element's content
1119 #define DECL_SIMPLE_CONTENT(proper) \
1120 XMLTOOLING_DOXYGEN(Returns proper.) \
1121 const XMLCh* get##proper() const { \
1122 return getTextContent(); \
1124 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1125 void set##proper(const XMLCh* proper) { \
1126 setTextContent(proper); \
1130 * Declares aliased get/set methods for named integer XML element content.
1132 * @param proper the proper name to label the element's content
1134 #define DECL_INTEGER_CONTENT(proper) \
1135 XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
1136 std::pair<bool,int> get##proper() const { \
1137 return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \
1139 XMLTOOLING_DOXYGEN(Sets proper.) \
1140 void set##proper(int proper) { \
1142 sprintf(buf,"%d",proper); \
1143 xmltooling::auto_ptr_XMLCh widebuf(buf); \
1144 setTextContent(widebuf.get()); \
1146 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1147 void set##proper(const XMLCh* proper) { \
1148 setTextContent(proper); \
1152 * Implements cloning methods for an XMLObject specialization implementation class.
1154 * @param cname the name of the XMLObject specialization
1156 #define IMPL_XMLOBJECT_CLONE(cname) \
1157 cname* clone##cname() const { \
1158 return dynamic_cast<cname*>(clone()); \
1160 xmltooling::XMLObject* clone() const { \
1161 std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1162 cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1164 domClone.release(); \
1167 return new cname##Impl(*this); \
1171 * Declares an XMLObject specialization with a simple content model and type,
1172 * handling it as string data.
1174 * @param linkage linkage specifier for the class
1175 * @param cname the name of the XMLObject specialization
1176 * @param proper the proper name to label the element's content
1177 * @param desc documentation for class
1179 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
1180 BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
1181 DECL_SIMPLE_CONTENT(proper); \
1185 * Declares and defines an implementation class for an XMLObject with
1186 * a simple content model and type, handling it as string data.
1188 * @param linkage linkage specifier for the class
1189 * @param cname the name of the XMLObject specialization
1191 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
1192 class linkage cname##Impl \
1193 : public virtual cname, \
1194 public xmltooling::AbstractSimpleElement, \
1195 public xmltooling::AbstractDOMCachingXMLObject, \
1196 public xmltooling::AbstractXMLObjectMarshaller, \
1197 public xmltooling::AbstractXMLObjectUnmarshaller \
1200 virtual ~cname##Impl() {} \
1201 cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \
1202 : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
1204 cname##Impl(const cname##Impl& src) \
1205 : xmltooling::AbstractXMLObject(src), \
1206 xmltooling::AbstractSimpleElement(src), \
1207 xmltooling::AbstractDOMCachingXMLObject(src) {} \
1208 IMPL_XMLOBJECT_CLONE(cname) \
1211 #ifdef HAVE_COVARIANT_RETURNS
1214 * Begins the declaration of an XMLObjectBuilder specialization.
1215 * Basic boilerplate includes an empty virtual destructor, and
1216 * a default builder that defaults the element name.
1218 * @param linkage linkage specifier for the class
1219 * @param cname the name of the XMLObject specialization
1220 * @param namespaceURI the XML namespace of the default associated element
1221 * @param namespacePrefix the XML namespace prefix of the default associated element
1223 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1224 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1225 class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1227 virtual ~cname##Builder() {} \
1228 XMLTOOLING_DOXYGEN(Default builder.) \
1229 virtual cname* buildObject() const { \
1230 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1232 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1233 virtual cname* buildObject( \
1234 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
1238 * Ends the declaration of an XMLObjectBuilder specialization.
1240 #define END_XMLOBJECTBUILDER }
1243 * Declares a generic XMLObjectBuilder specialization.
1245 * @param linkage linkage specifier for the class
1246 * @param cname the name of the XMLObject specialization
1247 * @param namespaceURI the XML namespace of the default associated element
1248 * @param namespacePrefix the XML namespace prefix of the default associated element
1250 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1251 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1252 XMLTOOLING_DOXYGEN(Singleton builder.) \
1253 static cname* build##cname() { \
1254 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1255 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1258 return b->buildObject(); \
1259 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1261 END_XMLOBJECTBUILDER
1264 * Implements the standard XMLObjectBuilder specialization function.
1266 * @param cname the name of the XMLObject specialization
1268 #define IMPL_XMLOBJECTBUILDER(cname) \
1269 cname* cname##Builder::buildObject( \
1270 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
1273 return new cname##Impl(nsURI,localName,prefix,schemaType); \
1276 #else /* !HAVE_COVARIANT_RETURNS */
1279 * Begins the declaration of an XMLObjectBuilder specialization.
1280 * Basic boilerplate includes an empty virtual destructor, and
1281 * a default builder that defaults the element name.
1283 * @param linkage linkage specifier for the class
1284 * @param cname the name of the XMLObject specialization
1285 * @param namespaceURI the XML namespace of the default associated element
1286 * @param namespacePrefix the XML namespace prefix of the default associated element
1288 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1289 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1290 class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1292 virtual ~cname##Builder() {} \
1293 XMLTOOLING_DOXYGEN(Default builder.) \
1294 virtual xmltooling::XMLObject* buildObject() const { \
1295 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1297 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1298 virtual xmltooling::XMLObject* buildObject( \
1299 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
1303 * Ends the declaration of an XMLObjectBuilder specialization.
1305 #define END_XMLOBJECTBUILDER }
1308 * Declares a generic XMLObjectBuilder specialization.
1310 * @param linkage linkage specifier for the class
1311 * @param cname the name of the XMLObject specialization
1312 * @param namespaceURI the XML namespace of the default associated element
1313 * @param namespacePrefix the XML namespace prefix of the default associated element
1315 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1316 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1317 XMLTOOLING_DOXYGEN(Singleton builder.) \
1318 static cname* build##cname() { \
1319 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1320 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1323 return dynamic_cast<cname*>(b->buildObject()); \
1324 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1326 END_XMLOBJECTBUILDER
1329 * Implements the standard XMLObjectBuilder specialization function.
1331 * @param cname the name of the XMLObject specialization
1333 #define IMPL_XMLOBJECTBUILDER(cname) \
1334 xmltooling::XMLObject* cname##Builder::buildObject( \
1335 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
1338 return new cname##Impl(nsURI,localName,prefix,schemaType); \
1341 #endif /* HAVE_COVARIANT_RETURNS */
1344 * Begins the declaration of a Schema Validator specialization.
1346 * @param linkage linkage specifier for the class
1347 * @param cname the base name of the Validator specialization
1349 #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
1350 class linkage cname##SchemaValidator : public xmltooling::Validator \
1353 virtual ~cname##SchemaValidator() {} \
1354 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1355 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1357 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name())); \
1358 if (ptr->nil() && (ptr->hasChildren() || ptr->getTextContent())) \
1359 throw xmltooling::ValidationException("Object has nil property but with children or content.")
1362 * Begins the declaration of a Schema Validator specialization subclass.
1364 * @param linkage linkage specifier for the class
1365 * @param cname the base name of the Validator specialization
1366 * @param base base class for the validator
1368 #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
1369 class linkage cname##SchemaValidator : public base##SchemaValidator \
1372 virtual ~cname##SchemaValidator() {} \
1373 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1374 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1376 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()));
1379 * Ends the declaration of a Validator specialization.
1381 #define END_XMLOBJECTVALIDATOR } }
1384 * Validator code that checks the object type.
1386 * @param cname the name of the XMLObject specialization
1388 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
1389 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1391 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1394 * Validator code that checks for a required attribute, content, or singleton.
1396 * @param cname the name of the XMLObject specialization
1397 * @param proper the proper name of the attribute, content, or singleton member
1399 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
1400 if (!ptr->get##proper()) \
1401 throw xmltooling::ValidationException(#cname" must have "#proper".")
1404 * Validator code that checks for a required integer attribute
1406 * @param cname the name of the XMLObject specialization
1407 * @param proper the proper name of the attribute, content, or singleton member
1409 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
1410 if (!ptr->get##proper().first) \
1411 throw xmltooling::ValidationException(#cname" must have "#proper".")
1414 * Validator code that checks for one of a pair of
1415 * required attributes, content, or singletons.
1417 * @param cname the name of the XMLObject specialization
1418 * @param proper1 the proper name of the first attribute, content, or singleton member
1419 * @param proper2 the proper name of the second attribute, content, or singleton member
1421 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
1422 if (!ptr->get##proper1() && !ptr->get##proper2()) \
1423 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
1426 * Validator code that checks for one of a pair of
1427 * required attributes, content, or singletons, but disallows both.
1429 * @param cname the name of the XMLObject specialization
1430 * @param proper1 the proper name of the first attribute, content, or singleton member
1431 * @param proper2 the proper name of the second attribute, content, or singleton member
1433 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
1434 if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
1435 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
1438 * Validator code that checks for one of a set of three
1439 * required attributes, content, or singletons.
1441 * @param cname the name of the XMLObject specialization
1442 * @param proper1 the proper name of the first attribute, content, or singleton member
1443 * @param proper2 the proper name of the second attribute, content, or singleton member
1444 * @param proper3 the proper name of the third attribute, content, or singleton member
1446 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
1447 if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
1448 throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
1451 * Validator code that checks for one of a set of three
1452 * required attributes, content, or singletons but disallows more than one.
1454 * @param cname the name of the XMLObject specialization
1455 * @param proper1 the proper name of the first attribute, content, or singleton member
1456 * @param proper2 the proper name of the second attribute, content, or singleton member
1457 * @param proper3 the proper name of the third attribute, content, or singleton member
1459 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
1460 int c##proper1##proper2##proper3=0; \
1461 if (ptr->get##proper1()!=NULL) \
1462 c##proper1##proper2##proper3++; \
1463 if (ptr->get##proper2()!=NULL) \
1464 c##proper1##proper2##proper3++; \
1465 if (ptr->get##proper3()!=NULL) \
1466 c##proper1##proper2##proper3++; \
1467 if (c##proper1##proper2##proper3 != 1) \
1468 throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
1471 * Validator code that checks a co-constraint (if one present, the other must be)
1472 * between a pair of attributes, content, or singletons.
1474 * @param cname the name of the XMLObject specialization
1475 * @param proper1 the proper name of the first attribute, content, or singleton member
1476 * @param proper2 the proper name of the second attribute, content, or singleton member
1478 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
1479 if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
1480 throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
1483 * Validator code that checks for a non-empty collection.
1485 * @param cname the name of the XMLObject specialization
1486 * @param proper the proper name of the collection item
1488 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
1489 if (ptr->get##proper##s().empty()) \
1490 throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
1493 * Declares/defines a Validator specialization that checks object type and
1494 * a non-empty simple content model.
1496 * @param linkage linkage specifier for the class
1497 * @param cname the name of the XMLObject specialization
1499 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
1500 BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
1501 XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
1502 END_XMLOBJECTVALIDATOR
1507 * @namespace xmltooling
1508 * Public namespace of XML Tooling library
1510 namespace xmltooling {
1513 * Template function for cloning a sequence of XMLObjects.
1514 * Invokes the clone() member on each element of the input sequence and adds the copy to
1515 * the output sequence. Order is preserved.
1517 * @param in input sequence to clone
1518 * @param out output sequence to copy cloned pointers into
1520 template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
1521 for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
1523 out.push_back((*i)->clone());
1530 * Functor for cleaning up heap objects in containers.
1532 template<class T> struct cleanup
1535 * Function operator to delete an object.
1537 * @param ptr object to delete
1539 void operator()(T* ptr) {delete ptr;}
1542 * Function operator to delete an object stored as const.
1544 * @param ptr object to delete after casting away const
1546 void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
1550 * Functor for cleaning up heap objects in key/value containers.
1552 template<class A,class B> struct cleanup_pair
1555 * Function operator to delete an object.
1557 * @param p a pair in which the second component is the object to delete
1559 void operator()(const std::pair<const A,B*>& p) {delete p.second;}
1563 * Functor for cleaning up const heap objects in key/value containers.
1565 template<class A,class B> struct cleanup_const_pair
1568 * Function operator to delete an object stored as const
1570 * @param p a pair in which the second component is the const object to delete
1572 void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
1576 #endif /* __xmltooling_base_h__ */