https://issues.shibboleth.net/jira/browse/CPPXT-20
[shibboleth/cpp-xmltooling.git] / xmltooling / base.h
1 /*\r
2  *  Copyright 2001-2008 Internet2\r
3  *\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
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\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
15  */\r
16 \r
17 /**\r
18  * @file xmltooling/base.h\r
19  *\r
20  * Base header file definitions\r
21  * Must be included prior to including any other header\r
22  */\r
23 \r
24 #ifndef __xmltooling_base_h__\r
25 #define __xmltooling_base_h__\r
26 \r
27 #include <typeinfo>\r
28 \r
29 #if defined (_MSC_VER) || defined(__BORLANDC__)\r
30   #include <xmltooling/config_pub_win32.h>\r
31 #else\r
32   #include <xmltooling/config_pub.h>\r
33 #endif\r
34 \r
35 #ifdef XMLTOOLING_LITE\r
36 # define XMLTOOLING_NO_XMLSEC 1\r
37 #endif\r
38 \r
39 // Windows and GCC4 Symbol Visibility Macros\r
40 #ifdef WIN32\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
45 #else\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
51   #else\r
52     #define XMLTOOL_EXPORT\r
53     #define XMLTOOL_DLLLOCAL\r
54     #define XMLTOOL_DLLPUBLIC\r
55   #endif\r
56 #endif\r
57 \r
58 // Define XMLTOOL_API for DLL builds\r
59 #ifdef XMLTOOLING_EXPORTS\r
60   #define XMLTOOL_API XMLTOOL_EXPORT\r
61 #else\r
62   #define XMLTOOL_API XMLTOOL_IMPORT\r
63 #endif\r
64 \r
65 // Throwable classes must always be visible on GCC in all binaries\r
66 #ifdef WIN32\r
67   #define XMLTOOL_EXCEPTIONAPI(api) api\r
68 #elif defined(GCC_HASCLASSVISIBILITY)\r
69   #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT\r
70 #else\r
71   #define XMLTOOL_EXCEPTIONAPI(api)\r
72 #endif\r
73 \r
74 #ifdef _MSC_VER\r
75     #define XMLTOOLING_DOXYGEN(desc) /##** desc */\r
76 #else\r
77     #define XMLTOOLING_DOXYGEN(desc)\r
78 #endif\r
79 \r
80 /**\r
81  * Blocks copy c'tor and assignment operator for a class.\r
82  */\r
83 #define MAKE_NONCOPYABLE(type) \\r
84     private: \\r
85         type(const type&); \\r
86         type& operator=(const type&)\r
87 \r
88 #ifndef DOXYGEN_SKIP\r
89 #ifndef NULL\r
90 #define NULL    0\r
91 #endif\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
206 \r
207 /**\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
211  *\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
216  */\r
217 #define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \\r
218     XMLTOOLING_DOXYGEN(desc) \\r
219     class linkage cname : public virtual base { \\r
220     protected: \\r
221         cname() {} \\r
222     public: \\r
223         virtual ~cname() {} \\r
224         XMLTOOLING_DOXYGEN(Element local name) \\r
225         static const XMLCh LOCAL_NAME[]; \\r
226     }\r
227 \r
228 /**\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
232  *\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
237  */\r
238 #define BEGIN_XMLOBJECT(linkage,cname,base,desc) \\r
239     XMLTOOLING_DOXYGEN(desc) \\r
240     class linkage cname : public virtual base { \\r
241     protected: \\r
242         cname() {} \\r
243     public: \\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
249 \r
250 /**\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
254  *\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
260  */\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
264     protected: \\r
265         cname() {} \\r
266     public: \\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
272 \r
273 /**\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
277  *\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
284  */\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
288     protected: \\r
289         cname() {} \\r
290     public: \\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
296 \r
297 /**\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
301  *\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
309  */\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
313     protected: \\r
314         cname() {} \\r
315     public: \\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
321 \r
322 /**\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
326  *\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
335  */\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
339     protected: \\r
340         cname() {} \\r
341     public: \\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
347 \r
348 /**\r
349  * Ends the declaration of an XMLObject specialization.\r
350  */\r
351 #define END_XMLOBJECT }\r
352 \r
353 /**\r
354  * Declares a static variable holding the XMLObject's element QName.\r
355  */\r
356 #define DECL_ELEMENT_QNAME \\r
357     public: \\r
358         XMLTOOLING_DOXYGEN(Element QName) \\r
359         static xmltooling::QName ELEMENT_QNAME\r
360 \r
361 /**\r
362  * Declares a static variable holding the XMLObject's schema type QName.\r
363  */\r
364 #define DECL_TYPE_QNAME \\r
365     public: \\r
366         XMLTOOLING_DOXYGEN(Type QName) \\r
367         static xmltooling::QName TYPE_QNAME\r
368 \r
369 /**\r
370  * Implements a static variable holding an XMLObject's element QName.\r
371  *\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
375  */\r
376 #define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \\r
377     xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)\r
378 \r
379 /**\r
380  * Implements a static variable holding an XMLObject's schema type QName.\r
381  *\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
385  */\r
386 #define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \\r
387     xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)\r
388 \r
389 /**\r
390  * Declares abstract set method for a typed XML attribute.\r
391  * The get method is omitted.\r
392  *\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
396  */\r
397 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \\r
398     public: \\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
403 \r
404 /**\r
405  * Declares abstract get/set methods for a typed XML attribute.\r
406  *\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
410  */\r
411 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \\r
412     public: \\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
419 \r
420 /**\r
421  * Declares abstract set method for a string XML attribute.\r
422  * The get method is omitted.\r
423  *\r
424  * @param proper    the proper name of the attribute\r
425  * @param upcased   the upcased name of the attribute\r
426  */\r
427 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \\r
428     DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)\r
429 \r
430 /**\r
431  * Declares abstract get/set methods for a string XML attribute.\r
432  *\r
433  * @param proper    the proper name of the attribute\r
434  * @param upcased   the upcased name of the attribute\r
435  */\r
436 #define DECL_STRING_ATTRIB(proper,upcased) \\r
437     DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)\r
438 \r
439 /**\r
440  * Declares abstract set method for a DateTime XML attribute.\r
441  * The get method is omitted.\r
442  *\r
443  * @param proper    the proper name of the attribute\r
444  * @param upcased   the upcased name of the attribute\r
445  */\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
452 \r
453 /**\r
454  * Declares abstract get/set methods for a DateTime XML attribute.\r
455  *\r
456  * @param proper    the proper name of the attribute\r
457  * @param upcased   the upcased name of the attribute\r
458  */\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
467 \r
468 /**\r
469  * Declares abstract set method for an integer XML attribute.\r
470  * The get method is omitted.\r
471  *\r
472  * @param proper    the proper name of the attribute\r
473  * @param upcased   the upcased name of the attribute\r
474  */\r
475 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \\r
476     public: \\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
483 \r
484 /**\r
485  * Declares abstract get/set methods for an integer XML attribute.\r
486  *\r
487  * @param proper    the proper name of the attribute\r
488  * @param upcased   the upcased name of the attribute\r
489  */\r
490 #define DECL_INTEGER_ATTRIB(proper,upcased) \\r
491     public: \\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
500 \r
501 /**\r
502  * Declares abstract get/set methods for a boolean XML attribute.\r
503  *\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
507  */\r
508 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \\r
509     public: \\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
517                     return true; \\r
518                 case xmlconstants::XML_BOOL_FALSE: \\r
519                 case xmlconstants::XML_BOOL_ZERO: \\r
520                     return false; \\r
521                 default: \\r
522                     return def; \\r
523             } \\r
524         } \\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
532         } \\r
533         XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \\r
534         void set##proper(const XMLCh* value) { \\r
535             if (value) { \\r
536                 switch (*value) { \\r
537                     case xercesc::chLatin_t: \\r
538                         proper(xmlconstants::XML_BOOL_TRUE); \\r
539                         break; \\r
540                     case xercesc::chLatin_f: \\r
541                         proper(xmlconstants::XML_BOOL_FALSE); \\r
542                         break; \\r
543                     case xercesc::chDigit_1: \\r
544                         proper(xmlconstants::XML_BOOL_ONE); \\r
545                         break; \\r
546                     case xercesc::chDigit_0: \\r
547                         proper(xmlconstants::XML_BOOL_ZERO); \\r
548                         break; \\r
549                     default: \\r
550                         proper(xmlconstants::XML_BOOL_NULL); \\r
551                 } \\r
552             } \\r
553             else \\r
554                 proper(xmlconstants::XML_BOOL_NULL); \\r
555         }\r
556 \r
557 /**\r
558  * Implements get/set methods and a private member for a typed XML attribute.\r
559  *\r
560  * @param proper    the proper name of the attribute\r
561  * @param type      the attribute's data type\r
562  */\r
563 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \\r
564     protected: \\r
565         type* m_##proper; \\r
566     public: \\r
567         const type* get##proper() const { \\r
568             return m_##proper; \\r
569         } \\r
570         void set##proper(const type* proper) { \\r
571             m_##proper = prepareForAssignment(m_##proper,proper); \\r
572         }\r
573 \r
574 /**\r
575  * Implements get/set methods and a private member for a string XML attribute.\r
576  *\r
577  * @param proper    the proper name of the attribute\r
578  */\r
579 #define IMPL_STRING_ATTRIB(proper) \\r
580     IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)\r
581 \r
582 /**\r
583  * Implements get/set methods and a private member for a string XML attribute,\r
584  * plus a getXMLID override.\r
585  *\r
586  * @param proper    the proper name of the attribute\r
587  */\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
592     }\r
593 \r
594 /**\r
595  * Implements get/set methods and a private member for a DateTime XML attribute.\r
596  *\r
597  * @param proper    the proper name of the attribute\r
598  * @param fallback  epoch to return when attribute is NULL\r
599  */\r
600 #define IMPL_DATETIME_ATTRIB(proper,fallback) \\r
601     IMPL_DATETIME_ATTRIB_EX(proper,fallback,false)\r
602 \r
603 /**\r
604  * Implements get/set methods and a private member for a duration-valued DateTime XML attribute.\r
605  *\r
606  * @param proper    the proper name of the attribute\r
607  * @param fallback  epoch to return when attribute is NULL\r
608  */\r
609 #define IMPL_DURATION_ATTRIB(proper,fallback) \\r
610     IMPL_DATETIME_ATTRIB_EX(proper,fallback,true)\r
611 \r
612 /**\r
613  * Implements get/set methods and a private member for a DateTime XML attribute.\r
614  *\r
615  * @param proper    the proper name of the attribute\r
616  * @param fallback  epoch to return when attribute is NULL\r
617  * @param duration  true iff the attribute should be handled as a duration\r
618  */\r
619 #define IMPL_DATETIME_ATTRIB_EX(proper,fallback,duration) \\r
620     protected: \\r
621         DateTime* m_##proper; \\r
622         time_t m_##proper##Epoch; \\r
623     public: \\r
624         const DateTime* get##proper() const { \\r
625             return m_##proper; \\r
626         } \\r
627         time_t get##proper##Epoch() const { \\r
628             return m_##proper ? m_##proper##Epoch : fallback; \\r
629         } \\r
630         void set##proper(const DateTime* proper) { \\r
631             m_##proper = prepareForAssignment(m_##proper,proper); \\r
632             if (m_##proper) \\r
633                 m_##proper##Epoch=m_##proper->getEpoch(); \\r
634         } \\r
635         void set##proper(time_t proper) { \\r
636             m_##proper = prepareForAssignment(m_##proper,proper,duration); \\r
637             m_##proper##Epoch = proper; \\r
638         } \\r
639         void set##proper(const XMLCh* proper) { \\r
640             m_##proper = prepareForAssignment(m_##proper,proper,duration); \\r
641             if (m_##proper) \\r
642                 m_##proper##Epoch=m_##proper->getEpoch(); \\r
643         }\r
644 \r
645 /**\r
646  * Implements get/set methods and a private member for an integer XML attribute.\r
647  *\r
648  * @param proper    the proper name of the attribute\r
649  */\r
650 #define IMPL_INTEGER_ATTRIB(proper) \\r
651     protected: \\r
652         XMLCh* m_##proper; \\r
653     public: \\r
654         pair<bool,int> get##proper() const { \\r
655             return make_pair((m_##proper!=NULL),(m_##proper!=NULL ? xercesc::XMLString::parseInt(m_##proper): 0)); \\r
656         } \\r
657         void set##proper(const XMLCh* proper) { \\r
658             m_##proper = prepareForAssignment(m_##proper,proper); \\r
659         } \\r
660         void set##proper(int proper) { \\r
661             char buf##proper[64]; \\r
662             sprintf(buf##proper,"%d",proper); \\r
663             auto_ptr_XMLCh wide##proper(buf##proper); \\r
664             set##proper(wide##proper.get()); \\r
665         }\r
666 \r
667 /**\r
668  * Implements get/set methods and a private member for a boolean XML attribute.\r
669  *\r
670  * @param proper    the proper name of the attribute\r
671  */\r
672 #define IMPL_BOOLEAN_ATTRIB(proper) \\r
673     protected: \\r
674         xmlconstants::xmltooling_bool_t m_##proper; \\r
675     public: \\r
676         xmlconstants::xmltooling_bool_t get##proper() const { \\r
677             return m_##proper; \\r
678         } \\r
679         void proper(xmlconstants::xmltooling_bool_t value) { \\r
680             if (m_##proper != value) { \\r
681                 releaseThisandParentDOM(); \\r
682                 m_##proper = value; \\r
683             } \\r
684         }\r
685 \r
686 /**\r
687  * Implements get/set methods and a private member for a typed, qualified XML attribute.\r
688  *\r
689  * @param proper    the proper name of the attribute\r
690  * @param type      the attribute's data type\r
691  */\r
692 #define IMPL_XMLOBJECT_FOREIGN_ATTRIB(proper,type) \\r
693     protected: \\r
694     XMLCh* m_##proper##Prefix; \\r
695         type* m_##proper; \\r
696     public: \\r
697         const type* get##proper() const { \\r
698             return m_##proper; \\r
699         } \\r
700         void set##proper(const type* proper) { \\r
701             m_##proper = prepareForAssignment(m_##proper,proper); \\r
702             XMLString::release(&m_##proper##Prefix); \\r
703             m_##proper##Prefix = NULL; \\r
704         }\r
705 \r
706 /**\r
707  * Declares abstract set method for a typed XML child object in a foreign namespace.\r
708  * The get method is omitted.\r
709  *\r
710  * @param proper    the proper name of the child type\r
711  * @param ns        the C++ namespace for the type\r
712  */\r
713 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \\r
714     public: \\r
715         XMLTOOLING_DOXYGEN(Sets the proper child.) \\r
716         virtual void set##proper(ns::proper* child)=0\r
717 \r
718 /**\r
719  * Declares abstract get/set methods for a typed XML child object in a foreign namespace.\r
720  *\r
721  * @param proper    the proper name of the child type\r
722  * @param ns        the C++ namespace for the type\r
723  */\r
724 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \\r
725     public: \\r
726         XMLTOOLING_DOXYGEN(Returns the proper child.) \\r
727         virtual ns::proper* get##proper() const=0; \\r
728         XMLTOOLING_DOXYGEN(Sets the proper child.) \\r
729         virtual void set##proper(ns::proper* child)=0\r
730 \r
731 /**\r
732  * Declares abstract set method for a typed XML child object.\r
733  * The get method is omitted.\r
734  *\r
735  * @param proper    the proper name of the child type\r
736  */\r
737 #define DECL_INHERITED_TYPED_CHILD(proper) \\r
738     public: \\r
739         XMLTOOLING_DOXYGEN(Sets the proper child.) \\r
740         virtual void set##proper(proper* child)=0\r
741 \r
742 /**\r
743  * Declares abstract get/set methods for a typed XML child object.\r
744  *\r
745  * @param proper    the proper name of the child type\r
746  */\r
747 #define DECL_TYPED_CHILD(proper) \\r
748     public: \\r
749         XMLTOOLING_DOXYGEN(Returns the proper child.) \\r
750         virtual proper* get##proper() const=0; \\r
751         XMLTOOLING_DOXYGEN(Sets the proper child.) \\r
752         virtual void set##proper(proper* child)=0\r
753 \r
754 /**\r
755  * Declares abstract get/set methods for a generic XML child object.\r
756  *\r
757  * @param proper    the proper name of the child\r
758  */\r
759 #define DECL_XMLOBJECT_CHILD(proper) \\r
760     public: \\r
761         XMLTOOLING_DOXYGEN(Returns the proper child.) \\r
762         virtual xmltooling::XMLObject* get##proper() const=0; \\r
763         XMLTOOLING_DOXYGEN(Sets the proper child.) \\r
764         virtual void set##proper(xmltooling::XMLObject* child)=0\r
765 \r
766 \r
767 /**\r
768  * Implements get/set methods and a private list iterator member for a typed XML child object.\r
769  *\r
770  * @param proper    the proper name of the child type\r
771  */\r
772 #define IMPL_TYPED_CHILD(proper) \\r
773     protected: \\r
774         proper* m_##proper; \\r
775         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \\r
776     public: \\r
777         proper* get##proper() const { \\r
778             return m_##proper; \\r
779         } \\r
780         void set##proper(proper* child) { \\r
781             prepareForAssignment(m_##proper,child); \\r
782             *m_pos_##proper = m_##proper = child; \\r
783         }\r
784 \r
785 /**\r
786  * Implements get/set methods and a private list iterator member for\r
787  * a typed XML child object in a foreign namespace\r
788  *\r
789  * @param proper    the proper name of the child type\r
790  * @param ns        the C++ namespace for the type\r
791  */\r
792 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \\r
793     protected: \\r
794         ns::proper* m_##proper; \\r
795         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \\r
796     public: \\r
797         ns::proper* get##proper() const { \\r
798             return m_##proper; \\r
799         } \\r
800         void set##proper(ns::proper* child) { \\r
801             prepareForAssignment(m_##proper,child); \\r
802             *m_pos_##proper = m_##proper = child; \\r
803         }\r
804 \r
805 /**\r
806  * Implements get/set methods and a private list iterator member for a generic XML child object.\r
807  *\r
808  * @param proper    the proper name of the child\r
809  */\r
810 #define IMPL_XMLOBJECT_CHILD(proper) \\r
811     protected: \\r
812         xmltooling::XMLObject* m_##proper; \\r
813         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \\r
814     public: \\r
815         xmltooling::XMLObject* get##proper() const { \\r
816             return m_##proper; \\r
817         } \\r
818         void set##proper(xmltooling::XMLObject* child) { \\r
819             prepareForAssignment(m_##proper,child); \\r
820             *m_pos_##proper = m_##proper = child; \\r
821         }\r
822 \r
823 /**\r
824  * Declares abstract get/set methods for a typed XML child collection.\r
825  *\r
826  * @param proper    the proper name of the child type\r
827  */\r
828 #define DECL_TYPED_CHILDREN(proper) \\r
829     public: \\r
830         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \\r
831         virtual VectorOf(proper) get##proper##s()=0; \\r
832         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \\r
833         virtual const std::vector<proper*>& get##proper##s() const=0\r
834 \r
835 /**\r
836  * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.\r
837  *\r
838  * @param proper    the proper name of the child type\r
839  * @param ns        the C++ namespace for the type\r
840  */\r
841 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \\r
842     public: \\r
843         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \\r
844         virtual VectorOf(ns::proper) get##proper##s()=0; \\r
845         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \\r
846         virtual const std::vector<ns::proper*>& get##proper##s() const=0\r
847 \r
848 /**\r
849  * Declares abstract get/set methods for a generic XML child collection.\r
850  *\r
851  * @param proper    the proper name of the child\r
852  */\r
853 #define DECL_XMLOBJECT_CHILDREN(proper) \\r
854     public: \\r
855         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \\r
856         virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \\r
857         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \\r
858         virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0\r
859 \r
860 /**\r
861  * Implements get method and a private vector member for a typed XML child collection.\r
862  *\r
863  * @param proper    the proper name of the child type\r
864  * @param fence     insertion fence for new objects of the child collection in backing list\r
865  */\r
866 #define IMPL_TYPED_CHILDREN(proper,fence) \\r
867     protected: \\r
868         std::vector<proper*> m_##proper##s; \\r
869     public: \\r
870         VectorOf(proper) get##proper##s() { \\r
871             return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \\r
872         } \\r
873         const std::vector<proper*>& get##proper##s() const { \\r
874             return m_##proper##s; \\r
875         }\r
876 \r
877 /**\r
878  * Implements get method and a private vector member for a typed XML child collection\r
879  * in a foreign namespace.\r
880  *\r
881  * @param proper    the proper name of the child type\r
882  * @param ns        the C++ namespace for the type\r
883  * @param fence     insertion fence for new objects of the child collection in backing list\r
884  */\r
885 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \\r
886     protected: \\r
887         std::vector<ns::proper*> m_##proper##s; \\r
888     public: \\r
889         VectorOf(ns::proper) get##proper##s() { \\r
890             return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \\r
891         } \\r
892         const std::vector<ns::proper*>& get##proper##s() const { \\r
893             return m_##proper##s; \\r
894         }\r
895 \r
896 /**\r
897  * Implements get method and a private vector member for a generic XML child collection.\r
898  *\r
899  * @param proper    the proper name of the child\r
900  * @param fence     insertion fence for new objects of the child collection in backing list\r
901  */\r
902 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \\r
903     protected: \\r
904         std::vector<xmltooling::XMLObject*> m_##proper##s; \\r
905     public: \\r
906         VectorOf(xmltooling::XMLObject) get##proper##s() { \\r
907             return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \\r
908         } \\r
909         const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \\r
910             return m_##proper##s; \\r
911         }\r
912 \r
913 /**\r
914  * Implements marshalling for a string attribute\r
915  *\r
916  * @param proper        the proper name of the attribute\r
917  * @param ucase         the upcased name of the attribute\r
918  * @param namespaceURI  the XML namespace of the attribute\r
919  */\r
920 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \\r
921     if (m_##proper && *m_##proper) { \\r
922         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \\r
923     }\r
924 \r
925 /**\r
926  * Implements marshalling for a DateTime attribute\r
927  *\r
928  * @param proper        the proper name of the attribute\r
929  * @param ucase         the upcased name of the attribute\r
930  * @param namespaceURI  the XML namespace of the attribute\r
931  */\r
932 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \\r
933     if (m_##proper) { \\r
934         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \\r
935     }\r
936 \r
937 /**\r
938  * Implements marshalling for an integer attribute\r
939  *\r
940  * @param proper        the proper name of the attribute\r
941  * @param ucase         the upcased name of the attribute\r
942  * @param namespaceURI  the XML namespace of the attribute\r
943  */\r
944 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \\r
945     if (m_##proper && *m_##proper) { \\r
946         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \\r
947     }\r
948 \r
949 /**\r
950  * Implements marshalling for a boolean attribute\r
951  *\r
952  * @param proper        the proper name of the attribute\r
953  * @param ucase         the upcased name of the attribute\r
954  * @param namespaceURI  the XML namespace of the attribute\r
955  */\r
956 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \\r
957     switch (m_##proper) { \\r
958         case xmlconstants::XML_BOOL_TRUE: \\r
959             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \\r
960             break; \\r
961         case xmlconstants::XML_BOOL_ONE: \\r
962             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \\r
963             break; \\r
964         case xmlconstants::XML_BOOL_FALSE: \\r
965             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \\r
966             break; \\r
967         case xmlconstants::XML_BOOL_ZERO: \\r
968             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \\r
969             break; \\r
970         case xmlconstants::XML_BOOL_NULL: \\r
971             break; \\r
972     }\r
973 \r
974 /**\r
975  * Implements marshalling for a QName attribute\r
976  *\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
980  */\r
981 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \\r
982     if (m_##proper) { \\r
983         auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \\r
984         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \\r
985     }\r
986 \r
987 /**\r
988  * Implements marshalling for an ID attribute\r
989  *\r
990  * @param proper        the proper name of the attribute\r
991  * @param ucase         the upcased name of the attribute\r
992  * @param namespaceURI  the XML namespace of the attribute\r
993  */\r
994 #define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \\r
995     if (m_##proper && *m_##proper) { \\r
996         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \\r
997         domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \\r
998     }\r
999 \r
1000 /**\r
1001  * Implements unmarshalling process branch for a string attribute\r
1002  *\r
1003  * @param proper        the proper name of the attribute\r
1004  * @param ucase         the upcased name of the attribute\r
1005  * @param namespaceURI  the XML namespace of the attribute\r
1006  */\r
1007 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \\r
1008     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \\r
1009         set##proper(attribute->getValue()); \\r
1010         return; \\r
1011     }\r
1012 \r
1013 /**\r
1014  * Implements unmarshalling process branch for an ID attribute\r
1015  *\r
1016  * @param proper        the proper name of the attribute\r
1017  * @param ucase         the upcased name of the attribute\r
1018  * @param namespaceURI  the XML namespace of the attribute\r
1019  */\r
1020 #define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \\r
1021     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \\r
1022         set##proper(attribute->getValue()); \\r
1023         attribute->getOwnerElement()->setIdAttributeNode(attribute); \\r
1024         return; \\r
1025     }\r
1026 \r
1027 /**\r
1028  * Implements unmarshalling process branch for a DateTime attribute\r
1029  *\r
1030  * @param proper        the proper name of the attribute\r
1031  * @param ucase         the upcased name of the attribute\r
1032  * @param namespaceURI  the XML namespace of the attribute\r
1033  */\r
1034 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \\r
1035     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)\r
1036 \r
1037 /**\r
1038  * Implements unmarshalling process branch for a DateTime attribute\r
1039  *\r
1040  * @param proper        the proper name of the attribute\r
1041  * @param ucase         the upcased name of the attribute\r
1042  * @param namespaceURI  the XML namespace of the attribute\r
1043  */\r
1044 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \\r
1045     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \\r
1046         set##proper(XMLHelper::getAttributeValueAsQName(attribute)); \\r
1047         return; \\r
1048     }\r
1049 \r
1050 /**\r
1051  * Implements unmarshalling process branch for an integer attribute\r
1052  *\r
1053  * @param proper        the proper name of the attribute\r
1054  * @param ucase         the upcased name of the attribute\r
1055  * @param namespaceURI  the XML namespace of the attribute\r
1056  */\r
1057 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \\r
1058     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)\r
1059 \r
1060 /**\r
1061  * Implements unmarshalling process branch for a boolean attribute\r
1062  *\r
1063  * @param proper        the proper name of the attribute\r
1064  * @param ucase         the upcased name of the attribute\r
1065  * @param namespaceURI  the XML namespace of the attribute\r
1066  */\r
1067 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \\r
1068     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)\r
1069 \r
1070 /**\r
1071  * Implements unmarshalling process branch for typed child collection element\r
1072  *\r
1073  * @param proper        the proper name of the child type\r
1074  * @param namespaceURI  the XML namespace of the child element\r
1075  * @param force         bypass use of hint and just cast down to check child\r
1076  */\r
1077 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \\r
1078     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \\r
1079         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \\r
1080         if (typesafe) { \\r
1081             get##proper##s().push_back(typesafe); \\r
1082             return; \\r
1083         } \\r
1084     }\r
1085 \r
1086 /**\r
1087  * Implements unmarshalling process branch for typed child collection element\r
1088  * in a foreign namespace.\r
1089  *\r
1090  * @param proper        the proper name of the child type\r
1091  * @param ns            the C++ namespace for the type\r
1092  * @param namespaceURI  the XML namespace of the child element\r
1093  * @param force         bypass use of hint and just cast down to check child\r
1094  */\r
1095 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \\r
1096     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \\r
1097         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \\r
1098         if (typesafe) { \\r
1099             get##proper##s().push_back(typesafe); \\r
1100             return; \\r
1101         } \\r
1102     }\r
1103 \r
1104 /**\r
1105  * Implements unmarshalling process branch for typed child singleton element\r
1106  *\r
1107  * @param proper        the proper name of the child type\r
1108  * @param namespaceURI  the XML namespace of the child element\r
1109  * @param force         bypass use of hint and just cast down to check child\r
1110  */\r
1111 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \\r
1112     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \\r
1113         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \\r
1114         if (typesafe && !m_##proper) { \\r
1115             typesafe->setParent(this); \\r
1116             *m_pos_##proper = m_##proper = typesafe; \\r
1117             return; \\r
1118         } \\r
1119     }\r
1120 \r
1121 /**\r
1122  * Implements unmarshalling process branch for typed child singleton element\r
1123  * in a foreign namespace.\r
1124  *\r
1125  * @param proper        the proper name of the child type\r
1126  * @param ns            the C++ namespace for the type\r
1127  * @param namespaceURI  the XML namespace of the child element\r
1128  * @param force         bypass use of hint and just cast down to check child\r
1129  */\r
1130 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \\r
1131     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \\r
1132         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \\r
1133         if (typesafe && !m_##proper) { \\r
1134             typesafe->setParent(this); \\r
1135             *m_pos_##proper = m_##proper = typesafe; \\r
1136             return; \\r
1137         } \\r
1138     }\r
1139 \r
1140 /**\r
1141  * Implements unmarshalling process branch for a generic child singleton element\r
1142  *\r
1143  * @param proper        the proper name of the child type\r
1144  * @param namespaceURI  the XML namespace of the child element\r
1145  */\r
1146 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \\r
1147     if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \\r
1148         if (!m_##proper) { \\r
1149             childXMLObject->setParent(this); \\r
1150             *m_pos_##proper = m_##proper = childXMLObject; \\r
1151             return; \\r
1152         } \\r
1153     }\r
1154 \r
1155 /**\r
1156  * Declares aliased get/set methods for named XML element simple content.\r
1157  *\r
1158  * @param proper    the proper name to label the element's content\r
1159  */\r
1160 #define DECL_SIMPLE_CONTENT(proper) \\r
1161     XMLTOOLING_DOXYGEN(Returns proper.) \\r
1162     const XMLCh* get##proper() const { \\r
1163         return getTextContent(); \\r
1164     } \\r
1165     XMLTOOLING_DOXYGEN(Sets or clears proper.) \\r
1166     void set##proper(const XMLCh* proper) { \\r
1167         setTextContent(proper); \\r
1168     }\r
1169 \r
1170 /**\r
1171  * Declares aliased get/set methods for named integer XML element content.\r
1172  *\r
1173  * @param proper    the proper name to label the element's content\r
1174  */\r
1175 #define DECL_INTEGER_CONTENT(proper) \\r
1176     XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \\r
1177     std::pair<bool,int> get##proper() const { \\r
1178         return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \\r
1179     } \\r
1180     XMLTOOLING_DOXYGEN(Sets proper.) \\r
1181     void set##proper(int proper) { \\r
1182         char buf[64]; \\r
1183         sprintf(buf,"%d",proper); \\r
1184         xmltooling::auto_ptr_XMLCh widebuf(buf); \\r
1185         setTextContent(widebuf.get()); \\r
1186     } \\r
1187     XMLTOOLING_DOXYGEN(Sets or clears proper.) \\r
1188     void set##proper(const XMLCh* proper) { \\r
1189         setTextContent(proper); \\r
1190     }\r
1191 \r
1192 /**\r
1193  * Implements cloning methods for an XMLObject specialization implementation class.\r
1194  *\r
1195  * @param cname    the name of the XMLObject specialization\r
1196  */\r
1197 #define IMPL_XMLOBJECT_CLONE(cname) \\r
1198     cname* clone##cname() const { \\r
1199         return dynamic_cast<cname*>(clone()); \\r
1200     } \\r
1201     xmltooling::XMLObject* clone() const { \\r
1202         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \\r
1203         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \\r
1204         if (ret) { \\r
1205             domClone.release(); \\r
1206             return ret; \\r
1207         } \\r
1208         return new cname##Impl(*this); \\r
1209     }\r
1210 \r
1211 /**\r
1212  * Declares an XMLObject specialization with a simple content model and type,\r
1213  * handling it as string data.\r
1214  *\r
1215  * @param linkage   linkage specifier for the class\r
1216  * @param cname     the name of the XMLObject specialization\r
1217  * @param proper    the proper name to label the element's content\r
1218  * @param desc      documentation for class\r
1219  */\r
1220 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \\r
1221     BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \\r
1222         DECL_SIMPLE_CONTENT(proper); \\r
1223     END_XMLOBJECT\r
1224 \r
1225 /**\r
1226  * Declares and defines an implementation class for an XMLObject with\r
1227  * a simple content model and type, handling it as string data.\r
1228  *\r
1229  * @param linkage   linkage specifier for the class\r
1230  * @param cname     the name of the XMLObject specialization\r
1231  */\r
1232 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \\r
1233     class linkage cname##Impl \\r
1234         : public virtual cname, \\r
1235             public xmltooling::AbstractSimpleElement, \\r
1236             public xmltooling::AbstractDOMCachingXMLObject, \\r
1237             public xmltooling::AbstractXMLObjectMarshaller, \\r
1238             public xmltooling::AbstractXMLObjectUnmarshaller \\r
1239     { \\r
1240     public: \\r
1241         virtual ~cname##Impl() {} \\r
1242         cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) \\r
1243             : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \\r
1244         } \\r
1245         cname##Impl(const cname##Impl& src) \\r
1246             : xmltooling::AbstractXMLObject(src), \\r
1247                 xmltooling::AbstractSimpleElement(src), \\r
1248                 xmltooling::AbstractDOMCachingXMLObject(src) {} \\r
1249         IMPL_XMLOBJECT_CLONE(cname) \\r
1250     }\r
1251 \r
1252 #ifdef HAVE_COVARIANT_RETURNS\r
1253 \r
1254 /**\r
1255  * Begins the declaration of an XMLObjectBuilder specialization.\r
1256  * Basic boilerplate includes an empty virtual destructor, and\r
1257  * a default builder that defaults the element name.\r
1258  *\r
1259  * @param linkage           linkage specifier for the class\r
1260  * @param cname             the name of the XMLObject specialization\r
1261  * @param namespaceURI      the XML namespace of the default associated element\r
1262  * @param namespacePrefix   the XML namespace prefix of the default associated element\r
1263  */\r
1264 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \\r
1265     XMLTOOLING_DOXYGEN(Builder for cname objects.) \\r
1266     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \\r
1267     public: \\r
1268         virtual ~cname##Builder() {} \\r
1269         XMLTOOLING_DOXYGEN(Default builder.) \\r
1270         virtual cname* buildObject() const { \\r
1271             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \\r
1272         } \\r
1273         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \\r
1274         virtual cname* buildObject( \\r
1275             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \\r
1276             ) const\r
1277 \r
1278 /**\r
1279  * Ends the declaration of an XMLObjectBuilder specialization.\r
1280  */\r
1281 #define END_XMLOBJECTBUILDER }\r
1282 \r
1283 /**\r
1284  * Declares a generic XMLObjectBuilder specialization.\r
1285  *\r
1286  * @param linkage           linkage specifier for the class\r
1287  * @param cname             the name of the XMLObject specialization\r
1288  * @param namespaceURI      the XML namespace of the default associated element\r
1289  * @param namespacePrefix   the XML namespace prefix of the default associated element\r
1290  */\r
1291  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \\r
1292     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \\r
1293     XMLTOOLING_DOXYGEN(Singleton builder.) \\r
1294     static cname* build##cname() { \\r
1295         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \\r
1296             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \\r
1297             ); \\r
1298         if (b) \\r
1299             return b->buildObject(); \\r
1300         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \\r
1301     } \\r
1302     END_XMLOBJECTBUILDER\r
1303 \r
1304 /**\r
1305  * Implements the standard XMLObjectBuilder specialization function.\r
1306  *\r
1307  * @param cname the name of the XMLObject specialization\r
1308  */\r
1309 #define IMPL_XMLOBJECTBUILDER(cname) \\r
1310     cname* cname##Builder::buildObject( \\r
1311         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \\r
1312         ) const \\r
1313     { \\r
1314         return new cname##Impl(nsURI,localName,prefix,schemaType); \\r
1315     }\r
1316 \r
1317 #else   /* !HAVE_COVARIANT_RETURNS */\r
1318 \r
1319 /**\r
1320  * Begins the declaration of an XMLObjectBuilder specialization.\r
1321  * Basic boilerplate includes an empty virtual destructor, and\r
1322  * a default builder that defaults the element name.\r
1323  *\r
1324  * @param linkage           linkage specifier for the class\r
1325  * @param cname             the name of the XMLObject specialization\r
1326  * @param namespaceURI      the XML namespace of the default associated element\r
1327  * @param namespacePrefix   the XML namespace prefix of the default associated element\r
1328  */\r
1329 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \\r
1330     XMLTOOLING_DOXYGEN(Builder for cname objects.) \\r
1331     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \\r
1332     public: \\r
1333         virtual ~cname##Builder() {} \\r
1334         XMLTOOLING_DOXYGEN(Default builder.) \\r
1335         virtual xmltooling::XMLObject* buildObject() const { \\r
1336             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \\r
1337         } \\r
1338         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \\r
1339         virtual xmltooling::XMLObject* buildObject( \\r
1340             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL \\r
1341             ) const\r
1342 \r
1343 /**\r
1344  * Ends the declaration of an XMLObjectBuilder specialization.\r
1345  */\r
1346 #define END_XMLOBJECTBUILDER }\r
1347 \r
1348 /**\r
1349  * Declares a generic XMLObjectBuilder specialization.\r
1350  *\r
1351  * @param linkage           linkage specifier for the class\r
1352  * @param cname             the name of the XMLObject specialization\r
1353  * @param namespaceURI      the XML namespace of the default associated element\r
1354  * @param namespacePrefix   the XML namespace prefix of the default associated element\r
1355  */\r
1356  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \\r
1357     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \\r
1358     XMLTOOLING_DOXYGEN(Singleton builder.) \\r
1359     static cname* build##cname() { \\r
1360         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \\r
1361             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \\r
1362             ); \\r
1363         if (b) \\r
1364             return dynamic_cast<cname*>(b->buildObject()); \\r
1365         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \\r
1366     } \\r
1367     END_XMLOBJECTBUILDER\r
1368 \r
1369 /**\r
1370  * Implements the standard XMLObjectBuilder specialization function.\r
1371  *\r
1372  * @param cname the name of the XMLObject specialization\r
1373  */\r
1374 #define IMPL_XMLOBJECTBUILDER(cname) \\r
1375     xmltooling::XMLObject* cname##Builder::buildObject( \\r
1376         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType \\r
1377         ) const \\r
1378     { \\r
1379         return new cname##Impl(nsURI,localName,prefix,schemaType); \\r
1380     }\r
1381 \r
1382 #endif  /* HAVE_COVARIANT_RETURNS */\r
1383 \r
1384 /**\r
1385  * Begins the declaration of a Schema Validator specialization.\r
1386  *\r
1387  * @param linkage           linkage specifier for the class\r
1388  * @param cname the base name of the Validator specialization\r
1389  */\r
1390  #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \\r
1391     class linkage cname##SchemaValidator : public xmltooling::Validator \\r
1392     { \\r
1393     public: \\r
1394         virtual ~cname##SchemaValidator() {} \\r
1395         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \\r
1396             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \\r
1397             if (!ptr) \\r
1398                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name())); \\r
1399             if (ptr->nil() && (ptr->hasChildren() || ptr->getTextContent())) \\r
1400                 throw xmltooling::ValidationException("Object has nil property but with children or content.")\r
1401 \r
1402 /**\r
1403  * Begins the declaration of a Schema Validator specialization subclass.\r
1404  *\r
1405  * @param linkage   linkage specifier for the class\r
1406  * @param cname     the base name of the Validator specialization\r
1407  * @param base      base class for the validator\r
1408  */\r
1409  #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \\r
1410     class linkage cname##SchemaValidator : public base##SchemaValidator \\r
1411     { \\r
1412     public: \\r
1413         virtual ~cname##SchemaValidator() {} \\r
1414         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \\r
1415             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \\r
1416             if (!ptr) \\r
1417                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()));\r
1418 \r
1419 /**\r
1420  * Ends the declaration of a Validator specialization.\r
1421  */\r
1422 #define END_XMLOBJECTVALIDATOR } }\r
1423 \r
1424 /**\r
1425  * Validator code that checks the object type.\r
1426  *\r
1427  * @param cname     the name of the XMLObject specialization\r
1428  */\r
1429 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \\r
1430     const cname* ptr=dynamic_cast<const cname*>(xmlObject); \\r
1431     if (!ptr) \\r
1432         throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))\r
1433 \r
1434 /**\r
1435  * Validator code that checks for a required attribute, content, or singleton.\r
1436  *\r
1437  * @param cname     the name of the XMLObject specialization\r
1438  * @param proper    the proper name of the attribute, content, or singleton member\r
1439  */\r
1440 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \\r
1441     if (!ptr->get##proper()) \\r
1442         throw xmltooling::ValidationException(#cname" must have "#proper".")\r
1443 \r
1444 /**\r
1445  * Validator code that checks for a required integer attribute\r
1446  *\r
1447  * @param cname     the name of the XMLObject specialization\r
1448  * @param proper    the proper name of the attribute, content, or singleton member\r
1449  */\r
1450 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \\r
1451     if (!ptr->get##proper().first) \\r
1452         throw xmltooling::ValidationException(#cname" must have "#proper".")\r
1453 \r
1454 /**\r
1455  * Validator code that checks for one of a pair of\r
1456  * required attributes, content, or singletons.\r
1457  *\r
1458  * @param cname     the name of the XMLObject specialization\r
1459  * @param proper1   the proper name of the first attribute, content, or singleton member\r
1460  * @param proper2   the proper name of the second attribute, content, or singleton member\r
1461  */\r
1462 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \\r
1463     if (!ptr->get##proper1() && !ptr->get##proper2()) \\r
1464         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")\r
1465 \r
1466 /**\r
1467  * Validator code that checks for one of a pair of\r
1468  * required attributes, content, or singletons, but disallows both.\r
1469  *\r
1470  * @param cname     the name of the XMLObject specialization\r
1471  * @param proper1   the proper name of the first attribute, content, or singleton member\r
1472  * @param proper2   the proper name of the second attribute, content, or singleton member\r
1473  */\r
1474 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \\r
1475     if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \\r
1476         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")\r
1477 \r
1478 /**\r
1479  * Validator code that checks for one of a set of three\r
1480  * required attributes, content, or singletons.\r
1481  *\r
1482  * @param cname     the name of the XMLObject specialization\r
1483  * @param proper1   the proper name of the first attribute, content, or singleton member\r
1484  * @param proper2   the proper name of the second attribute, content, or singleton member\r
1485  * @param proper3   the proper name of the third attribute, content, or singleton member\r
1486  */\r
1487 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \\r
1488     if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \\r
1489         throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")\r
1490 \r
1491 /**\r
1492  * Validator code that checks for one of a set of three\r
1493  * required attributes, content, or singletons but disallows more than one.\r
1494  *\r
1495  * @param cname     the name of the XMLObject specialization\r
1496  * @param proper1   the proper name of the first attribute, content, or singleton member\r
1497  * @param proper2   the proper name of the second attribute, content, or singleton member\r
1498  * @param proper3   the proper name of the third attribute, content, or singleton member\r
1499  */\r
1500 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \\r
1501     int c##proper1##proper2##proper3=0; \\r
1502     if (ptr->get##proper1()!=NULL) \\r
1503         c##proper1##proper2##proper3++; \\r
1504     if (ptr->get##proper2()!=NULL) \\r
1505         c##proper1##proper2##proper3++; \\r
1506     if (ptr->get##proper3()!=NULL) \\r
1507         c##proper1##proper2##proper3++; \\r
1508     if (c##proper1##proper2##proper3 != 1) \\r
1509         throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")\r
1510 \r
1511 /**\r
1512  * Validator code that checks a co-constraint (if one present, the other must be)\r
1513  * between a pair of attributes, content, or singletons.\r
1514  *\r
1515  * @param cname     the name of the XMLObject specialization\r
1516  * @param proper1   the proper name of the first attribute, content, or singleton member\r
1517  * @param proper2   the proper name of the second attribute, content, or singleton member\r
1518  */\r
1519 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \\r
1520     if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \\r
1521         throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")\r
1522 \r
1523 /**\r
1524  * Validator code that checks for a non-empty collection.\r
1525  *\r
1526  * @param cname     the name of the XMLObject specialization\r
1527  * @param proper    the proper name of the collection item\r
1528  */\r
1529 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \\r
1530     if (ptr->get##proper##s().empty()) \\r
1531         throw xmltooling::ValidationException(#cname" must have at least one "#proper".")\r
1532 \r
1533 /**\r
1534  * Declares/defines a Validator specialization that checks object type and\r
1535  * a non-empty simple content model.\r
1536  *\r
1537  * @param linkage   linkage specifier for the class\r
1538  * @param cname     the name of the XMLObject specialization\r
1539  */\r
1540 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \\r
1541     BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \\r
1542         XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \\r
1543     END_XMLOBJECTVALIDATOR\r
1544 \r
1545 #include <utility>\r
1546 \r
1547 /**\r
1548  * @namespace xmltooling\r
1549  * Public namespace of XML Tooling library\r
1550  */\r
1551 namespace xmltooling {\r
1552 \r
1553     /**\r
1554      * Template function for cloning a sequence of XMLObjects.\r
1555      * Invokes the clone() member on each element of the input sequence and adds the copy to\r
1556      * the output sequence. Order is preserved.\r
1557      *\r
1558      * @param in    input sequence to clone\r
1559      * @param out   output sequence to copy cloned pointers into\r
1560      */\r
1561     template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {\r
1562         for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {\r
1563             if (*i)\r
1564                 out.push_back((*i)->clone());\r
1565             else\r
1566                 out.push_back(*i);\r
1567         }\r
1568     }\r
1569 \r
1570     /**\r
1571      * Functor for cleaning up heap objects in containers.\r
1572      */\r
1573     template<class T> struct cleanup\r
1574     {\r
1575         /**\r
1576          * Function operator to delete an object.\r
1577          *\r
1578          * @param ptr   object to delete\r
1579          */\r
1580         void operator()(T* ptr) {delete ptr;}\r
1581 \r
1582         /**\r
1583          * Function operator to delete an object stored as const.\r
1584          *\r
1585          * @param ptr   object to delete after casting away const\r
1586          */\r
1587         void operator()(const T* ptr) {delete const_cast<T*>(ptr);}\r
1588     };\r
1589 \r
1590     /**\r
1591      * Functor for cleaning up heap objects in key/value containers.\r
1592      */\r
1593     template<class A,class B> struct cleanup_pair\r
1594     {\r
1595         /**\r
1596          * Function operator to delete an object.\r
1597          *\r
1598          * @param p   a pair in which the second component is the object to delete\r
1599          */\r
1600         void operator()(const std::pair<const A,B*>& p) {delete p.second;}\r
1601     };\r
1602 \r
1603     /**\r
1604      * Functor for cleaning up const heap objects in key/value containers.\r
1605      */\r
1606     template<class A,class B> struct cleanup_const_pair\r
1607     {\r
1608         /**\r
1609          * Function operator to delete an object stored as const\r
1610          *\r
1611          * @param p   a pair in which the second component is the const object to delete\r
1612          */\r
1613         void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}\r
1614     };\r
1615 };\r
1616 \r
1617 #endif /* __xmltooling_base_h__ */\r