2 * Copyright 2001-2008 Internet2
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 * @file xmltooling/base.h
\r
20 * Base header file definitions
\r
21 * Must be included prior to including any other header
\r
24 #ifndef __xmltooling_base_h__
\r
25 #define __xmltooling_base_h__
\r
29 /* Required for sprintf, used by integer XML attribute macros. */
\r
32 #if defined (_MSC_VER) || defined(__BORLANDC__)
\r
33 #include <xmltooling/config_pub_win32.h>
\r
35 #include <xmltooling/config_pub.h>
\r
38 #ifdef XMLTOOLING_LITE
\r
39 # define XMLTOOLING_NO_XMLSEC 1
\r
42 // Windows and GCC4 Symbol Visibility Macros
\r
44 #define XMLTOOL_IMPORT __declspec(dllimport)
\r
45 #define XMLTOOL_EXPORT __declspec(dllexport)
\r
46 #define XMLTOOL_DLLLOCAL
\r
47 #define XMLTOOL_DLLPUBLIC
\r
49 #define XMLTOOL_IMPORT
\r
50 #ifdef GCC_HASCLASSVISIBILITY
\r
51 #define XMLTOOL_EXPORT __attribute__ ((visibility("default")))
\r
52 #define XMLTOOL_DLLLOCAL __attribute__ ((visibility("hidden")))
\r
53 #define XMLTOOL_DLLPUBLIC __attribute__ ((visibility("default")))
\r
55 #define XMLTOOL_EXPORT
\r
56 #define XMLTOOL_DLLLOCAL
\r
57 #define XMLTOOL_DLLPUBLIC
\r
61 // Define XMLTOOL_API for DLL builds
\r
62 #ifdef XMLTOOLING_EXPORTS
\r
63 #define XMLTOOL_API XMLTOOL_EXPORT
\r
65 #define XMLTOOL_API XMLTOOL_IMPORT
\r
68 // Throwable classes must always be visible on GCC in all binaries
\r
70 #define XMLTOOL_EXCEPTIONAPI(api) api
\r
71 #elif defined(GCC_HASCLASSVISIBILITY)
\r
72 #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT
\r
74 #define XMLTOOL_EXCEPTIONAPI(api)
\r
78 #define XMLTOOLING_DOXYGEN(desc) /##** desc */
\r
80 #define XMLTOOLING_DOXYGEN(desc)
\r
84 * Blocks copy c'tor and assignment operator for a class.
\r
86 #define MAKE_NONCOPYABLE(type) \
\r
88 type(const type&); \
\r
89 type& operator=(const type&)
\r
91 #ifndef DOXYGEN_SKIP
\r
95 #define UNICODE_LITERAL_1(a) {xercesc::chLatin_##a, xercesc::chNull}
\r
96 #define UNICODE_LITERAL_2(a,b) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chNull}
\r
97 #define UNICODE_LITERAL_3(a,b,c) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chNull}
\r
98 #define UNICODE_LITERAL_4(a,b,c,d) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chNull}
\r
99 #define UNICODE_LITERAL_5(a,b,c,d,e) \
\r
100 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chNull}
\r
101 #define UNICODE_LITERAL_6(a,b,c,d,e,f) \
\r
102 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chNull}
\r
103 #define UNICODE_LITERAL_7(a,b,c,d,e,f,g) \
\r
104 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chNull}
\r
105 #define UNICODE_LITERAL_8(a,b,c,d,e,f,g,h) \
\r
106 {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}
\r
107 #define UNICODE_LITERAL_9(a,b,c,d,e,f,g,h,i) \
\r
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, xercesc::chNull}
\r
109 #define UNICODE_LITERAL_10(a,b,c,d,e,f,g,h,i,j) \
\r
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, \
\r
111 xercesc::chLatin_##j, xercesc::chNull}
\r
112 #define UNICODE_LITERAL_11(a,b,c,d,e,f,g,h,i,j,k) \
\r
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, \
\r
114 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chNull}
\r
115 #define UNICODE_LITERAL_12(a,b,c,d,e,f,g,h,i,j,k,l) \
\r
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, \
\r
117 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chNull}
\r
118 #define UNICODE_LITERAL_13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
\r
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, \
\r
120 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chNull}
\r
121 #define UNICODE_LITERAL_14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
\r
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, \
\r
123 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chNull}
\r
124 #define UNICODE_LITERAL_15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
\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, \
\r
126 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chNull}
\r
127 #define UNICODE_LITERAL_16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
\r
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, \
\r
129 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chNull}
\r
130 #define UNICODE_LITERAL_17(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) \
\r
131 {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, \
\r
132 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}
\r
133 #define UNICODE_LITERAL_18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) \
\r
134 {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, \
\r
135 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}
\r
136 #define UNICODE_LITERAL_19(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) \
\r
137 {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, \
\r
138 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, \
\r
139 xercesc::chLatin_##s, xercesc::chNull}
\r
140 #define UNICODE_LITERAL_20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) \
\r
141 {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, \
\r
142 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, \
\r
143 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chNull}
\r
144 #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) \
\r
145 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
146 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, \
\r
147 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chNull}
\r
148 #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) \
\r
149 {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, \
\r
150 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, \
\r
151 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chNull}
\r
152 #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) \
\r
153 {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, \
\r
154 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, \
\r
155 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chNull}
\r
156 #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) \
\r
157 {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, \
\r
158 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, \
\r
159 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chNull}
\r
160 #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) \
\r
161 {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, \
\r
162 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, \
\r
163 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chNull}
\r
164 #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) \
\r
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, \
\r
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, \
\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, xercesc::chNull}
\r
168 #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) \
\r
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, \
\r
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, \
\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, \
\r
172 xercesc::chLatin_##aa, xercesc::chNull}
\r
173 #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) \
\r
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, \
\r
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, \
\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, \
\r
177 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chNull}
\r
178 #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) \
\r
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, \
\r
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, \
\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, \
\r
182 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chNull}
\r
183 #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) \
\r
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, \
\r
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, \
\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, \
\r
187 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chNull}
\r
188 #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) \
\r
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, \
\r
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, \
\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, \
\r
192 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chNull}
\r
193 #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) \
\r
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, \
\r
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, \
\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, \
\r
197 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chNull}
\r
198 #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) \
\r
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, \
\r
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, \
\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, \
\r
202 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chNull}
\r
203 #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) \
\r
204 {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, \
\r
205 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, \
\r
206 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
\r
207 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}
\r
208 #endif /* DOXYGEN_SKIP */
\r
211 * Begins the declaration of an XMLObject specialization for an abstract element/type.
\r
212 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
213 * and Unicode constants for the default associated element's name and prefix.
\r
215 * @param linkage linkage specifier for the class
\r
216 * @param cname the name of the class to declare
\r
217 * @param base the base class to derive from using public virtual inheritance
\r
218 * @param desc documentation comment for class
\r
220 #define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \
\r
221 XMLTOOLING_DOXYGEN(desc) \
\r
222 class linkage cname : public virtual base { \
\r
226 virtual ~cname() {} \
\r
227 XMLTOOLING_DOXYGEN(Element local name) \
\r
228 static const XMLCh LOCAL_NAME[]; \
\r
232 * Begins the declaration of an XMLObject specialization.
\r
233 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
234 * and Unicode constants for the default associated element's name and prefix.
\r
236 * @param linkage linkage specifier for the class
\r
237 * @param cname the name of the class to declare
\r
238 * @param base the base class to derive from using public virtual inheritance
\r
239 * @param desc documentation comment for class
\r
241 #define BEGIN_XMLOBJECT(linkage,cname,base,desc) \
\r
242 XMLTOOLING_DOXYGEN(desc) \
\r
243 class linkage cname : public virtual base { \
\r
247 virtual ~cname() {} \
\r
248 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
249 virtual cname* clone##cname() const=0; \
\r
250 XMLTOOLING_DOXYGEN(Element local name) \
\r
251 static const XMLCh LOCAL_NAME[]
\r
254 * Begins the declaration of an XMLObject specialization with two base classes.
\r
255 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
256 * and Unicode constants for the default associated element's name and prefix.
\r
258 * @param linkage linkage specifier for the class
\r
259 * @param cname the name of the class to declare
\r
260 * @param base the first base class to derive from using public virtual inheritance
\r
261 * @param base2 the second base class to derive from using public virtual inheritance
\r
262 * @param desc documentation comment for class
\r
264 #define BEGIN_XMLOBJECT2(linkage,cname,base,base2,desc) \
\r
265 XMLTOOLING_DOXYGEN(desc) \
\r
266 class linkage cname : public virtual base, public virtual base2 { \
\r
270 virtual ~cname() {} \
\r
271 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
272 virtual cname* clone##cname() const=0; \
\r
273 XMLTOOLING_DOXYGEN(Element local name) \
\r
274 static const XMLCh LOCAL_NAME[]
\r
277 * Begins the declaration of an XMLObject specialization with three base classes.
\r
278 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
279 * and Unicode constants for the default associated element's name and prefix.
\r
281 * @param linkage linkage specifier for the class
\r
282 * @param cname the name of the class to declare
\r
283 * @param base the first base class to derive from using public virtual inheritance
\r
284 * @param base2 the second base class to derive from using public virtual inheritance
\r
285 * @param base3 the third base class to derive from using public virtual inheritance
\r
286 * @param desc documentation comment for class
\r
288 #define BEGIN_XMLOBJECT3(linkage,cname,base,base2,base3,desc) \
\r
289 XMLTOOLING_DOXYGEN(desc) \
\r
290 class linkage cname : public virtual base, public virtual base2, public virtual base3 { \
\r
294 virtual ~cname() {} \
\r
295 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
296 virtual cname* clone##cname() const=0; \
\r
297 XMLTOOLING_DOXYGEN(Element local name) \
\r
298 static const XMLCh LOCAL_NAME[]
\r
301 * Begins the declaration of an XMLObject specialization with four base classes.
\r
302 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
303 * and Unicode constants for the default associated element's name and prefix.
\r
305 * @param linkage linkage specifier for the class
\r
306 * @param cname the name of the class to declare
\r
307 * @param base the first base class to derive from using public virtual inheritance
\r
308 * @param base2 the second base class to derive from using public virtual inheritance
\r
309 * @param base3 the third base class to derive from using public virtual inheritance
\r
310 * @param base4 the fourth base class to derive from using public virtual inheritance
\r
311 * @param desc documentation comment for class
\r
313 #define BEGIN_XMLOBJECT4(linkage,cname,base,base2,base3,base4,desc) \
\r
314 XMLTOOLING_DOXYGEN(desc) \
\r
315 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4 { \
\r
319 virtual ~cname() {} \
\r
320 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
321 virtual cname* clone##cname() const=0; \
\r
322 XMLTOOLING_DOXYGEN(Element local name) \
\r
323 static const XMLCh LOCAL_NAME[]
\r
326 * Begins the declaration of an XMLObject specialization with five base classes.
\r
327 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
328 * and Unicode constants for the default associated element's name and prefix.
\r
330 * @param linkage linkage specifier for the class
\r
331 * @param cname the name of the class to declare
\r
332 * @param base the first base class to derive from using public virtual inheritance
\r
333 * @param base2 the second base class to derive from using public virtual inheritance
\r
334 * @param base3 the third base class to derive from using public virtual inheritance
\r
335 * @param base4 the fourth base class to derive from using public virtual inheritance
\r
336 * @param base5 the fifth base class to derive from using public virtual inheritance
\r
337 * @param desc documentation comment for class
\r
339 #define BEGIN_XMLOBJECT5(linkage,cname,base,base2,base3,base4,base5,desc) \
\r
340 XMLTOOLING_DOXYGEN(desc) \
\r
341 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4, public virtual base5 { \
\r
345 virtual ~cname() {} \
\r
346 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
347 virtual cname* clone##cname() const=0; \
\r
348 XMLTOOLING_DOXYGEN(Element local name) \
\r
349 static const XMLCh LOCAL_NAME[]
\r
352 * Ends the declaration of an XMLObject specialization.
\r
354 #define END_XMLOBJECT }
\r
357 * Declares a static variable holding the XMLObject's element QName.
\r
359 #define DECL_ELEMENT_QNAME \
\r
361 XMLTOOLING_DOXYGEN(Element QName) \
\r
362 static xmltooling::QName ELEMENT_QNAME
\r
365 * Declares a static variable holding the XMLObject's schema type QName.
\r
367 #define DECL_TYPE_QNAME \
\r
369 XMLTOOLING_DOXYGEN(Type QName) \
\r
370 static xmltooling::QName TYPE_QNAME
\r
373 * Implements a static variable holding an XMLObject's element QName.
\r
375 * @param cname the name of the XMLObject specialization
\r
376 * @param namespaceURI the XML namespace of the default associated element
\r
377 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
379 #define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \
\r
380 xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)
\r
383 * Implements a static variable holding an XMLObject's schema type QName.
\r
385 * @param cname the name of the XMLObject specialization
\r
386 * @param namespaceURI the XML namespace of the default associated element
\r
387 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
389 #define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \
\r
390 xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)
\r
393 * Declares abstract set method for a typed XML attribute.
\r
394 * The get method is omitted.
\r
396 * @param proper the proper name of the attribute
\r
397 * @param upcased the upcased name of the attribute
\r
398 * @param type the attribute's data type
\r
400 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \
\r
402 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
403 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
404 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
405 virtual void set##proper(const type* proper)=0
\r
408 * Declares abstract get/set methods for a typed XML attribute.
\r
410 * @param proper the proper name of the attribute
\r
411 * @param upcased the upcased name of the attribute
\r
412 * @param type the attribute's data type
\r
414 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \
\r
416 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
417 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
418 XMLTOOLING_DOXYGEN(Returns the proper attribute.) \
\r
419 virtual const type* get##proper() const=0; \
\r
420 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
421 virtual void set##proper(const type* proper)=0
\r
424 * Declares abstract set method for a string XML attribute.
\r
425 * The get method is omitted.
\r
427 * @param proper the proper name of the attribute
\r
428 * @param upcased the upcased name of the attribute
\r
430 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \
\r
431 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
\r
434 * Declares abstract get/set methods for a string XML attribute.
\r
436 * @param proper the proper name of the attribute
\r
437 * @param upcased the upcased name of the attribute
\r
439 #define DECL_STRING_ATTRIB(proper,upcased) \
\r
440 DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
\r
443 * Declares abstract set method for a DateTime XML attribute.
\r
444 * The get method is omitted.
\r
446 * @param proper the proper name of the attribute
\r
447 * @param upcased the upcased name of the attribute
\r
449 #define DECL_INHERITED_DATETIME_ATTRIB(proper,upcased) \
\r
450 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
\r
451 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
452 virtual void set##proper(time_t proper)=0; \
\r
453 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
454 virtual void set##proper(const XMLCh* proper)=0
\r
457 * Declares abstract get/set methods for a DateTime XML attribute.
\r
459 * @param proper the proper name of the attribute
\r
460 * @param upcased the upcased name of the attribute
\r
462 #define DECL_DATETIME_ATTRIB(proper,upcased) \
\r
463 DECL_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
\r
464 XMLTOOLING_DOXYGEN(Returns the proper attribute in epoch form.) \
\r
465 virtual time_t get##proper##Epoch() const=0; \
\r
466 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
467 virtual void set##proper(time_t proper)=0; \
\r
468 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
469 virtual void set##proper(const XMLCh* proper)=0
\r
472 * Declares abstract set method for an integer XML attribute.
\r
473 * The get method is omitted.
\r
475 * @param proper the proper name of the attribute
\r
476 * @param upcased the upcased name of the attribute
\r
478 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \
\r
480 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
481 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
482 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
\r
483 virtual void set##proper(const XMLCh* proper)=0; \
\r
484 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
485 virtual void set##proper(int proper)=0
\r
488 * Declares abstract get/set methods for an integer XML attribute.
\r
490 * @param proper the proper name of the attribute
\r
491 * @param upcased the upcased name of the attribute
\r
493 #define DECL_INTEGER_ATTRIB(proper,upcased) \
\r
495 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
496 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
497 XMLTOOLING_DOXYGEN(Returns the proper attribute after a NULL indicator.) \
\r
498 virtual std::pair<bool,int> get##proper() const=0; \
\r
499 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
\r
500 virtual void set##proper(const XMLCh* proper)=0; \
\r
501 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
502 virtual void set##proper(int proper)=0
\r
505 * Declares abstract get/set methods for a boolean XML attribute.
\r
507 * @param proper the proper name of the attribute
\r
508 * @param upcased the upcased name of the attribute
\r
509 * @param def the default/presumed value, if no explicit value has been set
\r
511 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \
\r
513 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
514 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
515 XMLTOOLING_DOXYGEN(Returns the proper attribute or def if not set.) \
\r
516 bool proper() const { \
\r
517 switch (get##proper()) { \
\r
518 case xmlconstants::XML_BOOL_TRUE: \
\r
519 case xmlconstants::XML_BOOL_ONE: \
\r
521 case xmlconstants::XML_BOOL_FALSE: \
\r
522 case xmlconstants::XML_BOOL_ZERO: \
\r
528 XMLTOOLING_DOXYGEN(Returns the proper attribute as an explicit enumerated value.) \
\r
529 virtual xmlconstants::xmltooling_bool_t get##proper() const=0; \
\r
530 XMLTOOLING_DOXYGEN(Sets the proper attribute using an enumerated value.) \
\r
531 virtual void proper(xmlconstants::xmltooling_bool_t value)=0; \
\r
532 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
533 void proper(bool value) { \
\r
534 proper(value ? xmlconstants::XML_BOOL_ONE : xmlconstants::XML_BOOL_ZERO); \
\r
536 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \
\r
537 void set##proper(const XMLCh* value) { \
\r
539 switch (*value) { \
\r
540 case xercesc::chLatin_t: \
\r
541 proper(xmlconstants::XML_BOOL_TRUE); \
\r
543 case xercesc::chLatin_f: \
\r
544 proper(xmlconstants::XML_BOOL_FALSE); \
\r
546 case xercesc::chDigit_1: \
\r
547 proper(xmlconstants::XML_BOOL_ONE); \
\r
549 case xercesc::chDigit_0: \
\r
550 proper(xmlconstants::XML_BOOL_ZERO); \
\r
553 proper(xmlconstants::XML_BOOL_NULL); \
\r
557 proper(xmlconstants::XML_BOOL_NULL); \
\r
561 * Implements get/set methods and a private member for a typed XML attribute.
\r
563 * @param proper the proper name of the attribute
\r
564 * @param type the attribute's data type
\r
566 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \
\r
568 type* m_##proper; \
\r
570 const type* get##proper() const { \
\r
571 return m_##proper; \
\r
573 void set##proper(const type* proper) { \
\r
574 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
578 * Implements get/set methods and a private member for a string XML attribute.
\r
580 * @param proper the proper name of the attribute
\r
582 #define IMPL_STRING_ATTRIB(proper) \
\r
583 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)
\r
586 * Implements get/set methods and a private member for a string XML attribute,
\r
587 * plus a getXMLID override.
\r
589 * @param proper the proper name of the attribute
\r
591 #define IMPL_ID_ATTRIB(proper) \
\r
592 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
\r
593 const XMLCh* getXMLID() const { \
\r
594 return m_##proper; \
\r
598 * Implements get/set methods and a private member for a DateTime XML attribute.
\r
600 * @param proper the proper name of the attribute
\r
601 * @param fallback epoch to return when attribute is NULL
\r
603 #define IMPL_DATETIME_ATTRIB(proper,fallback) \
\r
604 IMPL_DATETIME_ATTRIB_EX(proper,fallback,false)
\r
607 * Implements get/set methods and a private member for a duration-valued DateTime XML attribute.
\r
609 * @param proper the proper name of the attribute
\r
610 * @param fallback epoch to return when attribute is NULL
\r
612 #define IMPL_DURATION_ATTRIB(proper,fallback) \
\r
613 IMPL_DATETIME_ATTRIB_EX(proper,fallback,true)
\r
616 * Implements get/set methods and a private member for a DateTime XML attribute.
\r
618 * @param proper the proper name of the attribute
\r
619 * @param fallback epoch to return when attribute is NULL
\r
620 * @param duration true iff the attribute should be handled as a duration
\r
622 #define IMPL_DATETIME_ATTRIB_EX(proper,fallback,duration) \
\r
624 DateTime* m_##proper; \
\r
625 time_t m_##proper##Epoch; \
\r
627 const DateTime* get##proper() const { \
\r
628 return m_##proper; \
\r
630 time_t get##proper##Epoch() const { \
\r
631 return m_##proper ? m_##proper##Epoch : fallback; \
\r
633 void set##proper(const DateTime* proper) { \
\r
634 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
636 m_##proper##Epoch=m_##proper->getEpoch(duration); \
\r
638 void set##proper(time_t proper) { \
\r
639 m_##proper = prepareForAssignment(m_##proper,proper,duration); \
\r
640 m_##proper##Epoch = proper; \
\r
642 void set##proper(const XMLCh* proper) { \
\r
643 m_##proper = prepareForAssignment(m_##proper,proper,duration); \
\r
645 m_##proper##Epoch=m_##proper->getEpoch(); \
\r
649 * Implements get/set methods and a private member for an integer XML attribute.
\r
651 * @param proper the proper name of the attribute
\r
653 #define IMPL_INTEGER_ATTRIB(proper) \
\r
655 XMLCh* m_##proper; \
\r
657 pair<bool,int> get##proper() const { \
\r
658 return make_pair((m_##proper!=NULL),(m_##proper!=NULL ? xercesc::XMLString::parseInt(m_##proper): 0)); \
\r
660 void set##proper(const XMLCh* proper) { \
\r
661 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
663 void set##proper(int proper) { \
\r
664 char buf##proper[64]; \
\r
665 sprintf(buf##proper,"%d",proper); \
\r
666 auto_ptr_XMLCh wide##proper(buf##proper); \
\r
667 set##proper(wide##proper.get()); \
\r
671 * Implements get/set methods and a private member for a boolean XML attribute.
\r
673 * @param proper the proper name of the attribute
\r
675 #define IMPL_BOOLEAN_ATTRIB(proper) \
\r
677 xmlconstants::xmltooling_bool_t m_##proper; \
\r
679 xmlconstants::xmltooling_bool_t get##proper() const { \
\r
680 return m_##proper; \
\r
682 void proper(xmlconstants::xmltooling_bool_t value) { \
\r
683 if (m_##proper != value) { \
\r
684 releaseThisandParentDOM(); \
\r
685 m_##proper = value; \
\r
690 * Implements get/set methods and a private member for a typed, qualified XML attribute.
\r
692 * @param proper the proper name of the attribute
\r
693 * @param type the attribute's data type
\r
695 #define IMPL_XMLOBJECT_FOREIGN_ATTRIB(proper,type) \
\r
697 XMLCh* m_##proper##Prefix; \
\r
698 type* m_##proper; \
\r
700 const type* get##proper() const { \
\r
701 return m_##proper; \
\r
703 void set##proper(const type* proper) { \
\r
704 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
705 XMLString::release(&m_##proper##Prefix); \
\r
706 m_##proper##Prefix = NULL; \
\r
710 * Declares abstract set method for a typed XML child object in a foreign namespace.
\r
711 * The get method is omitted.
\r
713 * @param proper the proper name of the child type
\r
714 * @param ns the C++ namespace for the type
\r
716 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
\r
718 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
719 virtual void set##proper(ns::proper* child)=0
\r
722 * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
\r
724 * @param proper the proper name of the child type
\r
725 * @param ns the C++ namespace for the type
\r
727 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
\r
729 XMLTOOLING_DOXYGEN(Returns the proper child.) \
\r
730 virtual ns::proper* get##proper() const=0; \
\r
731 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
732 virtual void set##proper(ns::proper* child)=0
\r
735 * Declares abstract set method for a typed XML child object.
\r
736 * The get method is omitted.
\r
738 * @param proper the proper name of the child type
\r
740 #define DECL_INHERITED_TYPED_CHILD(proper) \
\r
742 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
743 virtual void set##proper(proper* child)=0
\r
746 * Declares abstract get/set methods for a typed XML child object.
\r
748 * @param proper the proper name of the child type
\r
750 #define DECL_TYPED_CHILD(proper) \
\r
752 XMLTOOLING_DOXYGEN(Returns the proper child.) \
\r
753 virtual proper* get##proper() const=0; \
\r
754 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
755 virtual void set##proper(proper* child)=0
\r
758 * Declares abstract get/set methods for a generic XML child object.
\r
760 * @param proper the proper name of the child
\r
762 #define DECL_XMLOBJECT_CHILD(proper) \
\r
764 XMLTOOLING_DOXYGEN(Returns the proper child.) \
\r
765 virtual xmltooling::XMLObject* get##proper() const=0; \
\r
766 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
767 virtual void set##proper(xmltooling::XMLObject* child)=0
\r
771 * Implements get/set methods and a private list iterator member for a typed XML child object.
\r
773 * @param proper the proper name of the child type
\r
775 #define IMPL_TYPED_CHILD(proper) \
\r
777 proper* m_##proper; \
\r
778 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
\r
780 proper* get##proper() const { \
\r
781 return m_##proper; \
\r
783 void set##proper(proper* child) { \
\r
784 prepareForAssignment(m_##proper,child); \
\r
785 *m_pos_##proper = m_##proper = child; \
\r
789 * Implements get/set methods and a private list iterator member for
\r
790 * a typed XML child object in a foreign namespace
\r
792 * @param proper the proper name of the child type
\r
793 * @param ns the C++ namespace for the type
\r
795 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
\r
797 ns::proper* m_##proper; \
\r
798 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
\r
800 ns::proper* get##proper() const { \
\r
801 return m_##proper; \
\r
803 void set##proper(ns::proper* child) { \
\r
804 prepareForAssignment(m_##proper,child); \
\r
805 *m_pos_##proper = m_##proper = child; \
\r
809 * Implements get/set methods and a private list iterator member for a generic XML child object.
\r
811 * @param proper the proper name of the child
\r
813 #define IMPL_XMLOBJECT_CHILD(proper) \
\r
815 xmltooling::XMLObject* m_##proper; \
\r
816 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
\r
818 xmltooling::XMLObject* get##proper() const { \
\r
819 return m_##proper; \
\r
821 void set##proper(xmltooling::XMLObject* child) { \
\r
822 prepareForAssignment(m_##proper,child); \
\r
823 *m_pos_##proper = m_##proper = child; \
\r
827 * Declares abstract get/set methods for a typed XML child collection.
\r
829 * @param proper the proper name of the child type
\r
831 #define DECL_TYPED_CHILDREN(proper) \
\r
833 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
\r
834 virtual VectorOf(proper) get##proper##s()=0; \
\r
835 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
\r
836 virtual const std::vector<proper*>& get##proper##s() const=0
\r
839 * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
\r
841 * @param proper the proper name of the child type
\r
842 * @param ns the C++ namespace for the type
\r
844 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
\r
846 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
\r
847 virtual VectorOf(ns::proper) get##proper##s()=0; \
\r
848 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
\r
849 virtual const std::vector<ns::proper*>& get##proper##s() const=0
\r
852 * Declares abstract get/set methods for a generic XML child collection.
\r
854 * @param proper the proper name of the child
\r
856 #define DECL_XMLOBJECT_CHILDREN(proper) \
\r
858 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
\r
859 virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
\r
860 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
\r
861 virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
\r
864 * Implements get method and a private vector member for a typed XML child collection.
\r
866 * @param proper the proper name of the child type
\r
867 * @param fence insertion fence for new objects of the child collection in backing list
\r
869 #define IMPL_TYPED_CHILDREN(proper,fence) \
\r
871 std::vector<proper*> m_##proper##s; \
\r
873 VectorOf(proper) get##proper##s() { \
\r
874 return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
\r
876 const std::vector<proper*>& get##proper##s() const { \
\r
877 return m_##proper##s; \
\r
881 * Implements get method and a private vector member for a typed XML child collection
\r
882 * in a foreign namespace.
\r
884 * @param proper the proper name of the child type
\r
885 * @param ns the C++ namespace for the type
\r
886 * @param fence insertion fence for new objects of the child collection in backing list
\r
888 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
\r
890 std::vector<ns::proper*> m_##proper##s; \
\r
892 VectorOf(ns::proper) get##proper##s() { \
\r
893 return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
\r
895 const std::vector<ns::proper*>& get##proper##s() const { \
\r
896 return m_##proper##s; \
\r
900 * Implements get method and a private vector member for a generic XML child collection.
\r
902 * @param proper the proper name of the child
\r
903 * @param fence insertion fence for new objects of the child collection in backing list
\r
905 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
\r
907 std::vector<xmltooling::XMLObject*> m_##proper##s; \
\r
909 VectorOf(xmltooling::XMLObject) get##proper##s() { \
\r
910 return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
\r
912 const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
\r
913 return m_##proper##s; \
\r
917 * Implements marshalling for a string attribute
\r
919 * @param proper the proper name of the attribute
\r
920 * @param ucase the upcased name of the attribute
\r
921 * @param namespaceURI the XML namespace of the attribute
\r
923 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
\r
924 if (m_##proper && *m_##proper) { \
\r
925 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
\r
929 * Implements marshalling for a DateTime attribute
\r
931 * @param proper the proper name of the attribute
\r
932 * @param ucase the upcased name of the attribute
\r
933 * @param namespaceURI the XML namespace of the attribute
\r
935 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
\r
936 if (m_##proper) { \
\r
937 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
\r
941 * Implements marshalling for an integer attribute
\r
943 * @param proper the proper name of the attribute
\r
944 * @param ucase the upcased name of the attribute
\r
945 * @param namespaceURI the XML namespace of the attribute
\r
947 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
\r
948 if (m_##proper && *m_##proper) { \
\r
949 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
\r
953 * Implements marshalling for a boolean attribute
\r
955 * @param proper the proper name of the attribute
\r
956 * @param ucase the upcased name of the attribute
\r
957 * @param namespaceURI the XML namespace of the attribute
\r
959 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
\r
960 switch (m_##proper) { \
\r
961 case xmlconstants::XML_BOOL_TRUE: \
\r
962 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
\r
964 case xmlconstants::XML_BOOL_ONE: \
\r
965 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
\r
967 case xmlconstants::XML_BOOL_FALSE: \
\r
968 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
\r
970 case xmlconstants::XML_BOOL_ZERO: \
\r
971 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
\r
973 case xmlconstants::XML_BOOL_NULL: \
\r
978 * Implements marshalling for a QName attribute
\r
980 * @param proper the proper name of the attribute
\r
981 * @param ucase the upcased name of the attribute
\r
982 * @param namespaceURI the XML namespace of the attribute
\r
984 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
\r
985 if (m_##proper) { \
\r
986 auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
\r
987 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
\r
991 * Implements marshalling for an ID attribute
\r
993 * @param proper the proper name of the attribute
\r
994 * @param ucase the upcased name of the attribute
\r
995 * @param namespaceURI the XML namespace of the attribute
\r
997 #define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
\r
998 if (m_##proper && *m_##proper) { \
\r
999 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
\r
1000 domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
\r
1004 * Implements unmarshalling process branch for a string attribute
\r
1006 * @param proper the proper name of the attribute
\r
1007 * @param ucase the upcased name of the attribute
\r
1008 * @param namespaceURI the XML namespace of the attribute
\r
1010 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
\r
1011 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
\r
1012 set##proper(attribute->getValue()); \
\r
1017 * Implements unmarshalling process branch for an ID attribute
\r
1019 * @param proper the proper name of the attribute
\r
1020 * @param ucase the upcased name of the attribute
\r
1021 * @param namespaceURI the XML namespace of the attribute
\r
1023 #define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
\r
1024 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
\r
1025 set##proper(attribute->getValue()); \
\r
1026 attribute->getOwnerElement()->setIdAttributeNode(attribute); \
\r
1031 * Implements unmarshalling process branch for a DateTime attribute
\r
1033 * @param proper the proper name of the attribute
\r
1034 * @param ucase the upcased name of the attribute
\r
1035 * @param namespaceURI the XML namespace of the attribute
\r
1037 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
\r
1038 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
\r
1041 * Implements unmarshalling process branch for a DateTime attribute
\r
1043 * @param proper the proper name of the attribute
\r
1044 * @param ucase the upcased name of the attribute
\r
1045 * @param namespaceURI the XML namespace of the attribute
\r
1047 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
\r
1048 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
\r
1049 set##proper(XMLHelper::getAttributeValueAsQName(attribute)); \
\r
1054 * Implements unmarshalling process branch for an integer attribute
\r
1056 * @param proper the proper name of the attribute
\r
1057 * @param ucase the upcased name of the attribute
\r
1058 * @param namespaceURI the XML namespace of the attribute
\r
1060 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
\r
1061 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
\r
1064 * Implements unmarshalling process branch for a boolean attribute
\r
1066 * @param proper the proper name of the attribute
\r
1067 * @param ucase the upcased name of the attribute
\r
1068 * @param namespaceURI the XML namespace of the attribute
\r
1070 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
\r
1071 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
\r
1074 * Implements unmarshalling process branch for typed child collection element
\r
1076 * @param proper the proper name of the child type
\r
1077 * @param namespaceURI the XML namespace of the child element
\r
1078 * @param force bypass use of hint and just cast down to check child
\r
1080 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
\r
1081 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
\r
1082 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
\r
1084 get##proper##s().push_back(typesafe); \
\r
1090 * Implements unmarshalling process branch for typed child collection element
\r
1091 * in a foreign namespace.
\r
1093 * @param proper the proper name of the child type
\r
1094 * @param ns the C++ namespace for the type
\r
1095 * @param namespaceURI the XML namespace of the child element
\r
1096 * @param force bypass use of hint and just cast down to check child
\r
1098 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
\r
1099 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
\r
1100 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
\r
1102 get##proper##s().push_back(typesafe); \
\r
1108 * Implements unmarshalling process branch for typed child singleton element
\r
1110 * @param proper the proper name of the child type
\r
1111 * @param namespaceURI the XML namespace of the child element
\r
1112 * @param force bypass use of hint and just cast down to check child
\r
1114 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
\r
1115 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
\r
1116 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
\r
1117 if (typesafe && !m_##proper) { \
\r
1118 typesafe->setParent(this); \
\r
1119 *m_pos_##proper = m_##proper = typesafe; \
\r
1125 * Implements unmarshalling process branch for typed child singleton element
\r
1126 * in a foreign namespace.
\r
1128 * @param proper the proper name of the child type
\r
1129 * @param ns the C++ namespace for the type
\r
1130 * @param namespaceURI the XML namespace of the child element
\r
1131 * @param force bypass use of hint and just cast down to check child
\r
1133 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
\r
1134 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
\r
1135 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
\r
1136 if (typesafe && !m_##proper) { \
\r
1137 typesafe->setParent(this); \
\r
1138 *m_pos_##proper = m_##proper = typesafe; \
\r
1144 * Implements unmarshalling process branch for a generic child singleton element
\r
1146 * @param proper the proper name of the child type
\r
1147 * @param namespaceURI the XML namespace of the child element
\r
1149 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
\r
1150 if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
\r
1151 if (!m_##proper) { \
\r
1152 childXMLObject->setParent(this); \
\r
1153 *m_pos_##proper = m_##proper = childXMLObject; \
\r
1159 * Declares aliased get/set methods for named XML element simple content.
\r
1161 * @param proper the proper name to label the element's content
\r
1163 #define DECL_SIMPLE_CONTENT(proper) \
\r
1164 XMLTOOLING_DOXYGEN(Returns proper.) \
\r
1165 const XMLCh* get##proper() const { \
\r
1166 return getTextContent(); \
\r
1168 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
\r
1169 void set##proper(const XMLCh* proper) { \
\r
1170 setTextContent(proper); \
\r
1174 * Declares aliased get/set methods for named integer XML element content.
\r
1176 * @param proper the proper name to label the element's content
\r
1178 #define DECL_INTEGER_CONTENT(proper) \
\r
1179 XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
\r
1180 std::pair<bool,int> get##proper() const { \
\r
1181 return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \
\r
1183 XMLTOOLING_DOXYGEN(Sets proper.) \
\r
1184 void set##proper(int proper) { \
\r
1186 sprintf(buf,"%d",proper); \
\r
1187 xmltooling::auto_ptr_XMLCh widebuf(buf); \
\r
1188 setTextContent(widebuf.get()); \
\r
1190 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
\r
1191 void set##proper(const XMLCh* proper) { \
\r
1192 setTextContent(proper); \
\r
1196 * Implements cloning methods for an XMLObject specialization implementation class.
\r
1198 * @param cname the name of the XMLObject specialization
\r
1200 #define IMPL_XMLOBJECT_CLONE(cname) \
\r
1201 cname* clone##cname() const { \
\r
1202 return dynamic_cast<cname*>(clone()); \
\r
1204 xmltooling::XMLObject* clone() const { \
\r
1205 std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
\r
1206 cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
\r
1208 domClone.release(); \
\r
1211 return new cname##Impl(*this); \
\r
1215 * Declares an XMLObject specialization with a simple content model and type,
\r
1216 * handling it as string data.
\r
1218 * @param linkage linkage specifier for the class
\r
1219 * @param cname the name of the XMLObject specialization
\r
1220 * @param proper the proper name to label the element's content
\r
1221 * @param desc documentation for class
\r
1223 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
\r
1224 BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
\r
1225 DECL_SIMPLE_CONTENT(proper); \
\r
1229 * Declares and defines an implementation class for an XMLObject with
\r
1230 * a simple content model and type, handling it as string data.
\r
1232 * @param linkage linkage specifier for the class
\r
1233 * @param cname the name of the XMLObject specialization
\r
1235 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
\r
1236 class linkage cname##Impl \
\r
1237 : public virtual cname, \
\r
1238 public xmltooling::AbstractSimpleElement, \
\r
1239 public xmltooling::AbstractDOMCachingXMLObject, \
\r
1240 public xmltooling::AbstractXMLObjectMarshaller, \
\r
1241 public xmltooling::AbstractXMLObjectUnmarshaller \
\r
1244 virtual ~cname##Impl() {} \
\r
1245 cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \
\r
1246 : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
\r
1248 cname##Impl(const cname##Impl& src) \
\r
1249 : xmltooling::AbstractXMLObject(src), \
\r
1250 xmltooling::AbstractSimpleElement(src), \
\r
1251 xmltooling::AbstractDOMCachingXMLObject(src) {} \
\r
1252 IMPL_XMLOBJECT_CLONE(cname) \
\r
1255 #ifdef HAVE_COVARIANT_RETURNS
\r
1258 * Begins the declaration of an XMLObjectBuilder specialization.
\r
1259 * Basic boilerplate includes an empty virtual destructor, and
\r
1260 * a default builder that defaults the element name.
\r
1262 * @param linkage linkage specifier for the class
\r
1263 * @param cname the name of the XMLObject specialization
\r
1264 * @param namespaceURI the XML namespace of the default associated element
\r
1265 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1267 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1268 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
\r
1269 class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
\r
1271 virtual ~cname##Builder() {} \
\r
1272 XMLTOOLING_DOXYGEN(Default builder.) \
\r
1273 virtual cname* buildObject() const { \
\r
1274 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
\r
1276 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
\r
1277 virtual cname* buildObject( \
\r
1278 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
\r
1282 * Ends the declaration of an XMLObjectBuilder specialization.
\r
1284 #define END_XMLOBJECTBUILDER }
\r
1287 * Declares a generic XMLObjectBuilder specialization.
\r
1289 * @param linkage linkage specifier for the class
\r
1290 * @param cname the name of the XMLObject specialization
\r
1291 * @param namespaceURI the XML namespace of the default associated element
\r
1292 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1294 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1295 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
\r
1296 XMLTOOLING_DOXYGEN(Singleton builder.) \
\r
1297 static cname* build##cname() { \
\r
1298 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
\r
1299 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
\r
1302 return b->buildObject(); \
\r
1303 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
\r
1305 END_XMLOBJECTBUILDER
\r
1308 * Implements the standard XMLObjectBuilder specialization function.
\r
1310 * @param cname the name of the XMLObject specialization
\r
1312 #define IMPL_XMLOBJECTBUILDER(cname) \
\r
1313 cname* cname##Builder::buildObject( \
\r
1314 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
\r
1317 return new cname##Impl(nsURI,localName,prefix,schemaType); \
\r
1320 #else /* !HAVE_COVARIANT_RETURNS */
\r
1323 * Begins the declaration of an XMLObjectBuilder specialization.
\r
1324 * Basic boilerplate includes an empty virtual destructor, and
\r
1325 * a default builder that defaults the element name.
\r
1327 * @param linkage linkage specifier for the class
\r
1328 * @param cname the name of the XMLObject specialization
\r
1329 * @param namespaceURI the XML namespace of the default associated element
\r
1330 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1332 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1333 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
\r
1334 class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
\r
1336 virtual ~cname##Builder() {} \
\r
1337 XMLTOOLING_DOXYGEN(Default builder.) \
\r
1338 virtual xmltooling::XMLObject* buildObject() const { \
\r
1339 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
\r
1341 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
\r
1342 virtual xmltooling::XMLObject* buildObject( \
\r
1343 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
\r
1347 * Ends the declaration of an XMLObjectBuilder specialization.
\r
1349 #define END_XMLOBJECTBUILDER }
\r
1352 * Declares a generic XMLObjectBuilder specialization.
\r
1354 * @param linkage linkage specifier for the class
\r
1355 * @param cname the name of the XMLObject specialization
\r
1356 * @param namespaceURI the XML namespace of the default associated element
\r
1357 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1359 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1360 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
\r
1361 XMLTOOLING_DOXYGEN(Singleton builder.) \
\r
1362 static cname* build##cname() { \
\r
1363 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
\r
1364 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
\r
1367 return dynamic_cast<cname*>(b->buildObject()); \
\r
1368 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
\r
1370 END_XMLOBJECTBUILDER
\r
1373 * Implements the standard XMLObjectBuilder specialization function.
\r
1375 * @param cname the name of the XMLObject specialization
\r
1377 #define IMPL_XMLOBJECTBUILDER(cname) \
\r
1378 xmltooling::XMLObject* cname##Builder::buildObject( \
\r
1379 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
\r
1382 return new cname##Impl(nsURI,localName,prefix,schemaType); \
\r
1385 #endif /* HAVE_COVARIANT_RETURNS */
\r
1388 * Begins the declaration of a Schema Validator specialization.
\r
1390 * @param linkage linkage specifier for the class
\r
1391 * @param cname the base name of the Validator specialization
\r
1393 #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
\r
1394 class linkage cname##SchemaValidator : public xmltooling::Validator \
\r
1397 virtual ~cname##SchemaValidator() {} \
\r
1398 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
\r
1399 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
\r
1401 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name())); \
\r
1402 if (ptr->nil() && (ptr->hasChildren() || ptr->getTextContent())) \
\r
1403 throw xmltooling::ValidationException("Object has nil property but with children or content.")
\r
1406 * Begins the declaration of a Schema Validator specialization subclass.
\r
1408 * @param linkage linkage specifier for the class
\r
1409 * @param cname the base name of the Validator specialization
\r
1410 * @param base base class for the validator
\r
1412 #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
\r
1413 class linkage cname##SchemaValidator : public base##SchemaValidator \
\r
1416 virtual ~cname##SchemaValidator() {} \
\r
1417 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
\r
1418 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
\r
1420 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()));
\r
1423 * Ends the declaration of a Validator specialization.
\r
1425 #define END_XMLOBJECTVALIDATOR } }
\r
1428 * Validator code that checks the object type.
\r
1430 * @param cname the name of the XMLObject specialization
\r
1432 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
\r
1433 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
\r
1435 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
\r
1438 * Validator code that checks for a required attribute, content, or singleton.
\r
1440 * @param cname the name of the XMLObject specialization
\r
1441 * @param proper the proper name of the attribute, content, or singleton member
\r
1443 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
\r
1444 if (!ptr->get##proper()) \
\r
1445 throw xmltooling::ValidationException(#cname" must have "#proper".")
\r
1448 * Validator code that checks for a required integer attribute
\r
1450 * @param cname the name of the XMLObject specialization
\r
1451 * @param proper the proper name of the attribute, content, or singleton member
\r
1453 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
\r
1454 if (!ptr->get##proper().first) \
\r
1455 throw xmltooling::ValidationException(#cname" must have "#proper".")
\r
1458 * Validator code that checks for one of a pair of
\r
1459 * required attributes, content, or singletons.
\r
1461 * @param cname the name of the XMLObject specialization
\r
1462 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1463 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1465 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
\r
1466 if (!ptr->get##proper1() && !ptr->get##proper2()) \
\r
1467 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
\r
1470 * Validator code that checks for one of a pair of
\r
1471 * required attributes, content, or singletons, but disallows both.
\r
1473 * @param cname the name of the XMLObject specialization
\r
1474 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1475 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1477 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
\r
1478 if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
\r
1479 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
\r
1482 * Validator code that checks for one of a set of three
\r
1483 * required attributes, content, or singletons.
\r
1485 * @param cname the name of the XMLObject specialization
\r
1486 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1487 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1488 * @param proper3 the proper name of the third attribute, content, or singleton member
\r
1490 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
\r
1491 if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
\r
1492 throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
\r
1495 * Validator code that checks for one of a set of three
\r
1496 * required attributes, content, or singletons but disallows more than one.
\r
1498 * @param cname the name of the XMLObject specialization
\r
1499 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1500 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1501 * @param proper3 the proper name of the third attribute, content, or singleton member
\r
1503 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
\r
1504 int c##proper1##proper2##proper3=0; \
\r
1505 if (ptr->get##proper1()!=NULL) \
\r
1506 c##proper1##proper2##proper3++; \
\r
1507 if (ptr->get##proper2()!=NULL) \
\r
1508 c##proper1##proper2##proper3++; \
\r
1509 if (ptr->get##proper3()!=NULL) \
\r
1510 c##proper1##proper2##proper3++; \
\r
1511 if (c##proper1##proper2##proper3 != 1) \
\r
1512 throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
\r
1515 * Validator code that checks a co-constraint (if one present, the other must be)
\r
1516 * between a pair of attributes, content, or singletons.
\r
1518 * @param cname the name of the XMLObject specialization
\r
1519 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1520 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1522 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
\r
1523 if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
\r
1524 throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
\r
1527 * Validator code that checks for a non-empty collection.
\r
1529 * @param cname the name of the XMLObject specialization
\r
1530 * @param proper the proper name of the collection item
\r
1532 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
\r
1533 if (ptr->get##proper##s().empty()) \
\r
1534 throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
\r
1537 * Declares/defines a Validator specialization that checks object type and
\r
1538 * a non-empty simple content model.
\r
1540 * @param linkage linkage specifier for the class
\r
1541 * @param cname the name of the XMLObject specialization
\r
1543 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
\r
1544 BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
\r
1545 XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
\r
1546 END_XMLOBJECTVALIDATOR
\r
1548 #include <utility>
\r
1551 * @namespace xmltooling
\r
1552 * Public namespace of XML Tooling library
\r
1554 namespace xmltooling {
\r
1557 * Template function for cloning a sequence of XMLObjects.
\r
1558 * Invokes the clone() member on each element of the input sequence and adds the copy to
\r
1559 * the output sequence. Order is preserved.
\r
1561 * @param in input sequence to clone
\r
1562 * @param out output sequence to copy cloned pointers into
\r
1564 template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
\r
1565 for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
\r
1567 out.push_back((*i)->clone());
\r
1569 out.push_back(*i);
\r
1574 * Functor for cleaning up heap objects in containers.
\r
1576 template<class T> struct cleanup
\r
1579 * Function operator to delete an object.
\r
1581 * @param ptr object to delete
\r
1583 void operator()(T* ptr) {delete ptr;}
\r
1586 * Function operator to delete an object stored as const.
\r
1588 * @param ptr object to delete after casting away const
\r
1590 void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
\r
1594 * Functor for cleaning up heap objects in key/value containers.
\r
1596 template<class A,class B> struct cleanup_pair
\r
1599 * Function operator to delete an object.
\r
1601 * @param p a pair in which the second component is the object to delete
\r
1603 void operator()(const std::pair<const A,B*>& p) {delete p.second;}
\r
1607 * Functor for cleaning up const heap objects in key/value containers.
\r
1609 template<class A,class B> struct cleanup_const_pair
\r
1612 * Function operator to delete an object stored as const
\r
1614 * @param p a pair in which the second component is the const object to delete
\r
1616 void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
\r
1620 #endif /* __xmltooling_base_h__ */
\r