2 * Copyright 2001-2007 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 #if defined (_MSC_VER) || defined(__BORLANDC__)
\r
30 #include <xmltooling/config_pub_win32.h>
\r
32 #include <xmltooling/config_pub.h>
\r
35 #ifdef XMLTOOLING_LITE
\r
36 # define XMLTOOLING_NO_XMLSEC 1
\r
39 // Windows and GCC4 Symbol Visibility Macros
\r
41 #define XMLTOOL_IMPORT __declspec(dllimport)
\r
42 #define XMLTOOL_EXPORT __declspec(dllexport)
\r
43 #define XMLTOOL_DLLLOCAL
\r
44 #define XMLTOOL_DLLPUBLIC
\r
46 #define XMLTOOL_IMPORT
\r
47 #ifdef GCC_HASCLASSVISIBILITY
\r
48 #define XMLTOOL_EXPORT __attribute__ ((visibility("default")))
\r
49 #define XMLTOOL_DLLLOCAL __attribute__ ((visibility("hidden")))
\r
50 #define XMLTOOL_DLLPUBLIC __attribute__ ((visibility("default")))
\r
52 #define XMLTOOL_EXPORT
\r
53 #define XMLTOOL_DLLLOCAL
\r
54 #define XMLTOOL_DLLPUBLIC
\r
58 // Define XMLTOOL_API for DLL builds
\r
59 #ifdef XMLTOOLING_EXPORTS
\r
60 #define XMLTOOL_API XMLTOOL_EXPORT
\r
62 #define XMLTOOL_API XMLTOOL_IMPORT
\r
65 // Throwable classes must always be visible on GCC in all binaries
\r
67 #define XMLTOOL_EXCEPTIONAPI(api) api
\r
68 #elif defined(GCC_HASCLASSVISIBILITY)
\r
69 #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT
\r
71 #define XMLTOOL_EXCEPTIONAPI(api)
\r
75 #define XMLTOOLING_DOXYGEN(desc) /##** desc */
\r
77 #define XMLTOOLING_DOXYGEN(desc)
\r
81 * Blocks copy c'tor and assignment operator for a class.
\r
83 #define MAKE_NONCOPYABLE(type) \
\r
85 type(const type&); \
\r
86 type& operator=(const type&)
\r
88 #ifndef DOXYGEN_SKIP
\r
92 #define UNICODE_LITERAL_1(a) {xercesc::chLatin_##a, xercesc::chNull}
\r
93 #define UNICODE_LITERAL_2(a,b) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chNull}
\r
94 #define UNICODE_LITERAL_3(a,b,c) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chNull}
\r
95 #define UNICODE_LITERAL_4(a,b,c,d) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chNull}
\r
96 #define UNICODE_LITERAL_5(a,b,c,d,e) \
\r
97 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chNull}
\r
98 #define UNICODE_LITERAL_6(a,b,c,d,e,f) \
\r
99 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chNull}
\r
100 #define UNICODE_LITERAL_7(a,b,c,d,e,f,g) \
\r
101 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chNull}
\r
102 #define UNICODE_LITERAL_8(a,b,c,d,e,f,g,h) \
\r
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::chNull}
\r
104 #define UNICODE_LITERAL_9(a,b,c,d,e,f,g,h,i) \
\r
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, xercesc::chNull}
\r
106 #define UNICODE_LITERAL_10(a,b,c,d,e,f,g,h,i,j) \
\r
107 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
108 xercesc::chLatin_##j, xercesc::chNull}
\r
109 #define UNICODE_LITERAL_11(a,b,c,d,e,f,g,h,i,j,k) \
\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::chLatin_##k, xercesc::chNull}
\r
112 #define UNICODE_LITERAL_12(a,b,c,d,e,f,g,h,i,j,k,l) \
\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::chLatin_##l, xercesc::chNull}
\r
115 #define UNICODE_LITERAL_13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
\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::chLatin_##m, xercesc::chNull}
\r
118 #define UNICODE_LITERAL_14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
\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::chLatin_##n, xercesc::chNull}
\r
121 #define UNICODE_LITERAL_15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
\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::chLatin_##o, xercesc::chNull}
\r
124 #define UNICODE_LITERAL_16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
\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::chLatin_##p, xercesc::chNull}
\r
127 #define UNICODE_LITERAL_17(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) \
\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::chLatin_##q, xercesc::chNull}
\r
130 #define UNICODE_LITERAL_18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) \
\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::chLatin_##r, xercesc::chNull}
\r
133 #define UNICODE_LITERAL_19(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) \
\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, \
\r
136 xercesc::chLatin_##s, xercesc::chNull}
\r
137 #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
138 {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
139 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
140 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chNull}
\r
141 #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
142 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
143 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
144 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chNull}
\r
145 #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
146 {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
147 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
148 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chNull}
\r
149 #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
150 {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
151 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
152 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chNull}
\r
153 #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
154 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
155 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
156 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chNull}
\r
157 #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
158 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
159 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
160 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chNull}
\r
161 #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
162 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
163 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
164 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
165 #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
166 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
167 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
168 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
169 xercesc::chLatin_##aa, xercesc::chNull}
\r
170 #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
171 {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
172 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
173 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
174 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chNull}
\r
175 #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
176 {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
177 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
178 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
179 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chNull}
\r
180 #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
181 {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
182 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
183 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
184 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chNull}
\r
185 #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
186 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
187 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
188 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
\r
189 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chNull}
\r
190 #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
191 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
192 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
193 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
\r
194 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chNull}
\r
195 #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
196 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
197 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
198 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
\r
199 xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chNull}
\r
200 #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
201 {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
\r
202 xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
\r
203 xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
\r
204 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
205 #endif /* DOXYGEN_SKIP */
\r
208 * Begins the declaration of an XMLObject specialization for an abstract element/type.
\r
209 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
210 * and Unicode constants for the default associated element's name and prefix.
\r
212 * @param linkage linkage specifier for the class
\r
213 * @param cname the name of the class to declare
\r
214 * @param base the base class to derive from using public virtual inheritance
\r
215 * @param desc documentation comment for class
\r
217 #define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \
\r
218 XMLTOOLING_DOXYGEN(desc) \
\r
219 class linkage cname : public virtual base { \
\r
223 virtual ~cname() {} \
\r
224 XMLTOOLING_DOXYGEN(Element local name) \
\r
225 static const XMLCh LOCAL_NAME[]; \
\r
229 * Begins the declaration of an XMLObject specialization.
\r
230 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
231 * and Unicode constants for the default associated element's name and prefix.
\r
233 * @param linkage linkage specifier for the class
\r
234 * @param cname the name of the class to declare
\r
235 * @param base the base class to derive from using public virtual inheritance
\r
236 * @param desc documentation comment for class
\r
238 #define BEGIN_XMLOBJECT(linkage,cname,base,desc) \
\r
239 XMLTOOLING_DOXYGEN(desc) \
\r
240 class linkage cname : public virtual base { \
\r
244 virtual ~cname() {} \
\r
245 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
246 virtual cname* clone##cname() const=0; \
\r
247 XMLTOOLING_DOXYGEN(Element local name) \
\r
248 static const XMLCh LOCAL_NAME[]
\r
251 * Begins the declaration of an XMLObject specialization with two base classes.
\r
252 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
253 * and Unicode constants for the default associated element's name and prefix.
\r
255 * @param linkage linkage specifier for the class
\r
256 * @param cname the name of the class to declare
\r
257 * @param base the first base class to derive from using public virtual inheritance
\r
258 * @param base2 the second base class to derive from using public virtual inheritance
\r
259 * @param desc documentation comment for class
\r
261 #define BEGIN_XMLOBJECT2(linkage,cname,base,base2,desc) \
\r
262 XMLTOOLING_DOXYGEN(desc) \
\r
263 class linkage cname : public virtual base, public virtual base2 { \
\r
267 virtual ~cname() {} \
\r
268 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
269 virtual cname* clone##cname() const=0; \
\r
270 XMLTOOLING_DOXYGEN(Element local name) \
\r
271 static const XMLCh LOCAL_NAME[]
\r
274 * Begins the declaration of an XMLObject specialization with three base classes.
\r
275 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
276 * and Unicode constants for the default associated element's name and prefix.
\r
278 * @param linkage linkage specifier for the class
\r
279 * @param cname the name of the class to declare
\r
280 * @param base the first base class to derive from using public virtual inheritance
\r
281 * @param base2 the second base class to derive from using public virtual inheritance
\r
282 * @param base3 the third base class to derive from using public virtual inheritance
\r
283 * @param desc documentation comment for class
\r
285 #define BEGIN_XMLOBJECT3(linkage,cname,base,base2,base3,desc) \
\r
286 XMLTOOLING_DOXYGEN(desc) \
\r
287 class linkage cname : public virtual base, public virtual base2, public virtual base3 { \
\r
291 virtual ~cname() {} \
\r
292 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
293 virtual cname* clone##cname() const=0; \
\r
294 XMLTOOLING_DOXYGEN(Element local name) \
\r
295 static const XMLCh LOCAL_NAME[]
\r
298 * Begins the declaration of an XMLObject specialization with four base classes.
\r
299 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
300 * and Unicode constants for the default associated element's name and prefix.
\r
302 * @param linkage linkage specifier for the class
\r
303 * @param cname the name of the class to declare
\r
304 * @param base the first base class to derive from using public virtual inheritance
\r
305 * @param base2 the second base class to derive from using public virtual inheritance
\r
306 * @param base3 the third base class to derive from using public virtual inheritance
\r
307 * @param base4 the fourth base class to derive from using public virtual inheritance
\r
308 * @param desc documentation comment for class
\r
310 #define BEGIN_XMLOBJECT4(linkage,cname,base,base2,base3,base4,desc) \
\r
311 XMLTOOLING_DOXYGEN(desc) \
\r
312 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4 { \
\r
316 virtual ~cname() {} \
\r
317 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
318 virtual cname* clone##cname() const=0; \
\r
319 XMLTOOLING_DOXYGEN(Element local name) \
\r
320 static const XMLCh LOCAL_NAME[]
\r
323 * Begins the declaration of an XMLObject specialization with five base classes.
\r
324 * Basic boilerplate includes a protected constructor, empty virtual destructor,
\r
325 * and Unicode constants for the default associated element's name and prefix.
\r
327 * @param linkage linkage specifier for the class
\r
328 * @param cname the name of the class to declare
\r
329 * @param base the first base class to derive from using public virtual inheritance
\r
330 * @param base2 the second base class to derive from using public virtual inheritance
\r
331 * @param base3 the third base class to derive from using public virtual inheritance
\r
332 * @param base4 the fourth base class to derive from using public virtual inheritance
\r
333 * @param base5 the fifth base class to derive from using public virtual inheritance
\r
334 * @param desc documentation comment for class
\r
336 #define BEGIN_XMLOBJECT5(linkage,cname,base,base2,base3,base4,base5,desc) \
\r
337 XMLTOOLING_DOXYGEN(desc) \
\r
338 class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4, public virtual base5 { \
\r
342 virtual ~cname() {} \
\r
343 XMLTOOLING_DOXYGEN(Type-specific clone method.) \
\r
344 virtual cname* clone##cname() const=0; \
\r
345 XMLTOOLING_DOXYGEN(Element local name) \
\r
346 static const XMLCh LOCAL_NAME[]
\r
349 * Ends the declaration of an XMLObject specialization.
\r
351 #define END_XMLOBJECT }
\r
354 * Declares a static variable holding the XMLObject's element QName.
\r
356 #define DECL_ELEMENT_QNAME \
\r
358 XMLTOOLING_DOXYGEN(Element QName) \
\r
359 static xmltooling::QName ELEMENT_QNAME
\r
362 * Declares a static variable holding the XMLObject's schema type QName.
\r
364 #define DECL_TYPE_QNAME \
\r
366 XMLTOOLING_DOXYGEN(Type QName) \
\r
367 static xmltooling::QName TYPE_QNAME
\r
370 * Implements a static variable holding an XMLObject's element QName.
\r
372 * @param cname the name of the XMLObject specialization
\r
373 * @param namespaceURI the XML namespace of the default associated element
\r
374 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
376 #define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \
\r
377 xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)
\r
380 * Implements a static variable holding an XMLObject's schema type QName.
\r
382 * @param cname the name of the XMLObject specialization
\r
383 * @param namespaceURI the XML namespace of the default associated element
\r
384 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
386 #define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \
\r
387 xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)
\r
390 * Declares abstract set method for a typed XML attribute.
\r
391 * The get method is omitted.
\r
393 * @param proper the proper name of the attribute
\r
394 * @param upcased the upcased name of the attribute
\r
395 * @param type the attribute's data type
\r
397 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \
\r
399 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
400 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
401 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
402 virtual void set##proper(const type* proper)=0
\r
405 * Declares abstract get/set methods for a typed XML attribute.
\r
407 * @param proper the proper name of the attribute
\r
408 * @param upcased the upcased name of the attribute
\r
409 * @param type the attribute's data type
\r
411 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \
\r
413 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
414 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
415 XMLTOOLING_DOXYGEN(Returns the proper attribute.) \
\r
416 virtual const type* get##proper() const=0; \
\r
417 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
418 virtual void set##proper(const type* proper)=0
\r
421 * Declares abstract set method for a string XML attribute.
\r
422 * The get method is omitted.
\r
424 * @param proper the proper name of the attribute
\r
425 * @param upcased the upcased name of the attribute
\r
427 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \
\r
428 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
\r
431 * Declares abstract get/set methods for a string XML attribute.
\r
433 * @param proper the proper name of the attribute
\r
434 * @param upcased the upcased name of the attribute
\r
436 #define DECL_STRING_ATTRIB(proper,upcased) \
\r
437 DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
\r
440 * Declares abstract set method for a DateTime XML attribute.
\r
441 * The get method is omitted.
\r
443 * @param proper the proper name of the attribute
\r
444 * @param upcased the upcased name of the attribute
\r
446 #define DECL_INHERITED_DATETIME_ATTRIB(proper,upcased) \
\r
447 DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
\r
448 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
449 virtual void set##proper(time_t proper)=0; \
\r
450 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
451 virtual void set##proper(const XMLCh* proper)=0
\r
454 * Declares abstract get/set methods for a DateTime XML attribute.
\r
456 * @param proper the proper name of the attribute
\r
457 * @param upcased the upcased name of the attribute
\r
459 #define DECL_DATETIME_ATTRIB(proper,upcased) \
\r
460 DECL_XMLOBJECT_ATTRIB(proper,upcased,xmltooling::DateTime); \
\r
461 XMLTOOLING_DOXYGEN(Returns the proper attribute in epoch form.) \
\r
462 virtual time_t get##proper##Epoch() const=0; \
\r
463 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
464 virtual void set##proper(time_t proper)=0; \
\r
465 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
466 virtual void set##proper(const XMLCh* proper)=0
\r
469 * Declares abstract set method for an integer XML attribute.
\r
470 * The get method is omitted.
\r
472 * @param proper the proper name of the attribute
\r
473 * @param upcased the upcased name of the attribute
\r
475 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \
\r
477 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
478 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
479 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
\r
480 virtual void set##proper(const XMLCh* proper)=0; \
\r
481 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
482 virtual void set##proper(int proper)=0
\r
485 * Declares abstract get/set methods for an integer XML attribute.
\r
487 * @param proper the proper name of the attribute
\r
488 * @param upcased the upcased name of the attribute
\r
490 #define DECL_INTEGER_ATTRIB(proper,upcased) \
\r
492 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
493 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
494 XMLTOOLING_DOXYGEN(Returns the proper attribute after a NULL indicator.) \
\r
495 virtual std::pair<bool,int> get##proper() const=0; \
\r
496 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
\r
497 virtual void set##proper(const XMLCh* proper)=0; \
\r
498 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
499 virtual void set##proper(int proper)=0
\r
502 * Declares abstract get/set methods for a boolean XML attribute.
\r
504 * @param proper the proper name of the attribute
\r
505 * @param upcased the upcased name of the attribute
\r
506 * @param def the default/presumed value, if no explicit value has been set
\r
508 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \
\r
510 XMLTOOLING_DOXYGEN(proper attribute name) \
\r
511 static const XMLCh upcased##_ATTRIB_NAME[]; \
\r
512 XMLTOOLING_DOXYGEN(Returns the proper attribute or def if not set.) \
\r
513 bool proper() const { \
\r
514 switch (get##proper()) { \
\r
515 case xmlconstants::XML_BOOL_TRUE: \
\r
516 case xmlconstants::XML_BOOL_ONE: \
\r
518 case xmlconstants::XML_BOOL_FALSE: \
\r
519 case xmlconstants::XML_BOOL_ZERO: \
\r
525 XMLTOOLING_DOXYGEN(Returns the proper attribute as an explicit enumerated value.) \
\r
526 virtual xmlconstants::xmltooling_bool_t get##proper() const=0; \
\r
527 XMLTOOLING_DOXYGEN(Sets the proper attribute using an enumerated value.) \
\r
528 virtual void proper(xmlconstants::xmltooling_bool_t value)=0; \
\r
529 XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
\r
530 void proper(bool value) { \
\r
531 proper(value ? xmlconstants::XML_BOOL_ONE : xmlconstants::XML_BOOL_ZERO); \
\r
533 XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \
\r
534 void set##proper(const XMLCh* value) { \
\r
536 switch (*value) { \
\r
537 case xercesc::chLatin_t: \
\r
538 proper(xmlconstants::XML_BOOL_TRUE); \
\r
540 case xercesc::chLatin_f: \
\r
541 proper(xmlconstants::XML_BOOL_FALSE); \
\r
543 case xercesc::chDigit_1: \
\r
544 proper(xmlconstants::XML_BOOL_ONE); \
\r
546 case xercesc::chDigit_0: \
\r
547 proper(xmlconstants::XML_BOOL_ZERO); \
\r
550 proper(xmlconstants::XML_BOOL_NULL); \
\r
554 proper(xmlconstants::XML_BOOL_NULL); \
\r
558 * Implements get/set methods and a private member for a typed XML attribute.
\r
560 * @param proper the proper name of the attribute
\r
561 * @param type the attribute's data type
\r
563 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \
\r
565 type* m_##proper; \
\r
567 const type* get##proper() const { \
\r
568 return m_##proper; \
\r
570 void set##proper(const type* proper) { \
\r
571 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
575 * Implements get/set methods and a private member for a string XML attribute.
\r
577 * @param proper the proper name of the attribute
\r
579 #define IMPL_STRING_ATTRIB(proper) \
\r
580 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)
\r
583 * Implements get/set methods and a private member for a string XML attribute,
\r
584 * plus a getXMLID override.
\r
586 * @param proper the proper name of the attribute
\r
588 #define IMPL_ID_ATTRIB(proper) \
\r
589 IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
\r
590 const XMLCh* getXMLID() const { \
\r
591 return m_##proper; \
\r
595 * Implements get/set methods and a private member for a DateTime XML attribute.
\r
597 * @param proper the proper name of the attribute
\r
598 * @param fallback epoch to return when attribute is NULL
\r
600 #define IMPL_DATETIME_ATTRIB(proper,fallback) \
\r
602 DateTime* m_##proper; \
\r
603 time_t m_##proper##Epoch; \
\r
605 const DateTime* get##proper() const { \
\r
606 return m_##proper; \
\r
608 time_t get##proper##Epoch() const { \
\r
609 return m_##proper ? m_##proper##Epoch : fallback; \
\r
611 void set##proper(const DateTime* proper) { \
\r
612 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
614 m_##proper##Epoch=m_##proper->getEpoch(); \
\r
616 void set##proper(time_t proper) { \
\r
617 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
618 m_##proper##Epoch = proper; \
\r
620 void set##proper(const XMLCh* proper) { \
\r
621 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
623 m_##proper##Epoch=m_##proper->getEpoch(); \
\r
627 * Implements get/set methods and a private member for an integer XML attribute.
\r
629 * @param proper the proper name of the attribute
\r
631 #define IMPL_INTEGER_ATTRIB(proper) \
\r
633 XMLCh* m_##proper; \
\r
635 pair<bool,int> get##proper() const { \
\r
636 return make_pair((m_##proper!=NULL),(m_##proper!=NULL ? xercesc::XMLString::parseInt(m_##proper): 0)); \
\r
638 void set##proper(const XMLCh* proper) { \
\r
639 m_##proper = prepareForAssignment(m_##proper,proper); \
\r
641 void set##proper(int proper) { \
\r
642 char buf##proper[64]; \
\r
643 sprintf(buf##proper,"%d",proper); \
\r
644 auto_ptr_XMLCh wide##proper(buf##proper); \
\r
645 set##proper(wide##proper.get()); \
\r
649 * Implements get/set methods and a private member for a boolean XML attribute.
\r
651 * @param proper the proper name of the attribute
\r
653 #define IMPL_BOOLEAN_ATTRIB(proper) \
\r
655 xmlconstants::xmltooling_bool_t m_##proper; \
\r
657 xmlconstants::xmltooling_bool_t get##proper() const { \
\r
658 return m_##proper; \
\r
660 void proper(xmlconstants::xmltooling_bool_t value) { \
\r
661 if (m_##proper != value) { \
\r
662 releaseThisandParentDOM(); \
\r
663 m_##proper = value; \
\r
668 * Declares abstract set method for a typed XML child object in a foreign namespace.
\r
669 * The get method is omitted.
\r
671 * @param proper the proper name of the child type
\r
672 * @param ns the C++ namespace for the type
\r
674 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
\r
676 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
677 virtual void set##proper(ns::proper* child)=0
\r
680 * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
\r
682 * @param proper the proper name of the child type
\r
683 * @param ns the C++ namespace for the type
\r
685 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
\r
687 XMLTOOLING_DOXYGEN(Returns the proper child.) \
\r
688 virtual ns::proper* get##proper() const=0; \
\r
689 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
690 virtual void set##proper(ns::proper* child)=0
\r
693 * Declares abstract set method for a typed XML child object.
\r
694 * The get method is omitted.
\r
696 * @param proper the proper name of the child type
\r
698 #define DECL_INHERITED_TYPED_CHILD(proper) \
\r
700 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
701 virtual void set##proper(proper* child)=0
\r
704 * Declares abstract get/set methods for a typed XML child object.
\r
706 * @param proper the proper name of the child type
\r
708 #define DECL_TYPED_CHILD(proper) \
\r
710 XMLTOOLING_DOXYGEN(Returns the proper child.) \
\r
711 virtual proper* get##proper() const=0; \
\r
712 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
713 virtual void set##proper(proper* child)=0
\r
716 * Declares abstract get/set methods for a generic XML child object.
\r
718 * @param proper the proper name of the child
\r
720 #define DECL_XMLOBJECT_CHILD(proper) \
\r
722 XMLTOOLING_DOXYGEN(Returns the proper child.) \
\r
723 virtual xmltooling::XMLObject* get##proper() const=0; \
\r
724 XMLTOOLING_DOXYGEN(Sets the proper child.) \
\r
725 virtual void set##proper(xmltooling::XMLObject* child)=0
\r
729 * Implements get/set methods and a private list iterator member for a typed XML child object.
\r
731 * @param proper the proper name of the child type
\r
733 #define IMPL_TYPED_CHILD(proper) \
\r
735 proper* m_##proper; \
\r
736 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
\r
738 proper* get##proper() const { \
\r
739 return m_##proper; \
\r
741 void set##proper(proper* child) { \
\r
742 prepareForAssignment(m_##proper,child); \
\r
743 *m_pos_##proper = m_##proper = child; \
\r
747 * Implements get/set methods and a private list iterator member for
\r
748 * a typed XML child object in a foreign namespace
\r
750 * @param proper the proper name of the child type
\r
751 * @param ns the C++ namespace for the type
\r
753 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
\r
755 ns::proper* m_##proper; \
\r
756 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
\r
758 ns::proper* get##proper() const { \
\r
759 return m_##proper; \
\r
761 void set##proper(ns::proper* child) { \
\r
762 prepareForAssignment(m_##proper,child); \
\r
763 *m_pos_##proper = m_##proper = child; \
\r
767 * Implements get/set methods and a private list iterator member for a generic XML child object.
\r
769 * @param proper the proper name of the child
\r
771 #define IMPL_XMLOBJECT_CHILD(proper) \
\r
773 xmltooling::XMLObject* m_##proper; \
\r
774 std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
\r
776 xmltooling::XMLObject* get##proper() const { \
\r
777 return m_##proper; \
\r
779 void set##proper(xmltooling::XMLObject* child) { \
\r
780 prepareForAssignment(m_##proper,child); \
\r
781 *m_pos_##proper = m_##proper = child; \
\r
785 * Declares abstract get/set methods for a typed XML child collection.
\r
787 * @param proper the proper name of the child type
\r
789 #define DECL_TYPED_CHILDREN(proper) \
\r
791 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
\r
792 virtual VectorOf(proper) get##proper##s()=0; \
\r
793 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
\r
794 virtual const std::vector<proper*>& get##proper##s() const=0
\r
797 * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
\r
799 * @param proper the proper name of the child type
\r
800 * @param ns the C++ namespace for the type
\r
802 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
\r
804 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
\r
805 virtual VectorOf(ns::proper) get##proper##s()=0; \
\r
806 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
\r
807 virtual const std::vector<ns::proper*>& get##proper##s() const=0
\r
810 * Declares abstract get/set methods for a generic XML child collection.
\r
812 * @param proper the proper name of the child
\r
814 #define DECL_XMLOBJECT_CHILDREN(proper) \
\r
816 XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
\r
817 virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
\r
818 XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
\r
819 virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
\r
822 * Implements get method and a private vector member for a typed XML child collection.
\r
824 * @param proper the proper name of the child type
\r
825 * @param fence insertion fence for new objects of the child collection in backing list
\r
827 #define IMPL_TYPED_CHILDREN(proper,fence) \
\r
829 std::vector<proper*> m_##proper##s; \
\r
831 VectorOf(proper) get##proper##s() { \
\r
832 return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
\r
834 const std::vector<proper*>& get##proper##s() const { \
\r
835 return m_##proper##s; \
\r
839 * Implements get method and a private vector member for a typed XML child collection
\r
840 * in a foreign namespace.
\r
842 * @param proper the proper name of the child type
\r
843 * @param ns the C++ namespace for the type
\r
844 * @param fence insertion fence for new objects of the child collection in backing list
\r
846 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
\r
848 std::vector<ns::proper*> m_##proper##s; \
\r
850 VectorOf(ns::proper) get##proper##s() { \
\r
851 return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
\r
853 const std::vector<ns::proper*>& get##proper##s() const { \
\r
854 return m_##proper##s; \
\r
858 * Implements get method and a private vector member for a generic XML child collection.
\r
860 * @param proper the proper name of the child
\r
861 * @param fence insertion fence for new objects of the child collection in backing list
\r
863 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
\r
865 std::vector<xmltooling::XMLObject*> m_##proper##s; \
\r
867 VectorOf(xmltooling::XMLObject) get##proper##s() { \
\r
868 return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
\r
870 const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
\r
871 return m_##proper##s; \
\r
875 * Implements marshalling for a string attribute
\r
877 * @param proper the proper name of the attribute
\r
878 * @param ucase the upcased name of the attribute
\r
879 * @param namespaceURI the XML namespace of the attribute
\r
881 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
\r
882 if (m_##proper && *m_##proper) { \
\r
883 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
\r
887 * Implements marshalling for a DateTime attribute
\r
889 * @param proper the proper name of the attribute
\r
890 * @param ucase the upcased name of the attribute
\r
891 * @param namespaceURI the XML namespace of the attribute
\r
893 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
\r
894 if (m_##proper) { \
\r
895 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
\r
899 * Implements marshalling for an integer attribute
\r
901 * @param proper the proper name of the attribute
\r
902 * @param ucase the upcased name of the attribute
\r
903 * @param namespaceURI the XML namespace of the attribute
\r
905 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
\r
906 if (m_##proper && *m_##proper) { \
\r
907 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
\r
911 * Implements marshalling for a boolean attribute
\r
913 * @param proper the proper name of the attribute
\r
914 * @param ucase the upcased name of the attribute
\r
915 * @param namespaceURI the XML namespace of the attribute
\r
917 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
\r
918 switch (m_##proper) { \
\r
919 case xmlconstants::XML_BOOL_TRUE: \
\r
920 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
\r
922 case xmlconstants::XML_BOOL_ONE: \
\r
923 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
\r
925 case xmlconstants::XML_BOOL_FALSE: \
\r
926 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
\r
928 case xmlconstants::XML_BOOL_ZERO: \
\r
929 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
\r
931 case xmlconstants::XML_BOOL_NULL: \
\r
936 * Implements marshalling for a QName attribute
\r
938 * @param proper the proper name of the attribute
\r
939 * @param ucase the upcased name of the attribute
\r
940 * @param namespaceURI the XML namespace of the attribute
\r
942 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
\r
943 if (m_##proper) { \
\r
944 auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
\r
945 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
\r
949 * Implements marshalling for an ID attribute
\r
951 * @param proper the proper name of the attribute
\r
952 * @param ucase the upcased name of the attribute
\r
953 * @param namespaceURI the XML namespace of the attribute
\r
955 #define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
\r
956 if (m_##proper && *m_##proper) { \
\r
957 domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
\r
958 domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
\r
962 * Implements unmarshalling process branch for a string attribute
\r
964 * @param proper the proper name of the attribute
\r
965 * @param ucase the upcased name of the attribute
\r
966 * @param namespaceURI the XML namespace of the attribute
\r
968 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
\r
969 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
\r
970 set##proper(attribute->getValue()); \
\r
975 * Implements unmarshalling process branch for an ID attribute
\r
977 * @param proper the proper name of the attribute
\r
978 * @param ucase the upcased name of the attribute
\r
979 * @param namespaceURI the XML namespace of the attribute
\r
981 #define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
\r
982 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
\r
983 set##proper(attribute->getValue()); \
\r
984 attribute->getOwnerElement()->setIdAttributeNode(attribute); \
\r
989 * Implements unmarshalling process branch for a DateTime attribute
\r
991 * @param proper the proper name of the attribute
\r
992 * @param ucase the upcased name of the attribute
\r
993 * @param namespaceURI the XML namespace of the attribute
\r
995 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
\r
996 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
\r
999 * Implements unmarshalling process branch for a DateTime attribute
\r
1001 * @param proper the proper name of the attribute
\r
1002 * @param ucase the upcased name of the attribute
\r
1003 * @param namespaceURI the XML namespace of the attribute
\r
1005 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
\r
1006 if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
\r
1007 set##proper(XMLHelper::getAttributeValueAsQName(attribute)); \
\r
1012 * Implements unmarshalling process branch for an integer attribute
\r
1014 * @param proper the proper name of the attribute
\r
1015 * @param ucase the upcased name of the attribute
\r
1016 * @param namespaceURI the XML namespace of the attribute
\r
1018 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
\r
1019 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
\r
1022 * Implements unmarshalling process branch for a boolean attribute
\r
1024 * @param proper the proper name of the attribute
\r
1025 * @param ucase the upcased name of the attribute
\r
1026 * @param namespaceURI the XML namespace of the attribute
\r
1028 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
\r
1029 PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
\r
1032 * Implements unmarshalling process branch for typed child collection element
\r
1034 * @param proper the proper name of the child type
\r
1035 * @param namespaceURI the XML namespace of the child element
\r
1036 * @param force bypass use of hint and just cast down to check child
\r
1038 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
\r
1039 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
\r
1040 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
\r
1042 get##proper##s().push_back(typesafe); \
\r
1048 * Implements unmarshalling process branch for typed child collection element
\r
1049 * in a foreign namespace.
\r
1051 * @param proper the proper name of the child type
\r
1052 * @param ns the C++ namespace for the type
\r
1053 * @param namespaceURI the XML namespace of the child element
\r
1054 * @param force bypass use of hint and just cast down to check child
\r
1056 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
\r
1057 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
\r
1058 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
\r
1060 get##proper##s().push_back(typesafe); \
\r
1066 * Implements unmarshalling process branch for typed child singleton element
\r
1068 * @param proper the proper name of the child type
\r
1069 * @param namespaceURI the XML namespace of the child element
\r
1070 * @param force bypass use of hint and just cast down to check child
\r
1072 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
\r
1073 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
\r
1074 proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
\r
1075 if (typesafe && !m_##proper) { \
\r
1076 typesafe->setParent(this); \
\r
1077 *m_pos_##proper = m_##proper = typesafe; \
\r
1083 * Implements unmarshalling process branch for typed child singleton element
\r
1084 * in a foreign namespace.
\r
1086 * @param proper the proper name of the child type
\r
1087 * @param ns the C++ namespace for the type
\r
1088 * @param namespaceURI the XML namespace of the child element
\r
1089 * @param force bypass use of hint and just cast down to check child
\r
1091 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
\r
1092 if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
\r
1093 ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
\r
1094 if (typesafe && !m_##proper) { \
\r
1095 typesafe->setParent(this); \
\r
1096 *m_pos_##proper = m_##proper = typesafe; \
\r
1102 * Implements unmarshalling process branch for a generic child singleton element
\r
1104 * @param proper the proper name of the child type
\r
1105 * @param namespaceURI the XML namespace of the child element
\r
1107 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
\r
1108 if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
\r
1109 if (!m_##proper) { \
\r
1110 childXMLObject->setParent(this); \
\r
1111 *m_pos_##proper = m_##proper = childXMLObject; \
\r
1117 * Declares aliased get/set methods for named XML element simple content.
\r
1119 * @param proper the proper name to label the element's content
\r
1121 #define DECL_SIMPLE_CONTENT(proper) \
\r
1122 XMLTOOLING_DOXYGEN(Returns proper.) \
\r
1123 const XMLCh* get##proper() const { \
\r
1124 return getTextContent(); \
\r
1126 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
\r
1127 void set##proper(const XMLCh* proper) { \
\r
1128 setTextContent(proper); \
\r
1132 * Declares aliased get/set methods for named integer XML element content.
\r
1134 * @param proper the proper name to label the element's content
\r
1136 #define DECL_INTEGER_CONTENT(proper) \
\r
1137 XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
\r
1138 std::pair<bool,int> get##proper() const { \
\r
1139 return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \
\r
1141 XMLTOOLING_DOXYGEN(Sets proper.) \
\r
1142 void set##proper(int proper) { \
\r
1144 sprintf(buf,"%d",proper); \
\r
1145 xmltooling::auto_ptr_XMLCh widebuf(buf); \
\r
1146 setTextContent(widebuf.get()); \
\r
1148 XMLTOOLING_DOXYGEN(Sets or clears proper.) \
\r
1149 void set##proper(const XMLCh* proper) { \
\r
1150 setTextContent(proper); \
\r
1154 * Implements cloning methods for an XMLObject specialization implementation class.
\r
1156 * @param cname the name of the XMLObject specialization
\r
1158 #define IMPL_XMLOBJECT_CLONE(cname) \
\r
1159 cname* clone##cname() const { \
\r
1160 return dynamic_cast<cname*>(clone()); \
\r
1162 xmltooling::XMLObject* clone() const { \
\r
1163 std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
\r
1164 cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
\r
1166 domClone.release(); \
\r
1169 return new cname##Impl(*this); \
\r
1173 * Declares an XMLObject specialization with a simple content model and type,
\r
1174 * handling it as string data.
\r
1176 * @param linkage linkage specifier for the class
\r
1177 * @param cname the name of the XMLObject specialization
\r
1178 * @param proper the proper name to label the element's content
\r
1179 * @param desc documentation for class
\r
1181 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
\r
1182 BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
\r
1183 DECL_SIMPLE_CONTENT(proper); \
\r
1187 * Declares and defines an implementation class for an XMLObject with
\r
1188 * a simple content model and type, handling it as string data.
\r
1190 * @param linkage linkage specifier for the class
\r
1191 * @param cname the name of the XMLObject specialization
\r
1193 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
\r
1194 class linkage cname##Impl \
\r
1195 : public virtual cname, \
\r
1196 public xmltooling::AbstractSimpleElement, \
\r
1197 public xmltooling::AbstractDOMCachingXMLObject, \
\r
1198 public xmltooling::AbstractXMLObjectMarshaller, \
\r
1199 public xmltooling::AbstractXMLObjectUnmarshaller \
\r
1202 virtual ~cname##Impl() {} \
\r
1203 cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \
\r
1204 : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
\r
1206 cname##Impl(const cname##Impl& src) \
\r
1207 : xmltooling::AbstractXMLObject(src), \
\r
1208 xmltooling::AbstractSimpleElement(src), \
\r
1209 xmltooling::AbstractDOMCachingXMLObject(src) {} \
\r
1210 IMPL_XMLOBJECT_CLONE(cname) \
\r
1213 #ifdef HAVE_COVARIANT_RETURNS
\r
1216 * Begins the declaration of an XMLObjectBuilder specialization.
\r
1217 * Basic boilerplate includes an empty virtual destructor, and
\r
1218 * a default builder that defaults the element name.
\r
1220 * @param linkage linkage specifier for the class
\r
1221 * @param cname the name of the XMLObject specialization
\r
1222 * @param namespaceURI the XML namespace of the default associated element
\r
1223 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1225 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1226 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
\r
1227 class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
\r
1229 virtual ~cname##Builder() {} \
\r
1230 XMLTOOLING_DOXYGEN(Default builder.) \
\r
1231 virtual cname* buildObject() const { \
\r
1232 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
\r
1234 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
\r
1235 virtual cname* buildObject( \
\r
1236 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
\r
1240 * Ends the declaration of an XMLObjectBuilder specialization.
\r
1242 #define END_XMLOBJECTBUILDER }
\r
1245 * Declares a generic XMLObjectBuilder specialization.
\r
1247 * @param linkage linkage specifier for the class
\r
1248 * @param cname the name of the XMLObject specialization
\r
1249 * @param namespaceURI the XML namespace of the default associated element
\r
1250 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1252 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1253 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
\r
1254 XMLTOOLING_DOXYGEN(Singleton builder.) \
\r
1255 static cname* build##cname() { \
\r
1256 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
\r
1257 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
\r
1260 return b->buildObject(); \
\r
1261 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
\r
1263 END_XMLOBJECTBUILDER
\r
1266 * Implements the standard XMLObjectBuilder specialization function.
\r
1268 * @param cname the name of the XMLObject specialization
\r
1270 #define IMPL_XMLOBJECTBUILDER(cname) \
\r
1271 cname* cname##Builder::buildObject( \
\r
1272 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
\r
1275 return new cname##Impl(nsURI,localName,prefix,schemaType); \
\r
1278 #else /* !HAVE_COVARIANT_RETURNS */
\r
1281 * Begins the declaration of an XMLObjectBuilder specialization.
\r
1282 * Basic boilerplate includes an empty virtual destructor, and
\r
1283 * a default builder that defaults the element name.
\r
1285 * @param linkage linkage specifier for the class
\r
1286 * @param cname the name of the XMLObject specialization
\r
1287 * @param namespaceURI the XML namespace of the default associated element
\r
1288 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1290 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1291 XMLTOOLING_DOXYGEN(Builder for cname objects.) \
\r
1292 class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
\r
1294 virtual ~cname##Builder() {} \
\r
1295 XMLTOOLING_DOXYGEN(Default builder.) \
\r
1296 virtual xmltooling::XMLObject* buildObject() const { \
\r
1297 return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
\r
1299 XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
\r
1300 virtual xmltooling::XMLObject* buildObject( \
\r
1301 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \
\r
1305 * Ends the declaration of an XMLObjectBuilder specialization.
\r
1307 #define END_XMLOBJECTBUILDER }
\r
1310 * Declares a generic XMLObjectBuilder specialization.
\r
1312 * @param linkage linkage specifier for the class
\r
1313 * @param cname the name of the XMLObject specialization
\r
1314 * @param namespaceURI the XML namespace of the default associated element
\r
1315 * @param namespacePrefix the XML namespace prefix of the default associated element
\r
1317 #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
\r
1318 BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
\r
1319 XMLTOOLING_DOXYGEN(Singleton builder.) \
\r
1320 static cname* build##cname() { \
\r
1321 const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
\r
1322 XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
\r
1325 return dynamic_cast<cname*>(b->buildObject()); \
\r
1326 throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
\r
1328 END_XMLOBJECTBUILDER
\r
1331 * Implements the standard XMLObjectBuilder specialization function.
\r
1333 * @param cname the name of the XMLObject specialization
\r
1335 #define IMPL_XMLOBJECTBUILDER(cname) \
\r
1336 xmltooling::XMLObject* cname##Builder::buildObject( \
\r
1337 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \
\r
1340 return new cname##Impl(nsURI,localName,prefix,schemaType); \
\r
1343 #endif /* HAVE_COVARIANT_RETURNS */
\r
1346 * Begins the declaration of a Schema Validator specialization.
\r
1348 * @param linkage linkage specifier for the class
\r
1349 * @param cname the base name of the Validator specialization
\r
1351 #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
\r
1352 class linkage cname##SchemaValidator : public xmltooling::Validator \
\r
1355 virtual ~cname##SchemaValidator() {} \
\r
1356 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
\r
1357 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
\r
1359 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name())); \
\r
1360 if (ptr->nil() && (ptr->hasChildren() || ptr->getTextContent())) \
\r
1361 throw xmltooling::ValidationException("Object has nil property but with children or content.")
\r
1364 * Begins the declaration of a Schema Validator specialization subclass.
\r
1366 * @param linkage linkage specifier for the class
\r
1367 * @param cname the base name of the Validator specialization
\r
1368 * @param base base class for the validator
\r
1370 #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
\r
1371 class linkage cname##SchemaValidator : public base##SchemaValidator \
\r
1374 virtual ~cname##SchemaValidator() {} \
\r
1375 virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
\r
1376 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
\r
1378 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()));
\r
1381 * Ends the declaration of a Validator specialization.
\r
1383 #define END_XMLOBJECTVALIDATOR } }
\r
1386 * Validator code that checks the object type.
\r
1388 * @param cname the name of the XMLObject specialization
\r
1390 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
\r
1391 const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
\r
1393 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
\r
1396 * Validator code that checks for a required attribute, content, or singleton.
\r
1398 * @param cname the name of the XMLObject specialization
\r
1399 * @param proper the proper name of the attribute, content, or singleton member
\r
1401 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
\r
1402 if (!ptr->get##proper()) \
\r
1403 throw xmltooling::ValidationException(#cname" must have "#proper".")
\r
1406 * Validator code that checks for a required integer attribute
\r
1408 * @param cname the name of the XMLObject specialization
\r
1409 * @param proper the proper name of the attribute, content, or singleton member
\r
1411 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
\r
1412 if (!ptr->get##proper().first) \
\r
1413 throw xmltooling::ValidationException(#cname" must have "#proper".")
\r
1416 * Validator code that checks for one of a pair of
\r
1417 * required attributes, content, or singletons.
\r
1419 * @param cname the name of the XMLObject specialization
\r
1420 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1421 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1423 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
\r
1424 if (!ptr->get##proper1() && !ptr->get##proper2()) \
\r
1425 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
\r
1428 * Validator code that checks for one of a pair of
\r
1429 * required attributes, content, or singletons, but disallows both.
\r
1431 * @param cname the name of the XMLObject specialization
\r
1432 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1433 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1435 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
\r
1436 if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
\r
1437 throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
\r
1440 * Validator code that checks for one of a set of three
\r
1441 * required attributes, content, or singletons.
\r
1443 * @param cname the name of the XMLObject specialization
\r
1444 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1445 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1446 * @param proper3 the proper name of the third attribute, content, or singleton member
\r
1448 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
\r
1449 if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
\r
1450 throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
\r
1453 * Validator code that checks for one of a set of three
\r
1454 * required attributes, content, or singletons but disallows more than one.
\r
1456 * @param cname the name of the XMLObject specialization
\r
1457 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1458 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1459 * @param proper3 the proper name of the third attribute, content, or singleton member
\r
1461 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
\r
1462 int c##proper1##proper2##proper3=0; \
\r
1463 if (ptr->get##proper1()!=NULL) \
\r
1464 c##proper1##proper2##proper3++; \
\r
1465 if (ptr->get##proper2()!=NULL) \
\r
1466 c##proper1##proper2##proper3++; \
\r
1467 if (ptr->get##proper3()!=NULL) \
\r
1468 c##proper1##proper2##proper3++; \
\r
1469 if (c##proper1##proper2##proper3 != 1) \
\r
1470 throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
\r
1473 * Validator code that checks a co-constraint (if one present, the other must be)
\r
1474 * between a pair of attributes, content, or singletons.
\r
1476 * @param cname the name of the XMLObject specialization
\r
1477 * @param proper1 the proper name of the first attribute, content, or singleton member
\r
1478 * @param proper2 the proper name of the second attribute, content, or singleton member
\r
1480 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
\r
1481 if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
\r
1482 throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
\r
1485 * Validator code that checks for a non-empty collection.
\r
1487 * @param cname the name of the XMLObject specialization
\r
1488 * @param proper the proper name of the collection item
\r
1490 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
\r
1491 if (ptr->get##proper##s().empty()) \
\r
1492 throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
\r
1495 * Declares/defines a Validator specialization that checks object type and
\r
1496 * a non-empty simple content model.
\r
1498 * @param linkage linkage specifier for the class
\r
1499 * @param cname the name of the XMLObject specialization
\r
1501 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
\r
1502 BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
\r
1503 XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
\r
1504 END_XMLOBJECTVALIDATOR
\r
1506 #include <utility>
\r
1509 * @namespace xmltooling
\r
1510 * Public namespace of XML Tooling library
\r
1512 namespace xmltooling {
\r
1515 * Template function for cloning a sequence of XMLObjects.
\r
1516 * Invokes the clone() member on each element of the input sequence and adds the copy to
\r
1517 * the output sequence. Order is preserved.
\r
1519 * @param in input sequence to clone
\r
1520 * @param out output sequence to copy cloned pointers into
\r
1522 template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
\r
1523 for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
\r
1525 out.push_back((*i)->clone());
\r
1527 out.push_back(*i);
\r
1532 * Functor for cleaning up heap objects in containers.
\r
1534 template<class T> struct cleanup
\r
1537 * Function operator to delete an object.
\r
1539 * @param ptr object to delete
\r
1541 void operator()(T* ptr) {delete ptr;}
\r
1544 * Function operator to delete an object stored as const.
\r
1546 * @param ptr object to delete after casting away const
\r
1548 void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
\r
1552 * Functor for cleaning up heap objects in key/value containers.
\r
1554 template<class A,class B> struct cleanup_pair
\r
1557 * Function operator to delete an object.
\r
1559 * @param p a pair in which the second component is the object to delete
\r
1561 void operator()(const std::pair<const A,B*>& p) {delete p.second;}
\r
1565 * Functor for cleaning up const heap objects in key/value containers.
\r
1567 template<class A,class B> struct cleanup_const_pair
\r
1570 * Function operator to delete an object stored as const
\r
1572 * @param p a pair in which the second component is the const object to delete
\r
1574 void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
\r
1578 #endif /* __xmltooling_base_h__ */
\r