Branch data Line data Source code
1 : : // Copyright (c) 2005-2014 Code Synthesis Tools CC
2 : : //
3 : : // This program was generated by CodeSynthesis XSD, an XML Schema to
4 : : // C++ data binding compiler.
5 : : //
6 : : // This program is free software; you can redistribute it and/or modify
7 : : // it under the terms of the GNU General Public License version 2 as
8 : : // published by the Free Software Foundation.
9 : : //
10 : : // This program is distributed in the hope that it will be useful,
11 : : // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 : : // GNU General Public License for more details.
14 : : //
15 : : // You should have received a copy of the GNU General Public License
16 : : // along with this program; if not, write to the Free Software
17 : : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 : : //
19 : : // In addition, as a special exception, Code Synthesis Tools CC gives
20 : : // permission to link this program with the Xerces-C++ library (or with
21 : : // modified versions of Xerces-C++ that use the same license as Xerces-C++),
22 : : // and distribute linked combinations including the two. You must obey
23 : : // the GNU General Public License version 2 in all respects for all of
24 : : // the code used other than Xerces-C++. If you modify this copy of the
25 : : // program, you may extend this exception to your version of the program,
26 : : // but you are not obligated to do so. If you do not wish to do so, delete
27 : : // this exception statement from your version.
28 : : //
29 : : // Furthermore, Code Synthesis Tools CC makes a special exception for
30 : : // the Free/Libre and Open Source Software (FLOSS) which is described
31 : : // in the accompanying FLOSSE file.
32 : : //
33 : :
34 : : // Begin prologue.
35 : : //
36 : : //
37 : : // End prologue.
38 : :
39 : : #include <xsd/cxx/pre.hxx>
40 : :
41 : : #include "test.hxx"
42 : :
43 : : #include <xsd/cxx/xml/dom/parsing-source.hxx>
44 : :
45 : : #include <istream>
46 : : #include <xsd/cxx/xml/sax/std-input-source.hxx>
47 : : #include <xsd/cxx/tree/error-handler.hxx>
48 : :
49 : : ::std::unique_ptr< ::File >
50 : 2 : parseFile (const ::std::string& u,
51 : : ::xml_schema::Flags f,
52 : : const ::xml_schema::Properties& p)
53 : : {
54 : : ::xsd::cxx::xml::auto_initializer i (
55 : 2 : (f & ::xml_schema::Flags::dont_initialize) == 0,
56 : 4 : (f & ::xml_schema::Flags::keep_dom) == 0);
57 : :
58 : : ::xsd::cxx::tree::error_handler< char > h;
59 : :
60 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d (
61 : : ::xsd::cxx::xml::dom::parse< char > (
62 : 2 : u, h, p, f));
63 : :
64 [ + + ]: 2 : h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();
65 : :
66 : : return ::std::unique_ptr< ::File > (
67 : : ::parseFile (
68 [ + - ]: 2 : std::move (d), f | ::xml_schema::Flags::own_dom, p));
69 : : }
70 : :
71 : : ::std::unique_ptr< ::File >
72 : 0 : parseFile (const ::std::string& u,
73 : : ::xml_schema::ErrorHandler& h,
74 : : ::xml_schema::Flags f,
75 : : const ::xml_schema::Properties& p)
76 : : {
77 : : ::xsd::cxx::xml::auto_initializer i (
78 : 0 : (f & ::xml_schema::Flags::dont_initialize) == 0,
79 : 0 : (f & ::xml_schema::Flags::keep_dom) == 0);
80 : :
81 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d (
82 : : ::xsd::cxx::xml::dom::parse< char > (
83 : 0 : u, h, p, f));
84 : :
85 [ # # ]: 0 : if (!d.get ())
86 : 0 : throw ::xsd::cxx::tree::parsing< char > ();
87 : :
88 : : return ::std::unique_ptr< ::File > (
89 : : ::parseFile (
90 [ # # ]: 0 : std::move (d), f | ::xml_schema::Flags::own_dom, p));
91 : : }
92 : :
93 : : ::std::unique_ptr< ::File >
94 : 0 : parseFile (const ::std::string& u,
95 : : ::xercesc::DOMErrorHandler& h,
96 : : ::xml_schema::Flags f,
97 : : const ::xml_schema::Properties& p)
98 : : {
99 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d (
100 : : ::xsd::cxx::xml::dom::parse< char > (
101 : 0 : u, h, p, f));
102 : :
103 [ # # ]: 0 : if (!d.get ())
104 : 0 : throw ::xsd::cxx::tree::parsing< char > ();
105 : :
106 : : return ::std::unique_ptr< ::File > (
107 : : ::parseFile (
108 [ # # ]: 0 : std::move (d), f | ::xml_schema::Flags::own_dom, p));
109 : : }
110 : :
111 : : ::std::unique_ptr< ::File >
112 : 0 : parseFile (::std::istream& is,
113 : : ::xml_schema::Flags f,
114 : : const ::xml_schema::Properties& p)
115 : : {
116 : : ::xsd::cxx::xml::auto_initializer i (
117 : 0 : (f & ::xml_schema::Flags::dont_initialize) == 0,
118 : 0 : (f & ::xml_schema::Flags::keep_dom) == 0);
119 : :
120 : : ::xsd::cxx::xml::sax::std_input_source isrc (is);
121 [ # # ]: 0 : return ::parseFile (isrc, f, p);
122 : : }
123 : :
124 : : ::std::unique_ptr< ::File >
125 : 0 : parseFile (::std::istream& is,
126 : : ::xml_schema::ErrorHandler& h,
127 : : ::xml_schema::Flags f,
128 : : const ::xml_schema::Properties& p)
129 : : {
130 : : ::xsd::cxx::xml::auto_initializer i (
131 : 0 : (f & ::xml_schema::Flags::dont_initialize) == 0,
132 : 0 : (f & ::xml_schema::Flags::keep_dom) == 0);
133 : :
134 : : ::xsd::cxx::xml::sax::std_input_source isrc (is);
135 [ # # ]: 0 : return ::parseFile (isrc, h, f, p);
136 : : }
137 : :
138 : : ::std::unique_ptr< ::File >
139 : 0 : parseFile (::std::istream& is,
140 : : ::xercesc::DOMErrorHandler& h,
141 : : ::xml_schema::Flags f,
142 : : const ::xml_schema::Properties& p)
143 : : {
144 : : ::xsd::cxx::xml::sax::std_input_source isrc (is);
145 [ # # ]: 0 : return ::parseFile (isrc, h, f, p);
146 : : }
147 : :
148 : : ::std::unique_ptr< ::File >
149 : 0 : parseFile (::std::istream& is,
150 : : const ::std::string& sid,
151 : : ::xml_schema::Flags f,
152 : : const ::xml_schema::Properties& p)
153 : : {
154 : : ::xsd::cxx::xml::auto_initializer i (
155 : 0 : (f & ::xml_schema::Flags::dont_initialize) == 0,
156 : 0 : (f & ::xml_schema::Flags::keep_dom) == 0);
157 : :
158 [ # # ]: 0 : ::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
159 [ # # ]: 0 : return ::parseFile (isrc, f, p);
160 : : }
161 : :
162 : : ::std::unique_ptr< ::File >
163 : 0 : parseFile (::std::istream& is,
164 : : const ::std::string& sid,
165 : : ::xml_schema::ErrorHandler& h,
166 : : ::xml_schema::Flags f,
167 : : const ::xml_schema::Properties& p)
168 : : {
169 : : ::xsd::cxx::xml::auto_initializer i (
170 : 0 : (f & ::xml_schema::Flags::dont_initialize) == 0,
171 : 0 : (f & ::xml_schema::Flags::keep_dom) == 0);
172 : :
173 [ # # ]: 0 : ::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
174 [ # # ]: 0 : return ::parseFile (isrc, h, f, p);
175 : : }
176 : :
177 : : ::std::unique_ptr< ::File >
178 : 0 : parseFile (::std::istream& is,
179 : : const ::std::string& sid,
180 : : ::xercesc::DOMErrorHandler& h,
181 : : ::xml_schema::Flags f,
182 : : const ::xml_schema::Properties& p)
183 : : {
184 : 0 : ::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
185 [ # # ]: 0 : return ::parseFile (isrc, h, f, p);
186 : : }
187 : :
188 : : ::std::unique_ptr< ::File >
189 : 0 : parseFile (::xercesc::InputSource& i,
190 : : ::xml_schema::Flags f,
191 : : const ::xml_schema::Properties& p)
192 : : {
193 : : ::xsd::cxx::tree::error_handler< char > h;
194 : :
195 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d (
196 : : ::xsd::cxx::xml::dom::parse< char > (
197 : 0 : i, h, p, f));
198 : :
199 [ # # ]: 0 : h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();
200 : :
201 : : return ::std::unique_ptr< ::File > (
202 : : ::parseFile (
203 [ # # ]: 0 : std::move (d), f | ::xml_schema::Flags::own_dom, p));
204 : : }
205 : :
206 : : ::std::unique_ptr< ::File >
207 : 0 : parseFile (::xercesc::InputSource& i,
208 : : ::xml_schema::ErrorHandler& h,
209 : : ::xml_schema::Flags f,
210 : : const ::xml_schema::Properties& p)
211 : : {
212 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d (
213 : : ::xsd::cxx::xml::dom::parse< char > (
214 : 0 : i, h, p, f));
215 : :
216 [ # # ]: 0 : if (!d.get ())
217 : 0 : throw ::xsd::cxx::tree::parsing< char > ();
218 : :
219 : : return ::std::unique_ptr< ::File > (
220 : : ::parseFile (
221 [ # # ]: 0 : std::move (d), f | ::xml_schema::Flags::own_dom, p));
222 : : }
223 : :
224 : : ::std::unique_ptr< ::File >
225 : 0 : parseFile (::xercesc::InputSource& i,
226 : : ::xercesc::DOMErrorHandler& h,
227 : : ::xml_schema::Flags f,
228 : : const ::xml_schema::Properties& p)
229 : : {
230 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d (
231 : : ::xsd::cxx::xml::dom::parse< char > (
232 : 0 : i, h, p, f));
233 : :
234 [ # # ]: 0 : if (!d.get ())
235 : 0 : throw ::xsd::cxx::tree::parsing< char > ();
236 : :
237 : : return ::std::unique_ptr< ::File > (
238 : : ::parseFile (
239 [ # # ]: 0 : std::move (d), f | ::xml_schema::Flags::own_dom, p));
240 : : }
241 : :
242 : : ::std::unique_ptr< ::File >
243 : 0 : parseFile (const ::xercesc::DOMDocument& doc,
244 : : ::xml_schema::Flags f,
245 : : const ::xml_schema::Properties& p)
246 : : {
247 [ # # ]: 0 : if (f & ::xml_schema::Flags::keep_dom)
248 : : {
249 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d (
250 [ # # ]: 0 : static_cast< ::xercesc::DOMDocument* > (doc.cloneNode (true)));
251 : :
252 : : return ::std::unique_ptr< ::File > (
253 : : ::parseFile (
254 [ # # ]: 0 : std::move (d), f | ::xml_schema::Flags::own_dom, p));
255 : : }
256 : :
257 : 0 : const ::xercesc::DOMElement& e (*doc.getDocumentElement ());
258 : : const ::xsd::cxx::xml::qualified_name< char > n (
259 : 0 : ::xsd::cxx::xml::dom::name< char > (e));
260 : :
261 [ # # ][ # # ]: 0 : if (n.name () == "file" &&
[ # # ]
262 : : n.namespace_ () == "")
263 : : {
264 : : ::std::unique_ptr< ::File > r (
265 : : ::xsd::cxx::tree::traits< ::File, char >::create (
266 [ # # ]: 0 : e, f, 0));
267 : : return r;
268 : : }
269 : :
270 : : throw ::xsd::cxx::tree::unexpected_element < char > (
271 : : n.name (),
272 : : n.namespace_ (),
273 : : "file",
274 [ # # ][ # # ]: 0 : "");
[ # # ]
275 : : }
276 : :
277 : : ::std::unique_ptr< ::File >
278 : 1 : parseFile (::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d,
279 : : ::xml_schema::Flags f,
280 : : const ::xml_schema::Properties&)
281 : : {
282 : : ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > c (
283 [ # # ]: 0 : ((f & ::xml_schema::Flags::keep_dom) &&
284 : 0 : !(f & ::xml_schema::Flags::own_dom))
285 [ # # ]: 0 : ? static_cast< ::xercesc::DOMDocument* > (d->cloneNode (true))
286 [ - + ]: 1 : : 0);
287 : :
288 [ + - ]: 1 : ::xercesc::DOMDocument& doc (c.get () ? *c : *d);
289 [ + - ]: 1 : const ::xercesc::DOMElement& e (*doc.getDocumentElement ());
290 : :
291 : : const ::xsd::cxx::xml::qualified_name< char > n (
292 [ + - ]: 2 : ::xsd::cxx::xml::dom::name< char > (e));
293 : :
294 [ - + ]: 1 : if (f & ::xml_schema::Flags::keep_dom)
295 [ # # ]: 0 : doc.setUserData (::xml_schema::dom::treeNodeKey,
296 : : (c.get () ? &c : &d),
297 [ # # ]: 0 : 0);
298 : :
299 [ + - ][ - + ]: 2 : if (n.name () == "file" &&
[ + - ]
300 : : n.namespace_ () == "")
301 : : {
302 : : ::std::unique_ptr< ::File > r (
303 : : ::xsd::cxx::tree::traits< ::File, char >::create (
304 [ + - ]: 1 : e, f, 0));
305 : 1 : return r;
306 : : }
307 : :
308 : : throw ::xsd::cxx::tree::unexpected_element < char > (
309 : : n.name (),
310 : : n.namespace_ (),
311 : : "file",
312 [ # # ][ # # ]: 0 : "");
[ # # ]
313 : : }
314 : :
315 : : #include <xsd/cxx/post.hxx>
316 : :
317 : : // Begin epilogue.
318 : : //
319 : : //
320 : : // End epilogue.
321 : :
|