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 abstract set method for a typed XML attribute.
353 * The get method is omitted.
355 * @param proper the proper name of the attribute
356 * @param upcased the upcased name of the attribute
357 * @param type the attribute's data type
359 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \
361 XMLTOOLING_DOXYGEN(proper attribute name) \
362 static const XMLCh upcased##_ATTRIB_NAME[]; \
363 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
364 virtual void set##proper(const type* proper)=0
367 * Declares abstract get/set methods for a typed XML attribute.
369 * @param proper the proper name of the attribute
370 * @param upcased the upcased name of the attribute
371 * @param type the attribute's data type
373 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \
375 XMLTOOLING_DOXYGEN(proper attribute name) \
376 static const XMLCh upcased##_ATTRIB_NAME[]; \
377 XMLTOOLING_DOXYGEN(Returns the proper attribute.) \
378 virtual const type* get##proper() const=0; \
379 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
380 virtual void set##proper(const type* proper)=0
383 * Declares abstract set method for a string XML attribute.
384 * The get method is omitted.
386 * @param proper the proper name of the attribute
387 * @param upcased the upcased name of the attribute
389 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \
390 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
393 * Declares abstract get/set methods for a string XML attribute.
395 * @param proper the proper name of the attribute
396 * @param upcased the upcased name of the attribute
398 #define DECL_STRING_ATTRIB(proper,upcased) \
399 DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
402 * Declares abstract set method for a DateTime XML attribute.
403 * The get method is omitted.
405 * @param proper the proper name of the attribute
406 * @param upcased the upcased name of the attribute
408 #define DECL_INHERITED_DATETIME_ATTRIB(proper,upcased) \
409 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
410 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
411 virtual void set##proper(time_t proper)=0; \
412 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
413 virtual void set##proper(const XMLCh* proper)=0
416 * Declares abstract get/set methods for a DateTime XML attribute.
418 * @param proper the proper name of the attribute
419 * @param upcased the upcased name of the attribute
421 #define DECL_DATETIME_ATTRIB(proper,upcased) \
422 DECL_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
423 XMLTOOLING_DOXYGEN(Returns the proper attribute in epoch form.) \
424 virtual time_t get##proper##Epoch() const=0; \
425 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
426 virtual void set##proper(time_t proper)=0; \
427 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
428 virtual void set##proper(const XMLCh* proper)=0
431 * Declares abstract set method for an integer XML attribute.
432 * The get method is omitted.
434 * @param proper the proper name of the attribute
435 * @param upcased the upcased name of the attribute
437 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \
439 XMLTOOLING_DOXYGEN(proper attribute name) \
440 static const XMLCh upcased##_ATTRIB_NAME[]; \
441 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
442 virtual void set##proper(const XMLCh* proper)=0; \
443 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
444 virtual void set##proper(int proper)=0
447 * Declares abstract get/set methods for an integer XML attribute.
449 * @param proper the proper name of the attribute
450 * @param upcased the upcased name of the attribute
452 #define DECL_INTEGER_ATTRIB(proper,upcased) \
454 XMLTOOLING_DOXYGEN(proper attribute name) \
455 static const XMLCh upcased##_ATTRIB_NAME[]; \
456 XMLTOOLING_DOXYGEN(Returns the proper attribute after a NULL indicator.) \
457 virtual std::pair<bool,int> get##proper() const=0; \
458 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
459 virtual void set##proper(const XMLCh* proper)=0; \
460 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
461 virtual void set##proper(int proper)=0
464 * Declares abstract get/set methods for a boolean XML attribute.
466 * @param proper the proper name of the attribute
467 * @param upcased the upcased name of the attribute
468 * @param def the default/presumed value, if no explicit value has been set
470 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \
472 XMLTOOLING_DOXYGEN(proper attribute name) \
473 static const XMLCh upcased##_ATTRIB_NAME[]; \
474 XMLTOOLING_DOXYGEN(Returns the proper attribute or def if not set.) \
475 bool proper() const { \
476 switch (get##proper()) { \
477 case xmlconstants::XML_BOOL_TRUE: \
478 case xmlconstants::XML_BOOL_ONE: \
480 case xmlconstants::XML_BOOL_FALSE: \
481 case xmlconstants::XML_BOOL_ZERO: \
487 XMLTOOLING_DOXYGEN(Returns the proper attribute as an explicit enumerated value.) \
488 virtual xmlconstants::xmltooling_bool_t get##proper() const=0; \
489 XMLTOOLING_DOXYGEN(Sets the proper attribute using an enumerated value.) \
490 virtual void proper(xmlconstants::xmltooling_bool_t value)=0; \
491 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
492 void proper(bool value) { \
493 proper(value ? xmlconstants::XML_BOOL_ONE : xmlconstants::XML_BOOL_ZERO); \
495 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \
496 void set##proper(const XMLCh* value) { \
499 case xercesc::chLatin_t: \
500 proper(xmlconstants::XML_BOOL_TRUE); \
502 case xercesc::chLatin_f: \
503 proper(xmlconstants::XML_BOOL_FALSE); \
505 case xercesc::chDigit_1: \
506 proper(xmlconstants::XML_BOOL_ONE); \
508 case xercesc::chDigit_0: \
509 proper(xmlconstants::XML_BOOL_ZERO); \
512 proper(xmlconstants::XML_BOOL_NULL); \
516 proper(xmlconstants::XML_BOOL_NULL); \
520 * Implements get/set methods and a private member for a typed XML attribute.
522 * @param proper the proper name of the attribute
523 * @param type the attribute's data type
525 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \
529 const type* get##proper() const { \
532 void set##proper(const type* proper) { \
533 m_##proper = prepareForAssignment(m_##proper,proper); \
537 * Implements get/set methods and a private member for a string XML attribute.
539 * @param proper the proper name of the attribute
541 #define IMPL_STRING_ATTRIB(proper) \
542 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)
545 * Implements get/set methods and a private member for a string XML attribute,
546 * plus a getXMLID override.
548 * @param proper the proper name of the attribute
550 #define IMPL_ID_ATTRIB(proper) \
551 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
552 const XMLCh* getXMLID() const { \
557 * Implements get/set methods and a private member for a DateTime XML attribute.
559 * @param proper the proper name of the attribute
560 * @param fallback epoch to return when attribute is NULL
562 #define IMPL_DATETIME_ATTRIB(proper,fallback) \
564 DateTime* m_##proper; \
565 time_t m_##proper##Epoch; \
567 const DateTime* get##proper() const { \
570 time_t get##proper##Epoch() const { \
571 return m_##proper ? m_##proper##Epoch : fallback; \
573 void set##proper(const DateTime* proper) { \
574 m_##proper = prepareForAssignment(m_##proper,proper); \
576 m_##proper##Epoch=m_##proper->getEpoch(); \
578 void set##proper(time_t proper) { \
579 m_##proper = prepareForAssignment(m_##proper,proper); \
580 m_##proper##Epoch = proper; \
582 void set##proper(const XMLCh* proper) { \
583 m_##proper = prepareForAssignment(m_##proper,proper); \
585 m_##proper##Epoch=m_##proper->getEpoch(); \
589 * Implements get/set methods and a private member for an integer XML attribute.
591 * @param proper the proper name of the attribute
593 #define IMPL_INTEGER_ATTRIB(proper) \
597 pair<bool,int> get##proper() const { \
598 return make_pair((m_##proper!=NULL),(m_##proper!=NULL ? xercesc::XMLString::parseInt(m_##proper): 0)); \
600 void set##proper(const XMLCh* proper) { \
601 m_##proper = prepareForAssignment(m_##proper,proper); \
603 void set##proper(int proper) { \
604 char buf##proper[64]; \
605 sprintf(buf##proper,"%d",proper); \
606 auto_ptr_XMLCh wide##proper(buf##proper); \
607 set##proper(wide##proper.get()); \
611 * Implements get/set methods and a private member for a boolean XML attribute.
613 * @param proper the proper name of the attribute
615 #define IMPL_BOOLEAN_ATTRIB(proper) \
617 xmlconstants::xmltooling_bool_t m_##proper; \
619 xmlconstants::xmltooling_bool_t get##proper() const { \
622 void proper(xmlconstants::xmltooling_bool_t value) { \
623 if (m_##proper != value) { \
624 releaseThisandParentDOM(); \
625 m_##proper = value; \
630 * Declares abstract set method for a typed XML child object in a foreign namespace.
631 * The get method is omitted.
633 * @param proper the proper name of the child type
634 * @param ns the C++ namespace for the type
636 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
638 XMLTOOLING_DOXYGEN(Sets the proper child.) \
639 virtual void set##proper(ns::proper* child)=0
642 * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
644 * @param proper the proper name of the child type
645 * @param ns the C++ namespace for the type
647 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
649 XMLTOOLING_DOXYGEN(Returns the proper child.) \
650 virtual ns::proper* get##proper() const=0; \
651 XMLTOOLING_DOXYGEN(Sets the proper child.) \
652 virtual void set##proper(ns::proper* child)=0
655 * Declares abstract set method for a typed XML child object.
656 * The get method is omitted.
658 * @param proper the proper name of the child type
660 #define DECL_INHERITED_TYPED_CHILD(proper) \
662 XMLTOOLING_DOXYGEN(Sets the proper child.) \
663 virtual void set##proper(proper* child)=0
666 * Declares abstract get/set methods for a typed XML child object.
668 * @param proper the proper name of the child type
670 #define DECL_TYPED_CHILD(proper) \
672 XMLTOOLING_DOXYGEN(Returns the proper child.) \
673 virtual proper* get##proper() const=0; \
674 XMLTOOLING_DOXYGEN(Sets the proper child.) \
675 virtual void set##proper(proper* child)=0
678 * Declares abstract get/set methods for a generic XML child object.
680 * @param proper the proper name of the child
682 #define DECL_XMLOBJECT_CHILD(proper) \
684 XMLTOOLING_DOXYGEN(Returns the proper child.) \
685 virtual xmltooling::XMLObject* get##proper() const=0; \
686 XMLTOOLING_DOXYGEN(Sets the proper child.) \
687 virtual void set##proper(xmltooling::XMLObject* child)=0
691 * Implements get/set methods and a private list iterator member for a typed XML child object.
693 * @param proper the proper name of the child type
695 #define IMPL_TYPED_CHILD(proper) \
697 proper* m_##proper; \
698 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
700 proper* get##proper() const { \
703 void set##proper(proper* child) { \
704 prepareForAssignment(m_##proper,child); \
705 *m_pos_##proper = m_##proper = child; \
709 * Implements get/set methods and a private list iterator member for
710 * a typed XML child object in a foreign namespace
712 * @param proper the proper name of the child type
713 * @param ns the C++ namespace for the type
715 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
717 ns::proper* m_##proper; \
718 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
720 ns::proper* get##proper() const { \
723 void set##proper(ns::proper* child) { \
724 prepareForAssignment(m_##proper,child); \
725 *m_pos_##proper = m_##proper = child; \
729 * Implements get/set methods and a private list iterator member for a generic XML child object.
731 * @param proper the proper name of the child
733 #define IMPL_XMLOBJECT_CHILD(proper) \
735 xmltooling::XMLObject* m_##proper; \
736 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
738 xmltooling::XMLObject* get##proper() const { \
741 void set##proper(xmltooling::XMLObject* child) { \
742 prepareForAssignment(m_##proper,child); \
743 *m_pos_##proper = m_##proper = child; \
747 * Declares abstract get/set methods for a typed XML child collection.
749 * @param proper the proper name of the child type
751 #define DECL_TYPED_CHILDREN(proper) \
753 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
754 virtual VectorOf(proper) get##proper##s()=0; \
755 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
756 virtual const std::vector<proper*>& get##proper##s() const=0
759 * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
761 * @param proper the proper name of the child type
762 * @param ns the C++ namespace for the type
764 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
766 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
767 virtual VectorOf(ns::proper) get##proper##s()=0; \
768 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
769 virtual const std::vector<ns::proper*>& get##proper##s() const=0
772 * Declares abstract get/set methods for a generic XML child collection.
774 * @param proper the proper name of the child
776 #define DECL_XMLOBJECT_CHILDREN(proper) \
778 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
779 virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
780 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
781 virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
784 * Implements get method and a private vector member for a typed XML child collection.
786 * @param proper the proper name of the child type
787 * @param fence insertion fence for new objects of the child collection in backing list
789 #define IMPL_TYPED_CHILDREN(proper,fence) \
791 std::vector<proper*> m_##proper##s; \
793 VectorOf(proper) get##proper##s() { \
794 return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
796 const std::vector<proper*>& get##proper##s() const { \
797 return m_##proper##s; \
801 * Implements get method and a private vector member for a typed XML child collection
802 * in a foreign namespace.
804 * @param proper the proper name of the child type
805 * @param ns the C++ namespace for the type
806 * @param fence insertion fence for new objects of the child collection in backing list
808 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
810 std::vector<ns::proper*> m_##proper##s; \
812 VectorOf(ns::proper) get##proper##s() { \
813 return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
815 const std::vector<ns::proper*>& get##proper##s() const { \
816 return m_##proper##s; \
820 * Implements get method and a private vector member for a generic XML child collection.
822 * @param proper the proper name of the child
823 * @param fence insertion fence for new objects of the child collection in backing list
825 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
827 std::vector<xmltooling::XMLObject*> m_##proper##s; \
829 VectorOf(xmltooling::XMLObject) get##proper##s() { \
830 return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
832 const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
833 return m_##proper##s; \
837 * Implements marshalling for a string attribute
839 * @param proper the proper name of the attribute
840 * @param ucase the upcased name of the attribute
841 * @param namespaceURI the XML namespace of the attribute
843 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
845 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
849 * Implements marshalling for a DateTime attribute
851 * @param proper the proper name of the attribute
852 * @param ucase the upcased name of the attribute
853 * @param namespaceURI the XML namespace of the attribute
855 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
857 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
861 * Implements marshalling for an integer attribute
863 * @param proper the proper name of the attribute
864 * @param ucase the upcased name of the attribute
865 * @param namespaceURI the XML namespace of the attribute
867 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
869 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
873 * Implements marshalling for a boolean 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_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
880 switch (m_##proper) { \
881 case xmlconstants::XML_BOOL_TRUE: \
882 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
884 case xmlconstants::XML_BOOL_ONE: \
885 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
887 case xmlconstants::XML_BOOL_FALSE: \
888 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
890 case xmlconstants::XML_BOOL_ZERO: \
891 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
893 case xmlconstants::XML_BOOL_NULL: \
898 * Implements marshalling for a QName attribute
900 * @param proper the proper name of the attribute
901 * @param ucase the upcased name of the attribute
902 * @param namespaceURI the XML namespace of the attribute
904 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
906 auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
907 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
911 * Implements marshalling for an ID attribute
913 * @param proper the proper name of the attribute
914 * @param ucase the upcased name of the attribute
915 * @param namespaceURI the XML namespace of the attribute
917 #define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
919 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
920 domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
924 * Implements unmarshalling process branch for a string attribute
926 * @param proper the proper name of the attribute
927 * @param ucase the upcased name of the attribute
928 * @param namespaceURI the XML namespace of the attribute
930 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
931 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
932 set##proper(attribute->getValue()); \
937 * Implements unmarshalling process branch for an ID attribute
939 * @param proper the proper name of the attribute
940 * @param ucase the upcased name of the attribute
941 * @param namespaceURI the XML namespace of the attribute
943 #define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
944 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
945 set##proper(attribute->getValue()); \
946 attribute->getOwnerElement()->setIdAttributeNode(attribute); \
951 * Implements unmarshalling process branch for a DateTime attribute
953 * @param proper the proper name of the attribute
954 * @param ucase the upcased name of the attribute
955 * @param namespaceURI the XML namespace of the attribute
957 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
958 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
961 * Implements unmarshalling process branch for a DateTime attribute
963 * @param proper the proper name of the attribute
964 * @param ucase the upcased name of the attribute
965 * @param namespaceURI the XML namespace of the attribute
967 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
968 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
969 set##proper(XMLHelper::getAttributeValueAsQName(attribute)); \
974 * Implements unmarshalling process branch for an integer attribute
976 * @param proper the proper name of the attribute
977 * @param ucase the upcased name of the attribute
978 * @param namespaceURI the XML namespace of the attribute
980 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
981 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
984 * Implements unmarshalling process branch for a boolean attribute
986 * @param proper the proper name of the attribute
987 * @param ucase the upcased name of the attribute
988 * @param namespaceURI the XML namespace of the attribute
990 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
991 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
994 * Implements unmarshalling process branch for typed child collection element
996 * @param proper the proper name of the child type
997 * @param namespaceURI the XML namespace of the child element
998 * @param force bypass use of hint and just cast down to check child
1000 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
1001 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1002 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1004 get##proper##s().push_back(typesafe); \
1010 * Implements unmarshalling process branch for typed child collection element
1011 * in a foreign namespace.
1013 * @param proper the proper name of the child type
1014 * @param ns the C++ namespace for the type
1015 * @param namespaceURI the XML namespace of the child element
1016 * @param force bypass use of hint and just cast down to check child
1018 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
1019 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1020 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1022 get##proper##s().push_back(typesafe); \
1028 * Implements unmarshalling process branch for typed child singleton element
1030 * @param proper the proper name of the child type
1031 * @param namespaceURI the XML namespace of the child element
1032 * @param force bypass use of hint and just cast down to check child
1034 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
1035 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1036 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1038 set##proper(typesafe); \
1044 * Implements unmarshalling process branch for typed child singleton element
1045 * in a foreign namespace.
1047 * @param proper the proper name of the child type
1048 * @param ns the C++ namespace for the type
1049 * @param namespaceURI the XML namespace of the child element
1050 * @param force bypass use of hint and just cast down to check child
1052 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
1053 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1054 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1056 set##proper(typesafe); \
1062 * Implements unmarshalling process branch for a generic child singleton element
1064 * @param proper the proper name of the child type
1065 * @param namespaceURI the XML namespace of the child element
1067 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
1068 if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1069 set##proper(childXMLObject); \
1074 * Declares aliased get/set methods for named XML element simple content.
1076 * @param proper the proper name to label the element's content
1078 #define DECL_SIMPLE_CONTENT(proper) \
1079 XMLTOOLING_DOXYGEN(Returns proper.) \
1080 const XMLCh* get##proper() const { \
1081 return getTextContent(); \
1083 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1084 void set##proper(const XMLCh* proper) { \
1085 setTextContent(proper); \
1089 * Declares aliased get/set methods for named integer XML element content.
1091 * @param proper the proper name to label the element's content
1093 #define DECL_INTEGER_CONTENT(proper) \
1094 XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
1095 std::pair<bool,int> get##proper() const { \
1096 return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : NULL)); \
1098 XMLTOOLING_DOXYGEN(Sets proper.) \
1099 void set##proper(int proper) { \
1101 sprintf(buf,"%d",proper); \
1102 xmltooling::auto_ptr_XMLCh widebuf(buf); \
1103 setTextContent(widebuf.get()); \
1105 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1106 void set##proper(const XMLCh* proper) { \
1107 setTextContent(proper); \
1111 * Implements cloning methods for an XMLObject specialization implementation class.
1113 * @param cname the name of the XMLObject specialization
1115 #define IMPL_XMLOBJECT_CLONE(cname) \
1116 cname* clone##cname() const { \
1117 return dynamic_cast<cname*>(clone()); \
1119 xmltooling::XMLObject* clone() const { \
1120 std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1121 cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1123 domClone.release(); \
1126 return new cname##Impl(*this); \
1130 * Declares an XMLObject specialization with a simple content model and type,
1131 * handling it as string data.
1133 * @param linkage linkage specifier for the class
1134 * @param cname the name of the XMLObject specialization
1135 * @param proper the proper name to label the element's content
1136 * @param desc documentation for class
1138 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
1139 BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
1140 DECL_SIMPLE_CONTENT(proper); \
1144 * Declares and defines an implementation class for an XMLObject with
1145 * a simple content model and type, handling it as string data.
1147 * @param linkage linkage specifier for the class
1148 * @param cname the name of the XMLObject specialization
1150 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
1151 class linkage cname##Impl \
1152 : public virtual cname, \
1153 public xmltooling::AbstractSimpleElement, \
1154 public xmltooling::AbstractDOMCachingXMLObject, \
1155 public xmltooling::AbstractXMLObjectMarshaller, \
1156 public xmltooling::AbstractXMLObjectUnmarshaller \
1159 virtual ~cname##Impl() {} \
1160 cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \
1161 : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
1163 cname##Impl(const cname##Impl& src) \
1164 : xmltooling::AbstractXMLObject(src), \
1165 xmltooling::AbstractSimpleElement(src), \
1166 xmltooling::AbstractDOMCachingXMLObject(src) {} \
1167 IMPL_XMLOBJECT_CLONE(cname) \
1170 #ifdef HAVE_COVARIANT_RETURNS
1173 * Begins the declaration of an XMLObjectBuilder specialization.
1174 * Basic boilerplate includes an empty virtual destructor, and
1175 * a default builder that defaults the element name.
1177 * @param linkage linkage specifier for the class
1178 * @param cname the name of the XMLObject specialization
1179 * @param namespaceURI the XML namespace of the default associated element
1180 * @param namespacePrefix the XML namespace prefix of the default associated element
1182 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1183 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1184 class linkage cname##Builder : public xmltooling::XMLObjectBuilder { \
1186 virtual ~cname##Builder() {} \
1187 XMLTOOLING_DOXYGEN(Default builder.) \
1188 virtual cname* buildObject() const { \
1189 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1191 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1192 virtual cname* buildObject( \
1193 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
1197 * Ends the declaration of an XMLObjectBuilder specialization.
1199 #define END_XMLOBJECTBUILDER }
1202 * Declares a generic XMLObjectBuilder specialization.
1204 * @param linkage linkage specifier for the class
1205 * @param cname the name of the XMLObject specialization
1206 * @param namespaceURI the XML namespace of the default associated element
1207 * @param namespacePrefix the XML namespace prefix of the default associated element
1209 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1210 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1211 XMLTOOLING_DOXYGEN(Singleton builder.) \
1212 static cname* build##cname() { \
1213 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1214 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1217 return b->buildObject(); \
1218 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1220 END_XMLOBJECTBUILDER
1223 * Implements the standard XMLObjectBuilder specialization function.
1225 * @param cname the name of the XMLObject specialization
1227 #define IMPL_XMLOBJECTBUILDER(cname) \
1228 cname* cname##Builder::buildObject( \
1229 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
1232 return new cname##Impl(nsURI,localName,prefix,schemaType); \
1235 #else /* !HAVE_COVARIANT_RETURNS */
1238 * Begins the declaration of an XMLObjectBuilder specialization.
1239 * Basic boilerplate includes an empty virtual destructor, and
1240 * a default builder that defaults the element name.
1242 * @param linkage linkage specifier for the class
1243 * @param cname the name of the XMLObject specialization
1244 * @param namespaceURI the XML namespace of the default associated element
1245 * @param namespacePrefix the XML namespace prefix of the default associated element
1247 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1248 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1249 class linkage cname##Builder : public xmltooling::XMLObjectBuilder { \
1251 virtual ~cname##Builder() {} \
1252 XMLTOOLING_DOXYGEN(Default builder.) \
1253 virtual xmltooling::XMLObject* buildObject() const { \
1254 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1256 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1257 virtual xmltooling::XMLObject* buildObject( \
1258 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
1262 * Ends the declaration of an XMLObjectBuilder specialization.
1264 #define END_XMLOBJECTBUILDER }
1267 * Declares a generic XMLObjectBuilder specialization.
1269 * @param linkage linkage specifier for the class
1270 * @param cname the name of the XMLObject specialization
1271 * @param namespaceURI the XML namespace of the default associated element
1272 * @param namespacePrefix the XML namespace prefix of the default associated element
1274 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1275 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1276 XMLTOOLING_DOXYGEN(Singleton builder.) \
1277 static cname* build##cname() { \
1278 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1279 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1282 return dynamic_cast<cname*>(b->buildObject()); \
1283 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1285 END_XMLOBJECTBUILDER
1288 * Implements the standard XMLObjectBuilder specialization function.
1290 * @param cname the name of the XMLObject specialization
1292 #define IMPL_XMLOBJECTBUILDER(cname) \
1293 xmltooling::XMLObject* cname##Builder::buildObject( \
1294 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
1297 return new cname##Impl(nsURI,localName,prefix,schemaType); \
1300 #endif /* HAVE_COVARIANT_RETURNS */
1303 * Begins the declaration of a Schema Validator specialization.
1305 * @param linkage linkage specifier for the class
1306 * @param cname the base name of the Validator specialization
1308 #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
1309 class linkage cname##SchemaValidator : public xmltooling::Validator \
1312 virtual ~cname##SchemaValidator() {} \
1313 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1314 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1316 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1319 * Begins the declaration of a Schema Validator specialization subclass.
1321 * @param linkage linkage specifier for the class
1322 * @param cname the base name of the Validator specialization
1323 * @param base base class for the validator
1325 #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
1326 class linkage cname##SchemaValidator : public base##SchemaValidator \
1329 virtual ~cname##SchemaValidator() {} \
1330 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1331 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1333 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1336 * Ends the declaration of a Validator specialization.
1338 #define END_XMLOBJECTVALIDATOR } }
1341 * Validator code that checks the object type.
1343 * @param cname the name of the XMLObject specialization
1345 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
1346 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1348 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1351 * Validator code that checks for a required attribute, content, or singleton.
1353 * @param cname the name of the XMLObject specialization
1354 * @param proper the proper name of the attribute, content, or singleton member
1356 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
1357 if (!ptr->get##proper()) \
1358 throw xmltooling::ValidationException(#cname" must have "#proper".")
1361 * Validator code that checks for a required integer attribute
1363 * @param cname the name of the XMLObject specialization
1364 * @param proper the proper name of the attribute, content, or singleton member
1366 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
1367 if (!ptr->get##proper().first) \
1368 throw xmltooling::ValidationException(#cname" must have "#proper".")
1371 * Validator code that checks for one of a pair of
1372 * required attributes, content, or singletons.
1374 * @param cname the name of the XMLObject specialization
1375 * @param proper1 the proper name of the first attribute, content, or singleton member
1376 * @param proper2 the proper name of the second attribute, content, or singleton member
1378 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
1379 if (!ptr->get##proper1() && !ptr->get##proper2()) \
1380 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
1383 * Validator code that checks for one of a pair of
1384 * required attributes, content, or singletons, but disallows both.
1386 * @param cname the name of the XMLObject specialization
1387 * @param proper1 the proper name of the first attribute, content, or singleton member
1388 * @param proper2 the proper name of the second attribute, content, or singleton member
1390 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
1391 if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
1392 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
1395 * Validator code that checks for one of a set of three
1396 * required attributes, content, or singletons.
1398 * @param cname the name of the XMLObject specialization
1399 * @param proper1 the proper name of the first attribute, content, or singleton member
1400 * @param proper2 the proper name of the second attribute, content, or singleton member
1401 * @param proper3 the proper name of the third attribute, content, or singleton member
1403 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
1404 if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
1405 throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
1408 * Validator code that checks for one of a set of three
1409 * required attributes, content, or singletons but disallows more than one.
1411 * @param cname the name of the XMLObject specialization
1412 * @param proper1 the proper name of the first attribute, content, or singleton member
1413 * @param proper2 the proper name of the second attribute, content, or singleton member
1414 * @param proper3 the proper name of the third attribute, content, or singleton member
1416 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
1417 int c##proper1##proper2##proper3=0; \
1418 if (ptr->get##proper1()!=NULL) \
1419 c##proper1##proper2##proper3++; \
1420 if (ptr->get##proper2()!=NULL) \
1421 c##proper1##proper2##proper3++; \
1422 if (ptr->get##proper3()!=NULL) \
1423 c##proper1##proper2##proper3++; \
1424 if (c##proper1##proper2##proper3 != 1) \
1425 throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
1428 * Validator code that checks a co-constraint (if one present, the other must be)
1429 * between a pair of attributes, content, or singletons.
1431 * @param cname the name of the XMLObject specialization
1432 * @param proper1 the proper name of the first attribute, content, or singleton member
1433 * @param proper2 the proper name of the second attribute, content, or singleton member
1435 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
1436 if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
1437 throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
1440 * Validator code that checks for a non-empty collection.
1442 * @param cname the name of the XMLObject specialization
1443 * @param proper the proper name of the collection item
1445 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
1446 if (ptr->get##proper##s().empty()) \
1447 throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
1450 * Declares/defines a Validator specialization that checks object type and
1451 * a non-empty simple content model.
1453 * @param linkage linkage specifier for the class
1454 * @param cname the name of the XMLObject specialization
1456 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
1457 BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
1458 XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
1459 END_XMLOBJECTVALIDATOR
1464 * @namespace xmltooling
1465 * Public namespace of XML Tooling library
1467 namespace xmltooling {
1470 * Template function for cloning a sequence of XMLObjects.
1471 * Invokes the clone() member on each element of the input sequence and adds the copy to
1472 * the output sequence. Order is preserved.
1474 * @param in input sequence to clone
1475 * @param out output sequence to copy cloned pointers into
1477 template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
1478 for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
1480 out.push_back((*i)->clone());
1487 * Functor for cleaning up heap objects in containers.
1489 template<class T> struct cleanup
1492 * Function operator to delete an object.
1494 * @param ptr object to delete
1496 void operator()(T* ptr) {delete ptr;}
1499 * Function operator to delete an object stored as const.
1501 * @param ptr object to delete after casting away const
1503 void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
1507 * Functor for cleaning up heap objects in key/value containers.
1509 template<class A,class B> struct cleanup_pair
1512 * Function operator to delete an object.
1514 * @param p a pair in which the second component is the object to delete
1516 void operator()(const std::pair<const A,B*>& p) {delete p.second;}
1520 * Functor for cleaning up const heap objects in key/value containers.
1522 template<class A,class B> struct cleanup_const_pair
1525 * Function operator to delete an object stored as const
1527 * @param p a pair in which the second component is the const object to delete
1529 void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
1533 #endif /* __xmltooling_base_h__ */