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 // Windows and GCC4 Symbol Visibility Macros
35 #define XMLTOOL_IMPORT __declspec(dllimport)
36 #define XMLTOOL_EXPORT __declspec(dllexport)
37 #define XMLTOOL_DLLLOCAL
38 #define XMLTOOL_DLLPUBLIC
40 #define XMLTOOL_IMPORT
41 #ifdef GCC_HASCLASSVISIBILITY
42 #define XMLTOOL_EXPORT __attribute__ ((visibility("default")))
43 #define XMLTOOL_DLLLOCAL __attribute__ ((visibility("hidden")))
44 #define XMLTOOL_DLLPUBLIC __attribute__ ((visibility("default")))
46 #define XMLTOOL_EXPORT
47 #define XMLTOOL_DLLLOCAL
48 #define XMLTOOL_DLLPUBLIC
52 // Define XMLTOOL_API for DLL builds
53 #ifdef XMLTOOLING_EXPORTS
54 #define XMLTOOL_API XMLTOOL_EXPORT
56 #define XMLTOOL_API XMLTOOL_IMPORT
59 // Throwable classes must always be visible on GCC in all binaries
61 #define XMLTOOL_EXCEPTIONAPI(api) api
62 #elif defined(GCC_HASCLASSVISIBILITY)
63 #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT
65 #define XMLTOOL_EXCEPTIONAPI(api)
69 #define XMLTOOLING_DOXYGEN(desc) /##** desc */
71 #define XMLTOOLING_DOXYGEN(desc)
75 * Blocks copy c'tor and assignment operator for a class.
77 #define MAKE_NONCOPYABLE(type) \
80 type& operator=(const type&)
86 #define UNICODE_LITERAL_1(a) {xercesc::chLatin_##a, xercesc::chNull}
87 #define UNICODE_LITERAL_2(a,b) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chNull}
88 #define UNICODE_LITERAL_3(a,b,c) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chNull}
89 #define UNICODE_LITERAL_4(a,b,c,d) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chNull}
90 #define UNICODE_LITERAL_5(a,b,c,d,e) \
91 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chNull}
92 #define UNICODE_LITERAL_6(a,b,c,d,e,f) \
93 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chNull}
94 #define UNICODE_LITERAL_7(a,b,c,d,e,f,g) \
95 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chNull}
96 #define UNICODE_LITERAL_8(a,b,c,d,e,f,g,h) \
97 {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}
98 #define UNICODE_LITERAL_9(a,b,c,d,e,f,g,h,i) \
99 {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}
100 #define UNICODE_LITERAL_10(a,b,c,d,e,f,g,h,i,j) \
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::chLatin_##i, \
102 xercesc::chLatin_##j, xercesc::chNull}
103 #define UNICODE_LITERAL_11(a,b,c,d,e,f,g,h,i,j,k) \
104 {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, \
105 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chNull}
106 #define UNICODE_LITERAL_12(a,b,c,d,e,f,g,h,i,j,k,l) \
107 {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, \
108 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chNull}
109 #define UNICODE_LITERAL_13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
110 {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, \
111 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chNull}
112 #define UNICODE_LITERAL_14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
113 {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, \
114 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chNull}
115 #define UNICODE_LITERAL_15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
116 {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, \
117 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chNull}
118 #define UNICODE_LITERAL_16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
119 {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, \
120 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chNull}
121 #define UNICODE_LITERAL_17(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) \
122 {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, \
123 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}
124 #define UNICODE_LITERAL_18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) \
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, \
126 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}
127 #define UNICODE_LITERAL_19(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) \
128 {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, \
129 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, \
130 xercesc::chLatin_##s, xercesc::chNull}
131 #define UNICODE_LITERAL_20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) \
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::chLatin_##t, xercesc::chNull}
135 #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) \
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::chLatin_##u, xercesc::chNull}
139 #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) \
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::chLatin_##v, xercesc::chNull}
143 #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) \
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::chLatin_##w, xercesc::chNull}
147 #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) \
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::chLatin_##x, xercesc::chNull}
151 #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) \
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::chLatin_##y, xercesc::chNull}
155 #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) \
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::chLatin_##z, xercesc::chNull}
159 #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) \
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, \
163 xercesc::chLatin_##aa, xercesc::chNull}
164 #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) \
165 {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, \
166 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, \
167 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
168 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chNull}
169 #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) \
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::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
173 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chNull}
174 #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) \
175 {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, \
176 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, \
177 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
178 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chNull}
179 #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) \
180 {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, \
181 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, \
182 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
183 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chNull}
184 #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) \
185 {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, \
186 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, \
187 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
188 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chNull}
189 #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) \
190 {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, \
191 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, \
192 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
193 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chNull}
194 #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) \
195 {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, \
196 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, \
197 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
198 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}
199 #endif /* DOXYGEN_SKIP */
202 * Begins the declaration of an XMLObject specialization for an abstract element/type.
203 * Basic boilerplate includes a protected constructor, empty virtual destructor,
204 * and Unicode constants for the default associated element's name and prefix.
206 * @param linkage linkage specifier for the class
207 * @param cname the name of the class to declare
208 * @param base the base class to derive from using public virtual inheritance
209 * @param desc documentation comment for class
211 #define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \
212 XMLTOOLING_DOXYGEN(desc) \
213 class linkage cname : public virtual base { \
217 virtual ~cname() {} \
218 XMLTOOLING_DOXYGEN(Element local name) \
219 static const XMLCh LOCAL_NAME[]; \
223 * Begins the declaration of an XMLObject specialization.
224 * Basic boilerplate includes a protected constructor, empty virtual destructor,
225 * and Unicode constants for the default associated element's name and prefix.
227 * @param linkage linkage specifier for the class
228 * @param cname the name of the class to declare
229 * @param base the base class to derive from using public virtual inheritance
230 * @param desc documentation comment for class
232 #define BEGIN_XMLOBJECT(linkage,cname,base,desc) \
233 XMLTOOLING_DOXYGEN(desc) \
234 class linkage cname : public virtual base { \
238 virtual ~cname() {} \
239 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
240 virtual cname* clone##cname() const=0; \
241 XMLTOOLING_DOXYGEN(Element local name) \
242 static const XMLCh LOCAL_NAME[]
245 * Begins the declaration of an XMLObject specialization with two base classes.
246 * Basic boilerplate includes a protected constructor, empty virtual destructor,
247 * and Unicode constants for the default associated element's name and prefix.
249 * @param linkage linkage specifier for the class
250 * @param cname the name of the class to declare
251 * @param base the first base class to derive from using public virtual inheritance
252 * @param base2 the second base class to derive from using public virtual inheritance
253 * @param desc documentation comment for class
255 #define BEGIN_XMLOBJECT2(linkage,cname,base,base2,desc) \
256 XMLTOOLING_DOXYGEN(desc) \
257 class linkage cname : public virtual base, public virtual base2 { \
261 virtual ~cname() {} \
262 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
263 virtual cname* clone##cname() const=0; \
264 XMLTOOLING_DOXYGEN(Element local name) \
265 static const XMLCh LOCAL_NAME[]
268 * Begins the declaration of an XMLObject specialization with three base classes.
269 * Basic boilerplate includes a protected constructor, empty virtual destructor,
270 * and Unicode constants for the default associated element's name and prefix.
272 * @param linkage linkage specifier for the class
273 * @param cname the name of the class to declare
274 * @param base the first base class to derive from using public virtual inheritance
275 * @param base2 the second base class to derive from using public virtual inheritance
276 * @param base3 the third base class to derive from using public virtual inheritance
277 * @param desc documentation comment for class
279 #define BEGIN_XMLOBJECT3(linkage,cname,base,base2,base3,desc) \
280 XMLTOOLING_DOXYGEN(desc) \
281 class linkage cname : public virtual base, public virtual base2, public virtual base3 { \
285 virtual ~cname() {} \
286 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
287 virtual cname* clone##cname() const=0; \
288 XMLTOOLING_DOXYGEN(Element local name) \
289 static const XMLCh LOCAL_NAME[]
292 * Begins the declaration of an XMLObject specialization with four base classes.
293 * Basic boilerplate includes a protected constructor, empty virtual destructor,
294 * and Unicode constants for the default associated element's name and prefix.
296 * @param linkage linkage specifier for the class
297 * @param cname the name of the class to declare
298 * @param base the first base class to derive from using public virtual inheritance
299 * @param base2 the second base class to derive from using public virtual inheritance
300 * @param base3 the third base class to derive from using public virtual inheritance
301 * @param base4 the fourth base class to derive from using public virtual inheritance
302 * @param desc documentation comment for class
304 #define BEGIN_XMLOBJECT4(linkage,cname,base,base2,base3,base4,desc) \
305 XMLTOOLING_DOXYGEN(desc) \
306 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4 { \
310 virtual ~cname() {} \
311 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
312 virtual cname* clone##cname() const=0; \
313 XMLTOOLING_DOXYGEN(Element local name) \
314 static const XMLCh LOCAL_NAME[]
317 * Begins the declaration of an XMLObject specialization with five base classes.
318 * Basic boilerplate includes a protected constructor, empty virtual destructor,
319 * and Unicode constants for the default associated element's name and prefix.
321 * @param linkage linkage specifier for the class
322 * @param cname the name of the class to declare
323 * @param base the first base class to derive from using public virtual inheritance
324 * @param base2 the second base class to derive from using public virtual inheritance
325 * @param base3 the third base class to derive from using public virtual inheritance
326 * @param base4 the fourth base class to derive from using public virtual inheritance
327 * @param base5 the fifth base class to derive from using public virtual inheritance
328 * @param desc documentation comment for class
330 #define BEGIN_XMLOBJECT5(linkage,cname,base,base2,base3,base4,base5,desc) \
331 XMLTOOLING_DOXYGEN(desc) \
332 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4, public virtual base5 { \
336 virtual ~cname() {} \
337 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
338 virtual cname* clone##cname() const=0; \
339 XMLTOOLING_DOXYGEN(Element local name) \
340 static const XMLCh LOCAL_NAME[]
343 * Ends the declaration of an XMLObject specialization.
345 #define END_XMLOBJECT }
348 * Declares abstract set method for a typed XML attribute.
349 * The get method is omitted.
351 * @param proper the proper name of the attribute
352 * @param upcased the upcased name of the attribute
353 * @param type the attribute's data type
355 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \
357 XMLTOOLING_DOXYGEN(proper attribute name) \
358 static const XMLCh upcased##_ATTRIB_NAME[]; \
359 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
360 virtual void set##proper(const type* proper)=0
363 * Declares abstract get/set methods for a typed XML attribute.
365 * @param proper the proper name of the attribute
366 * @param upcased the upcased name of the attribute
367 * @param type the attribute's data type
369 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \
371 XMLTOOLING_DOXYGEN(proper attribute name) \
372 static const XMLCh upcased##_ATTRIB_NAME[]; \
373 XMLTOOLING_DOXYGEN(Returns the proper attribute.) \
374 virtual const type* get##proper() const=0; \
375 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
376 virtual void set##proper(const type* proper)=0
379 * Declares abstract set method for a string XML attribute.
380 * The get method is omitted.
382 * @param proper the proper name of the attribute
383 * @param upcased the upcased name of the attribute
385 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \
386 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
389 * Declares abstract get/set methods for a string XML attribute.
391 * @param proper the proper name of the attribute
392 * @param upcased the upcased name of the attribute
394 #define DECL_STRING_ATTRIB(proper,upcased) \
395 DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
398 * Declares abstract set method for a DateTime XML attribute.
399 * The get method is omitted.
401 * @param proper the proper name of the attribute
402 * @param upcased the upcased name of the attribute
404 #define DECL_INHERITED_DATETIME_ATTRIB(proper,upcased) \
405 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
406 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
407 virtual void set##proper(time_t proper)=0; \
408 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
409 virtual void set##proper(const XMLCh* proper)=0
412 * Declares abstract get/set methods for a DateTime XML attribute.
414 * @param proper the proper name of the attribute
415 * @param upcased the upcased name of the attribute
417 #define DECL_DATETIME_ATTRIB(proper,upcased) \
418 DECL_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
419 XMLTOOLING_DOXYGEN(Returns the proper attribute in epoch form.) \
420 virtual time_t get##proper##Epoch() const=0; \
421 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
422 virtual void set##proper(time_t proper)=0; \
423 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
424 virtual void set##proper(const XMLCh* proper)=0
427 * Declares abstract set method for an integer XML attribute.
428 * The get method is omitted.
430 * @param proper the proper name of the attribute
431 * @param upcased the upcased name of the attribute
433 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \
435 XMLTOOLING_DOXYGEN(proper attribute name) \
436 static const XMLCh upcased##_ATTRIB_NAME[]; \
437 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
438 virtual void set##proper(const XMLCh* proper)=0; \
439 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
440 virtual void set##proper(int proper)=0
443 * Declares abstract get/set methods for an integer XML attribute.
445 * @param proper the proper name of the attribute
446 * @param upcased the upcased name of the attribute
448 #define DECL_INTEGER_ATTRIB(proper,upcased) \
450 XMLTOOLING_DOXYGEN(proper attribute name) \
451 static const XMLCh upcased##_ATTRIB_NAME[]; \
452 XMLTOOLING_DOXYGEN(Returns the proper attribute after a NULL indicator.) \
453 virtual std::pair<bool,int> get##proper() const=0; \
454 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
455 virtual void set##proper(const XMLCh* proper)=0; \
456 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
457 virtual void set##proper(int proper)=0
460 * Declares abstract get/set methods for a boolean XML attribute.
462 * @param proper the proper name of the attribute
463 * @param upcased the upcased name of the attribute
464 * @param def the default/presumed value, if no explicit value has been set
466 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \
468 XMLTOOLING_DOXYGEN(proper attribute name) \
469 static const XMLCh upcased##_ATTRIB_NAME[]; \
470 XMLTOOLING_DOXYGEN(Returns the proper attribute or def if not set.) \
471 bool proper() const { \
472 switch (get##proper()) { \
473 case xmlconstants::XML_BOOL_TRUE: \
474 case xmlconstants::XML_BOOL_ONE: \
476 case xmlconstants::XML_BOOL_FALSE: \
477 case xmlconstants::XML_BOOL_ZERO: \
483 XMLTOOLING_DOXYGEN(Returns the proper attribute as an explicit enumerated value.) \
484 virtual xmlconstants::xmltooling_bool_t get##proper() const=0; \
485 XMLTOOLING_DOXYGEN(Sets the proper attribute using an enumerated value.) \
486 virtual void proper(xmlconstants::xmltooling_bool_t value)=0; \
487 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
488 void proper(bool value) { \
489 proper(value ? xmlconstants::XML_BOOL_ONE : xmlconstants::XML_BOOL_ZERO); \
491 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \
492 void set##proper(const XMLCh* value) { \
495 case xercesc::chLatin_t: \
496 proper(xmlconstants::XML_BOOL_TRUE); \
498 case xercesc::chLatin_f: \
499 proper(xmlconstants::XML_BOOL_FALSE); \
501 case xercesc::chDigit_1: \
502 proper(xmlconstants::XML_BOOL_ONE); \
504 case xercesc::chDigit_0: \
505 proper(xmlconstants::XML_BOOL_ZERO); \
508 proper(xmlconstants::XML_BOOL_NULL); \
512 proper(xmlconstants::XML_BOOL_NULL); \
516 * Implements get/set methods and a private member for a typed XML attribute.
518 * @param proper the proper name of the attribute
519 * @param type the attribute's data type
521 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \
525 const type* get##proper() const { \
528 void set##proper(const type* proper) { \
529 m_##proper = prepareForAssignment(m_##proper,proper); \
533 * Implements get/set methods and a private member for a string XML attribute.
535 * @param proper the proper name of the attribute
537 #define IMPL_STRING_ATTRIB(proper) \
538 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)
541 * Implements get/set methods and a private member for a string XML attribute,
542 * plus a getXMLID override.
544 * @param proper the proper name of the attribute
546 #define IMPL_ID_ATTRIB(proper) \
547 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
548 const XMLCh* getXMLID() const { \
553 * Implements get/set methods and a private member for a DateTime XML attribute.
555 * @param proper the proper name of the attribute
556 * @param fallback epoch to return when attribute is NULL
558 #define IMPL_DATETIME_ATTRIB(proper,fallback) \
560 DateTime* m_##proper; \
561 time_t m_##proper##Epoch; \
563 const DateTime* get##proper() const { \
566 time_t get##proper##Epoch() const { \
567 return m_##proper ? m_##proper##Epoch : fallback; \
569 void set##proper(const DateTime* proper) { \
570 m_##proper = prepareForAssignment(m_##proper,proper); \
572 m_##proper##Epoch=m_##proper->getEpoch(); \
574 void set##proper(time_t proper) { \
575 m_##proper = prepareForAssignment(m_##proper,proper); \
576 m_##proper##Epoch = proper; \
578 void set##proper(const XMLCh* proper) { \
579 m_##proper = prepareForAssignment(m_##proper,proper); \
581 m_##proper##Epoch=m_##proper->getEpoch(); \
585 * Implements get/set methods and a private member for an integer XML attribute.
587 * @param proper the proper name of the attribute
589 #define IMPL_INTEGER_ATTRIB(proper) \
593 pair<bool,int> get##proper() const { \
594 return make_pair((m_##proper!=NULL),(m_##proper!=NULL ? xercesc::XMLString::parseInt(m_##proper): 0)); \
596 void set##proper(const XMLCh* proper) { \
597 m_##proper = prepareForAssignment(m_##proper,proper); \
599 void set##proper(int proper) { \
600 char buf##proper[64]; \
601 sprintf(buf##proper,"%d",proper); \
602 auto_ptr_XMLCh wide##proper(buf##proper); \
603 set##proper(wide##proper.get()); \
607 * Implements get/set methods and a private member for a boolean XML attribute.
609 * @param proper the proper name of the attribute
611 #define IMPL_BOOLEAN_ATTRIB(proper) \
613 xmlconstants::xmltooling_bool_t m_##proper; \
615 xmlconstants::xmltooling_bool_t get##proper() const { \
618 void proper(xmlconstants::xmltooling_bool_t value) { \
619 if (m_##proper != value) { \
620 releaseThisandParentDOM(); \
621 m_##proper = value; \
626 * Declares abstract set method for a typed XML child object in a foreign namespace.
627 * The get method is omitted.
629 * @param proper the proper name of the child type
630 * @param ns the C++ namespace for the type
632 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
634 XMLTOOLING_DOXYGEN(Sets the proper child.) \
635 virtual void set##proper(ns::proper* child)=0
638 * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
640 * @param proper the proper name of the child type
641 * @param ns the C++ namespace for the type
643 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
645 XMLTOOLING_DOXYGEN(Returns the proper child.) \
646 virtual ns::proper* get##proper() const=0; \
647 XMLTOOLING_DOXYGEN(Sets the proper child.) \
648 virtual void set##proper(ns::proper* child)=0
651 * Declares abstract set method for a typed XML child object.
652 * The get method is omitted.
654 * @param proper the proper name of the child type
656 #define DECL_INHERITED_TYPED_CHILD(proper) \
658 XMLTOOLING_DOXYGEN(Sets the proper child.) \
659 virtual void set##proper(proper* child)=0
662 * Declares abstract get/set methods for a typed XML child object.
664 * @param proper the proper name of the child type
666 #define DECL_TYPED_CHILD(proper) \
668 XMLTOOLING_DOXYGEN(Returns the proper child.) \
669 virtual proper* get##proper() const=0; \
670 XMLTOOLING_DOXYGEN(Sets the proper child.) \
671 virtual void set##proper(proper* child)=0
674 * Declares abstract get/set methods for a generic XML child object.
676 * @param proper the proper name of the child
678 #define DECL_XMLOBJECT_CHILD(proper) \
680 XMLTOOLING_DOXYGEN(Returns the proper child.) \
681 virtual xmltooling::XMLObject* get##proper() const=0; \
682 XMLTOOLING_DOXYGEN(Sets the proper child.) \
683 virtual void set##proper(xmltooling::XMLObject* child)=0
687 * Implements get/set methods and a private list iterator member for a typed XML child object.
689 * @param proper the proper name of the child type
691 #define IMPL_TYPED_CHILD(proper) \
693 proper* m_##proper; \
694 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
696 proper* get##proper() const { \
699 void set##proper(proper* child) { \
700 prepareForAssignment(m_##proper,child); \
701 *m_pos_##proper = m_##proper = child; \
705 * Implements get/set methods and a private list iterator member for
706 * a typed XML child object in a foreign namespace
708 * @param proper the proper name of the child type
709 * @param ns the C++ namespace for the type
711 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
713 ns::proper* m_##proper; \
714 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
716 ns::proper* get##proper() const { \
719 void set##proper(ns::proper* child) { \
720 prepareForAssignment(m_##proper,child); \
721 *m_pos_##proper = m_##proper = child; \
725 * Implements get/set methods and a private list iterator member for a generic XML child object.
727 * @param proper the proper name of the child
729 #define IMPL_XMLOBJECT_CHILD(proper) \
731 xmltooling::XMLObject* m_##proper; \
732 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
734 xmltooling::XMLObject* get##proper() const { \
737 void set##proper(xmltooling::XMLObject* child) { \
738 prepareForAssignment(m_##proper,child); \
739 *m_pos_##proper = m_##proper = child; \
743 * Declares abstract get/set methods for a typed XML child collection.
745 * @param proper the proper name of the child type
747 #define DECL_TYPED_CHILDREN(proper) \
749 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
750 virtual VectorOf(proper) get##proper##s()=0; \
751 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
752 virtual const std::vector<proper*>& get##proper##s() const=0
755 * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
757 * @param proper the proper name of the child type
758 * @param ns the C++ namespace for the type
760 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
762 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
763 virtual VectorOf(ns::proper) get##proper##s()=0; \
764 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
765 virtual const std::vector<ns::proper*>& get##proper##s() const=0
768 * Declares abstract get/set methods for a generic XML child collection.
770 * @param proper the proper name of the child
772 #define DECL_XMLOBJECT_CHILDREN(proper) \
774 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
775 virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
776 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
777 virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
780 * Implements get method and a private vector member for a typed XML child collection.
782 * @param proper the proper name of the child type
783 * @param fence insertion fence for new objects of the child collection in backing list
785 #define IMPL_TYPED_CHILDREN(proper,fence) \
787 std::vector<proper*> m_##proper##s; \
789 VectorOf(proper) get##proper##s() { \
790 return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
792 const std::vector<proper*>& get##proper##s() const { \
793 return m_##proper##s; \
797 * Implements get method and a private vector member for a typed XML child collection
798 * in a foreign namespace.
800 * @param proper the proper name of the child type
801 * @param ns the C++ namespace for the type
802 * @param fence insertion fence for new objects of the child collection in backing list
804 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
806 std::vector<ns::proper*> m_##proper##s; \
808 VectorOf(ns::proper) get##proper##s() { \
809 return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
811 const std::vector<ns::proper*>& get##proper##s() const { \
812 return m_##proper##s; \
816 * Implements get method and a private vector member for a generic XML child collection.
818 * @param proper the proper name of the child
819 * @param fence insertion fence for new objects of the child collection in backing list
821 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
823 std::vector<xmltooling::XMLObject*> m_##proper##s; \
825 VectorOf(xmltooling::XMLObject) get##proper##s() { \
826 return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
828 const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
829 return m_##proper##s; \
833 * Implements marshalling for a string attribute
835 * @param proper the proper name of the attribute
836 * @param ucase the upcased name of the attribute
837 * @param namespaceURI the XML namespace of the attribute
839 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
841 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
845 * Implements marshalling for a DateTime attribute
847 * @param proper the proper name of the attribute
848 * @param ucase the upcased name of the attribute
849 * @param namespaceURI the XML namespace of the attribute
851 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
853 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
857 * Implements marshalling for an integer attribute
859 * @param proper the proper name of the attribute
860 * @param ucase the upcased name of the attribute
861 * @param namespaceURI the XML namespace of the attribute
863 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
865 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
869 * Implements marshalling for a boolean attribute
871 * @param proper the proper name of the attribute
872 * @param ucase the upcased name of the attribute
873 * @param namespaceURI the XML namespace of the attribute
875 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
876 switch (m_##proper) { \
877 case xmlconstants::XML_BOOL_TRUE: \
878 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
880 case xmlconstants::XML_BOOL_ONE: \
881 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
883 case xmlconstants::XML_BOOL_FALSE: \
884 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
886 case xmlconstants::XML_BOOL_ZERO: \
887 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
889 case xmlconstants::XML_BOOL_NULL: \
894 * Implements marshalling for a QName attribute
896 * @param proper the proper name of the attribute
897 * @param ucase the upcased name of the attribute
898 * @param namespaceURI the XML namespace of the attribute
900 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
902 auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
903 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
907 * Implements marshalling for an ID attribute
909 * @param proper the proper name of the attribute
910 * @param ucase the upcased name of the attribute
911 * @param namespaceURI the XML namespace of the attribute
913 #define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
915 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
916 domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
920 * Implements unmarshalling process branch for a string attribute
922 * @param proper the proper name of the attribute
923 * @param ucase the upcased name of the attribute
924 * @param namespaceURI the XML namespace of the attribute
926 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
927 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
928 set##proper(attribute->getValue()); \
933 * Implements unmarshalling process branch for an ID attribute
935 * @param proper the proper name of the attribute
936 * @param ucase the upcased name of the attribute
937 * @param namespaceURI the XML namespace of the attribute
939 #define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
940 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
941 set##proper(attribute->getValue()); \
942 attribute->getOwnerElement()->setIdAttributeNode(attribute); \
947 * Implements unmarshalling process branch for a DateTime 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 PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
954 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
957 * Implements unmarshalling process branch for a DateTime attribute
959 * @param proper the proper name of the attribute
960 * @param ucase the upcased name of the attribute
961 * @param namespaceURI the XML namespace of the attribute
963 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
964 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
965 set##proper(XMLHelper::getAttributeValueAsQName(attribute)); \
970 * Implements unmarshalling process branch for an integer attribute
972 * @param proper the proper name of the attribute
973 * @param ucase the upcased name of the attribute
974 * @param namespaceURI the XML namespace of the attribute
976 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
977 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
980 * Implements unmarshalling process branch for a boolean attribute
982 * @param proper the proper name of the attribute
983 * @param ucase the upcased name of the attribute
984 * @param namespaceURI the XML namespace of the attribute
986 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
987 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
990 * Implements unmarshalling process branch for typed child collection element
992 * @param proper the proper name of the child type
993 * @param namespaceURI the XML namespace of the child element
994 * @param force bypass use of hint and just cast down to check child
996 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
997 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
998 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1000 get##proper##s().push_back(typesafe); \
1006 * Implements unmarshalling process branch for typed child collection element
1007 * in a foreign namespace.
1009 * @param proper the proper name of the child type
1010 * @param ns the C++ namespace for the type
1011 * @param namespaceURI the XML namespace of the child element
1012 * @param force bypass use of hint and just cast down to check child
1014 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
1015 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1016 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1018 get##proper##s().push_back(typesafe); \
1024 * Implements unmarshalling process branch for typed child singleton element
1026 * @param proper the proper name of the child type
1027 * @param namespaceURI the XML namespace of the child element
1028 * @param force bypass use of hint and just cast down to check child
1030 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
1031 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1032 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1034 set##proper(typesafe); \
1040 * Implements unmarshalling process branch for typed child singleton element
1041 * in a foreign namespace.
1043 * @param proper the proper name of the child type
1044 * @param ns the C++ namespace for the type
1045 * @param namespaceURI the XML namespace of the child element
1046 * @param force bypass use of hint and just cast down to check child
1048 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
1049 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1050 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1052 set##proper(typesafe); \
1058 * Implements unmarshalling process branch for a generic child singleton element
1060 * @param proper the proper name of the child type
1061 * @param namespaceURI the XML namespace of the child element
1063 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
1064 if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1065 set##proper(childXMLObject); \
1070 * Declares aliased get/set methods for named XML element simple content.
1072 * @param proper the proper name to label the element's content
1074 #define DECL_SIMPLE_CONTENT(proper) \
1075 XMLTOOLING_DOXYGEN(Returns proper.) \
1076 const XMLCh* get##proper() const { \
1077 return getTextContent(); \
1079 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1080 void set##proper(const XMLCh* proper) { \
1081 setTextContent(proper); \
1085 * Declares aliased get/set methods for named integer XML element content.
1087 * @param proper the proper name to label the element's content
1089 #define DECL_INTEGER_CONTENT(proper) \
1090 XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
1091 std::pair<bool,int> get##proper() const { \
1092 return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : NULL)); \
1094 XMLTOOLING_DOXYGEN(Sets proper.) \
1095 void set##proper(int proper) { \
1097 sprintf(buf,"%d",proper); \
1098 xmltooling::auto_ptr_XMLCh widebuf(buf); \
1099 setTextContent(widebuf.get()); \
1101 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1102 void set##proper(const XMLCh* proper) { \
1103 setTextContent(proper); \
1107 * Implements cloning methods for an XMLObject specialization implementation class.
1109 * @param cname the name of the XMLObject specialization
1111 #define IMPL_XMLOBJECT_CLONE(cname) \
1112 cname* clone##cname() const { \
1113 return dynamic_cast<cname*>(clone()); \
1115 xmltooling::XMLObject* clone() const { \
1116 std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1117 cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1119 domClone.release(); \
1122 return new cname##Impl(*this); \
1126 * Declares an XMLObject specialization with a simple content model and type,
1127 * handling it as string data.
1129 * @param linkage linkage specifier for the class
1130 * @param cname the name of the XMLObject specialization
1131 * @param proper the proper name to label the element's content
1132 * @param desc documentation for class
1134 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
1135 BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
1136 DECL_SIMPLE_CONTENT(proper); \
1140 * Declares and defines an implementation class for an XMLObject with
1141 * a simple content model and type, handling it as string data.
1143 * @param linkage linkage specifier for the class
1144 * @param cname the name of the XMLObject specialization
1146 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
1147 class linkage cname##Impl \
1148 : public virtual cname, \
1149 public xmltooling::AbstractSimpleElement, \
1150 public xmltooling::AbstractDOMCachingXMLObject, \
1151 public xmltooling::AbstractXMLObjectMarshaller, \
1152 public xmltooling::AbstractXMLObjectUnmarshaller \
1155 virtual ~cname##Impl() {} \
1156 cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \
1157 : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
1159 cname##Impl(const cname##Impl& src) \
1160 : xmltooling::AbstractXMLObject(src), \
1161 xmltooling::AbstractSimpleElement(src), \
1162 xmltooling::AbstractDOMCachingXMLObject(src) {} \
1163 IMPL_XMLOBJECT_CLONE(cname) \
1166 #ifdef HAVE_COVARIANT_RETURNS
1169 * Begins the declaration of an XMLObjectBuilder specialization.
1170 * Basic boilerplate includes an empty virtual destructor, and
1171 * a default builder that defaults the element name.
1173 * @param linkage linkage specifier for the class
1174 * @param cname the name of the XMLObject specialization
1175 * @param namespaceURI the XML namespace of the default associated element
1176 * @param namespacePrefix the XML namespace prefix of the default associated element
1178 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1179 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1180 class linkage cname##Builder : public xmltooling::XMLObjectBuilder { \
1182 virtual ~cname##Builder() {} \
1183 XMLTOOLING_DOXYGEN(Default builder.) \
1184 virtual cname* buildObject() const { \
1185 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1187 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1188 virtual cname* buildObject( \
1189 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
1193 * Ends the declaration of an XMLObjectBuilder specialization.
1195 #define END_XMLOBJECTBUILDER }
1198 * Declares a generic XMLObjectBuilder specialization.
1200 * @param linkage linkage specifier for the class
1201 * @param cname the name of the XMLObject specialization
1202 * @param namespaceURI the XML namespace of the default associated element
1203 * @param namespacePrefix the XML namespace prefix of the default associated element
1205 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1206 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1207 XMLTOOLING_DOXYGEN(Singleton builder.) \
1208 static cname* build##cname() { \
1209 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1210 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1213 return b->buildObject(); \
1214 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1216 END_XMLOBJECTBUILDER
1219 * Implements the standard XMLObjectBuilder specialization function.
1221 * @param cname the name of the XMLObject specialization
1223 #define IMPL_XMLOBJECTBUILDER(cname) \
1224 cname* cname##Builder::buildObject( \
1225 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
1228 return new cname##Impl(nsURI,localName,prefix,schemaType); \
1231 #else /* !HAVE_COVARIANT_RETURNS */
1234 * Begins the declaration of an XMLObjectBuilder specialization.
1235 * Basic boilerplate includes an empty virtual destructor, and
1236 * a default builder that defaults the element name.
1238 * @param linkage linkage specifier for the class
1239 * @param cname the name of the XMLObject specialization
1240 * @param namespaceURI the XML namespace of the default associated element
1241 * @param namespacePrefix the XML namespace prefix of the default associated element
1243 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1244 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1245 class linkage cname##Builder : public xmltooling::XMLObjectBuilder { \
1247 virtual ~cname##Builder() {} \
1248 XMLTOOLING_DOXYGEN(Default builder.) \
1249 virtual xmltooling::XMLObject* buildObject() const { \
1250 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1252 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1253 virtual xmltooling::XMLObject* buildObject( \
1254 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
1258 * Ends the declaration of an XMLObjectBuilder specialization.
1260 #define END_XMLOBJECTBUILDER }
1263 * Declares a generic XMLObjectBuilder specialization.
1265 * @param linkage linkage specifier for the class
1266 * @param cname the name of the XMLObject specialization
1267 * @param namespaceURI the XML namespace of the default associated element
1268 * @param namespacePrefix the XML namespace prefix of the default associated element
1270 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1271 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1272 XMLTOOLING_DOXYGEN(Singleton builder.) \
1273 static cname* build##cname() { \
1274 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1275 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1278 return dynamic_cast<cname*>(b->buildObject()); \
1279 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1281 END_XMLOBJECTBUILDER
1284 * Implements the standard XMLObjectBuilder specialization function.
1286 * @param cname the name of the XMLObject specialization
1288 #define IMPL_XMLOBJECTBUILDER(cname) \
1289 xmltooling::XMLObject* cname##Builder::buildObject( \
1290 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
1293 return new cname##Impl(nsURI,localName,prefix,schemaType); \
1296 #endif /* HAVE_COVARIANT_RETURNS */
1299 * Begins the declaration of a Schema Validator specialization.
1301 * @param linkage linkage specifier for the class
1302 * @param cname the base name of the Validator specialization
1304 #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
1305 class linkage cname##SchemaValidator : public xmltooling::Validator \
1308 virtual ~cname##SchemaValidator() {} \
1309 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1310 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1312 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1315 * Begins the declaration of a Schema Validator specialization subclass.
1317 * @param linkage linkage specifier for the class
1318 * @param cname the base name of the Validator specialization
1319 * @param base base class for the validator
1321 #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
1322 class linkage cname##SchemaValidator : public base##SchemaValidator \
1325 virtual ~cname##SchemaValidator() {} \
1326 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1327 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1329 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1332 * Ends the declaration of a Validator specialization.
1334 #define END_XMLOBJECTVALIDATOR } }
1337 * Validator code that checks the object type.
1339 * @param cname the name of the XMLObject specialization
1341 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
1342 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1344 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1347 * Validator code that checks for a required attribute, content, or singleton.
1349 * @param cname the name of the XMLObject specialization
1350 * @param proper the proper name of the attribute, content, or singleton member
1352 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
1353 if (!ptr->get##proper()) \
1354 throw xmltooling::ValidationException(#cname" must have "#proper".")
1357 * Validator code that checks for a required integer attribute
1359 * @param cname the name of the XMLObject specialization
1360 * @param proper the proper name of the attribute, content, or singleton member
1362 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
1363 if (!ptr->get##proper().first) \
1364 throw xmltooling::ValidationException(#cname" must have "#proper".")
1367 * Validator code that checks for one of a pair of
1368 * required attributes, content, or singletons.
1370 * @param cname the name of the XMLObject specialization
1371 * @param proper1 the proper name of the first attribute, content, or singleton member
1372 * @param proper2 the proper name of the second attribute, content, or singleton member
1374 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
1375 if (!ptr->get##proper1() && !ptr->get##proper2()) \
1376 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
1379 * Validator code that checks for one of a pair of
1380 * required attributes, content, or singletons, but disallows both.
1382 * @param cname the name of the XMLObject specialization
1383 * @param proper1 the proper name of the first attribute, content, or singleton member
1384 * @param proper2 the proper name of the second attribute, content, or singleton member
1386 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
1387 if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
1388 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
1391 * Validator code that checks for one of a set of three
1392 * required attributes, content, or singletons.
1394 * @param cname the name of the XMLObject specialization
1395 * @param proper1 the proper name of the first attribute, content, or singleton member
1396 * @param proper2 the proper name of the second attribute, content, or singleton member
1397 * @param proper3 the proper name of the third attribute, content, or singleton member
1399 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
1400 if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
1401 throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
1404 * Validator code that checks for one of a set of three
1405 * required attributes, content, or singletons but disallows more than one.
1407 * @param cname the name of the XMLObject specialization
1408 * @param proper1 the proper name of the first attribute, content, or singleton member
1409 * @param proper2 the proper name of the second attribute, content, or singleton member
1410 * @param proper3 the proper name of the third attribute, content, or singleton member
1412 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
1413 int c##proper1##proper2##proper3=0; \
1414 if (ptr->get##proper1()!=NULL) \
1415 c##proper1##proper2##proper3++; \
1416 if (ptr->get##proper2()!=NULL) \
1417 c##proper1##proper2##proper3++; \
1418 if (ptr->get##proper3()!=NULL) \
1419 c##proper1##proper2##proper3++; \
1420 if (c##proper1##proper2##proper3 != 1) \
1421 throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
1424 * Validator code that checks a co-constraint (if one present, the other must be)
1425 * between a pair of attributes, content, or singletons.
1427 * @param cname the name of the XMLObject specialization
1428 * @param proper1 the proper name of the first attribute, content, or singleton member
1429 * @param proper2 the proper name of the second attribute, content, or singleton member
1431 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
1432 if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
1433 throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
1436 * Validator code that checks for a non-empty collection.
1438 * @param cname the name of the XMLObject specialization
1439 * @param proper the proper name of the collection item
1441 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
1442 if (ptr->get##proper##s().empty()) \
1443 throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
1446 * Declares/defines a Validator specialization that checks object type and
1447 * a non-empty simple content model.
1449 * @param linkage linkage specifier for the class
1450 * @param cname the name of the XMLObject specialization
1452 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
1453 BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
1454 XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
1455 END_XMLOBJECTVALIDATOR
1460 * @namespace xmltooling
1461 * Public namespace of XML Tooling library
1463 namespace xmltooling {
1466 * Template function for cloning a sequence of XMLObjects.
1467 * Invokes the clone() member on each element of the input sequence and adds the copy to
1468 * the output sequence. Order is preserved.
1470 * @param in input sequence to clone
1471 * @param out output sequence to copy cloned pointers into
1473 template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
1474 for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
1476 out.push_back((*i)->clone());
1483 * Functor for cleaning up heap objects in containers.
1485 template<class T> struct cleanup
1488 * Function operator to delete an object.
1490 * @param ptr object to delete
1492 void operator()(T* ptr) {delete ptr;}
1495 * Function operator to delete an object stored as const.
1497 * @param ptr object to delete after casting away const
1499 void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
1503 * Functor for cleaning up heap objects in key/value containers.
1505 template<class A,class B> struct cleanup_pair
1508 * Function operator to delete an object.
1510 * @param p a pair in which the second component is the object to delete
1512 void operator()(const std::pair<const A,B*>& p) {delete p.second;}
1516 * Functor for cleaning up const heap objects in key/value containers.
1518 template<class A,class B> struct cleanup_const_pair
1521 * Function operator to delete an object stored as const
1523 * @param p a pair in which the second component is the const object to delete
1525 void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
1529 #endif /* __xmltooling_base_h__ */