C++/Tree Mapping Hello World Example
hello.hxx
Go to the documentation of this file.
1// Copyright (c) 2005-2023 Code Synthesis.
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 gives permission
20// to link this program with the Xerces-C++ library (or with modified
21// versions of Xerces-C++ that use the same license as Xerces-C++), and
22// distribute linked combinations including the two. You must obey the GNU
23// General Public License version 2 in all respects for all of the code
24// used other than Xerces-C++. If you modify this copy of the program, you
25// may extend this exception to your version of the program, but you are
26// not obligated to do so. If you do not wish to do so, delete this
27// exception statement from your version.
28//
29// Furthermore, Code Synthesis makes a special exception for the Free/Libre
30// and Open Source Software (FLOSS) which is described in the accompanying
31// FLOSSE file.
32//
33
39#ifndef HELLO_HXX
40#define HELLO_HXX
41
42#ifndef XSD_CXX11
43#define XSD_CXX11
44#endif
45
46#ifndef XSD_USE_CHAR
47#define XSD_USE_CHAR
48#endif
49
50#ifndef XSD_CXX_TREE_USE_CHAR
51#define XSD_CXX_TREE_USE_CHAR
52#endif
53
54// Begin prologue.
55//
56//
57// End prologue.
58
59#include <xsd/cxx/config.hxx>
60
61#if (LIBXSD_VERSION != 400002000000000L)
62#error XSD runtime version mismatch
63#endif
64
65#include <xsd/cxx/pre.hxx>
66
67#include <xsd/cxx/xml/char-utf8.hxx>
68
72
73#include <xsd/cxx/xml/error-handler.hxx>
74
75#include <xsd/cxx/xml/dom/auto-ptr.hxx>
76
77#include <xsd/cxx/tree/parsing.hxx>
78#include <xsd/cxx/tree/parsing/byte.hxx>
79#include <xsd/cxx/tree/parsing/unsigned-byte.hxx>
80#include <xsd/cxx/tree/parsing/short.hxx>
81#include <xsd/cxx/tree/parsing/unsigned-short.hxx>
82#include <xsd/cxx/tree/parsing/int.hxx>
83#include <xsd/cxx/tree/parsing/unsigned-int.hxx>
84#include <xsd/cxx/tree/parsing/long.hxx>
85#include <xsd/cxx/tree/parsing/unsigned-long.hxx>
86#include <xsd/cxx/tree/parsing/boolean.hxx>
87#include <xsd/cxx/tree/parsing/float.hxx>
88#include <xsd/cxx/tree/parsing/double.hxx>
89#include <xsd/cxx/tree/parsing/decimal.hxx>
90
95namespace xml_schema
96{
97 // anyType and anySimpleType.
98 //
99
105
111
116
117
118 // 8-bit
119 //
120
125 typedef signed char byte;
126
131 typedef unsigned char unsigned_byte;
132
133
134 // 16-bit
135 //
136
141 typedef short short_;
142
147 typedef unsigned short unsigned_short;
148
149
150 // 32-bit
151 //
152
157 typedef int int_;
158
163 typedef unsigned int unsigned_int;
164
165
166 // 64-bit
167 //
168
173 typedef long long long_;
174
179 typedef unsigned long long unsigned_long;
180
181
182 // Supposed to be arbitrary-length integral types.
183 //
184
189 typedef long long integer;
190
195 typedef long long non_positive_integer;
196
201 typedef unsigned long long non_negative_integer;
202
207 typedef unsigned long long positive_integer;
208
213 typedef long long negative_integer;
214
215
216 // Boolean.
217 //
218
223 typedef bool boolean;
224
225
226 // Floating-point types.
227 //
228
233 typedef float float_;
234
239 typedef double double_;
240
245 typedef double decimal;
246
247
248 // String types.
249 //
250
256
262
268
274
280
286
292
298
299
300 // ID/IDREF.
301 //
302
308
314
320
321
322 // URI.
323 //
324
330
331
332 // Qualified name.
333 //
334
340
341
342 // Binary.
343 //
344
349
355
361
362
363 // Date/time.
364 //
365
370
376
382
388
394
400
406
412
418
424
425
426 // Entity.
427 //
428
434
440
441
442
447 // Flags and properties.
448 //
449
454
459
460 // Parsing/serialization diagnostics.
461 //
462
467
472
477
478 // Exceptions.
479 //
480
485
491
497
502
508
514
520
526
532
538
543
547 namespace dom
548 {
553
554#ifndef XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA
555#define XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA
559 const XMLCh* const tree_node_key = ::xsd::cxx::tree::user_data_keys::node;
560#endif
561 }
562}
563
564// Forward declarations.
565//
566class hello_t;
567
568#include <memory> // ::std::unique_ptr
569#include <limits> // std::numeric_limits
570#include <algorithm> // std::binary_search
571#include <utility> // std::move
572
573#include <xsd/cxx/xml/char-utf8.hxx>
574
577#include <xsd/cxx/tree/containers.hxx>
578#include <xsd/cxx/tree/list.hxx>
579
580#include <xsd/cxx/xml/dom/parsing-header.hxx>
581
591{
592 public:
603
608
612 typedef ::xsd::cxx::tree::traits< greeting_type, char > greeting_traits;
613
619 const greeting_type&
620 greeting () const;
621
629
638 void
640
649 void
650 greeting (::std::unique_ptr< greeting_type > p);
651
653
663
668
672 typedef ::xsd::cxx::tree::sequence< name_type > name_sequence;
673
678
683
687 typedef ::xsd::cxx::tree::traits< name_type, char > name_traits;
688
695 const name_sequence&
696 name () const;
697
705
715 void
716 name (const name_sequence& s);
717
719
724
730
739 hello_t (const ::xercesc::DOMElement& e,
742
752 hello_t (const hello_t& x,
755
767 virtual hello_t*
769 ::xml_schema::container* c = 0) const;
770
779 hello_t&
781
783
787 virtual
789
790 // Implementation.
791 //
792
793 //@cond
794
795 protected:
796 void
797 parse (::xsd::cxx::xml::dom::parser< char >&,
799
800 protected:
802 name_sequence name_;
803
804 //@endcond
805};
806
807#include <iosfwd>
808
809#include <xercesc/sax/InputSource.hpp>
810#include <xercesc/dom/DOMDocument.hpp>
811#include <xercesc/dom/DOMErrorHandler.hpp>
812
820
831::std::unique_ptr< ::hello_t >
832hello (const ::std::string& uri,
834 const ::xml_schema::properties& p = ::xml_schema::properties ());
835
847::std::unique_ptr< ::hello_t >
848hello (const ::std::string& uri,
851 const ::xml_schema::properties& p = ::xml_schema::properties ());
852
865::std::unique_ptr< ::hello_t >
866hello (const ::std::string& uri,
867 ::xercesc::DOMErrorHandler& eh,
869 const ::xml_schema::properties& p = ::xml_schema::properties ());
870
881::std::unique_ptr< ::hello_t >
882hello (::std::istream& is,
884 const ::xml_schema::properties& p = ::xml_schema::properties ());
885
897::std::unique_ptr< ::hello_t >
898hello (::std::istream& is,
901 const ::xml_schema::properties& p = ::xml_schema::properties ());
902
915::std::unique_ptr< ::hello_t >
916hello (::std::istream& is,
917 ::xercesc::DOMErrorHandler& eh,
919 const ::xml_schema::properties& p = ::xml_schema::properties ());
920
935::std::unique_ptr< ::hello_t >
936hello (::std::istream& is,
937 const ::std::string& id,
939 const ::xml_schema::properties& p = ::xml_schema::properties ());
940
957::std::unique_ptr< ::hello_t >
958hello (::std::istream& is,
959 const ::std::string& id,
962 const ::xml_schema::properties& p = ::xml_schema::properties ());
963
980::std::unique_ptr< ::hello_t >
981hello (::std::istream& is,
982 const ::std::string& id,
983 ::xercesc::DOMErrorHandler& eh,
985 const ::xml_schema::properties& p = ::xml_schema::properties ());
986
997::std::unique_ptr< ::hello_t >
998hello (::xercesc::InputSource& is,
1000 const ::xml_schema::properties& p = ::xml_schema::properties ());
1001
1013::std::unique_ptr< ::hello_t >
1014hello (::xercesc::InputSource& is,
1016 ::xml_schema::flags f = 0,
1017 const ::xml_schema::properties& p = ::xml_schema::properties ());
1018
1031::std::unique_ptr< ::hello_t >
1032hello (::xercesc::InputSource& is,
1033 ::xercesc::DOMErrorHandler& eh,
1034 ::xml_schema::flags f = 0,
1035 const ::xml_schema::properties& p = ::xml_schema::properties ());
1036
1045::std::unique_ptr< ::hello_t >
1046hello (const ::xercesc::DOMDocument& d,
1047 ::xml_schema::flags f = 0,
1048 const ::xml_schema::properties& p = ::xml_schema::properties ());
1049
1062::std::unique_ptr< ::hello_t >
1063hello (::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > d,
1064 ::xml_schema::flags f = 0,
1065 const ::xml_schema::properties& p = ::xml_schema::properties ());
1066
1068
1069#include <xsd/cxx/post.hxx>
1070
1071// Begin epilogue.
1072//
1073//
1074// End epilogue.
1075
1076#endif // HELLO_HXX
Class corresponding to the hello_t schema type.
Definition hello.hxx:591
::xsd::cxx::tree::traits< greeting_type, char > greeting_traits
Element traits type.
Definition hello.hxx:612
name_sequence::const_iterator name_const_iterator
Element constant iterator type.
Definition hello.hxx:682
::xml_schema::string greeting_type
Element type.
Definition hello.hxx:607
hello_t & operator=(const hello_t &x)
Copy assignment operator.
virtual hello_t * _clone(::xml_schema::flags f=0, ::xml_schema::container *c=0) const
Copy the instance polymorphically.
hello_t(const greeting_type &)
Create an instance from the ultimate base and initializers for required elements and attributes.
name_sequence::iterator name_iterator
Element iterator type.
Definition hello.hxx:677
const name_sequence & name() const
Return a read-only (constant) reference to the element sequence.
::xsd::cxx::tree::sequence< name_type > name_sequence
Element sequence container type.
Definition hello.hxx:672
void greeting(::std::unique_ptr< greeting_type > p)
Set the element value without copying.
hello_t(const ::xercesc::DOMElement &e, ::xml_schema::flags f=0, ::xml_schema::container *c=0)
Create an instance from a DOM element.
const greeting_type & greeting() const
Return a read-only (constant) reference to the element.
::xml_schema::string name_type
Element type.
Definition hello.hxx:667
::xsd::cxx::tree::traits< name_type, char > name_traits
Element traits type.
Definition hello.hxx:687
void greeting(const greeting_type &x)
Set the element value.
virtual ~hello_t()
Destructor.
greeting_type & greeting()
Return a read-write reference to the element.
hello_t(const hello_t &x, ::xml_schema::flags f=0, ::xml_schema::container *c=0)
Copy constructor.
void name(const name_sequence &s)
Copy elements from a given sequence.
name_sequence & name()
Return a read-write reference to the element sequence.
::std::unique_ptr< ::hello_t > hello(const ::std::string &uri, ::xml_schema::flags f=0, const ::xml_schema::properties &p=::xml_schema::properties())
Parse a URI or a local file.
const XMLCh *const tree_node_key
DOM user data key for back pointers to tree nodes.
Definition hello.hxx:559
C++ namespace for the http://www.w3.org/2001/XMLSchema schema namespace.
Definition hello.hxx:96
::xsd::cxx::tree::bounds< char > bounds
Exception indicating that the size argument exceeds the capacity argument.
Definition hello.hxx:490
::xsd::cxx::tree::no_prefix_mapping< char > no_prefix_mapping
Exception indicating that a prefix-namespace mapping was not provided.
Definition hello.hxx:537
::xsd::cxx::tree::error< char > error
Error condition.
Definition hello.hxx:471
::xsd::cxx::tree::parsing< char > parsing
Exception indicating a parsing failure.
Definition hello.hxx:501
::xsd::cxx::tree::expected_text_content< char > expected_text_content
Exception indicating that the text content was expected for an element.
Definition hello.hxx:531
::xsd::cxx::tree::gmonth< char, simple_type > gmonth
C++ type corresponding to the gMonth XML Schema built-in type.
Definition hello.hxx:399
long long long_
C++ type corresponding to the long XML Schema built-in type.
Definition hello.hxx:173
::xsd::cxx::tree::duplicate_id< char > duplicate_id
Exception indicating that a duplicate ID value was encountered in the object model.
Definition hello.hxx:496
::xsd::cxx::tree::uri< char, simple_type > uri
C++ type corresponding to the anyURI XML Schema built-in type.
Definition hello.hxx:329
signed char byte
C++ type corresponding to the byte XML Schema built-in type.
Definition hello.hxx:125
::xsd::cxx::tree::type container
Alias for the anyType type.
Definition hello.hxx:115
::xsd::cxx::tree::id< char, ncname > id
C++ type corresponding to the ID XML Schema built-in type.
Definition hello.hxx:307
::xsd::cxx::tree::type type
C++ type corresponding to the anyType XML Schema built-in type.
Definition hello.hxx:104
long long non_positive_integer
C++ type corresponding to the nonPositiveInteger XML Schema built-in type.
Definition hello.hxx:195
::xsd::cxx::tree::normalized_string< char, string > normalized_string
C++ type corresponding to the normalizedString XML Schema built-in type.
Definition hello.hxx:261
unsigned long long unsigned_long
C++ type corresponding to the unsignedLong XML Schema built-in type.
Definition hello.hxx:179
::xsd::cxx::tree::expected_element< char > expected_element
Exception indicating that an expected element was not encountered.
Definition hello.hxx:507
::xsd::cxx::tree::gday< char, simple_type > gday
C++ type corresponding to the gDay XML Schema built-in type.
Definition hello.hxx:393
::xsd::cxx::tree::base64_binary< char, simple_type > base64_binary
C++ type corresponding to the base64Binary XML Schema built-in type.
Definition hello.hxx:354
::xsd::cxx::tree::nmtoken< char, token > nmtoken
C++ type corresponding to the NMTOKEN XML Schema built-in type.
Definition hello.hxx:279
::xsd::cxx::tree::date_time< char, simple_type > date_time
C++ type corresponding to the dateTime XML Schema built-in type.
Definition hello.hxx:381
::xsd::cxx::tree::unexpected_element< char > unexpected_element
Exception indicating that an unexpected element was encountered.
Definition hello.hxx:513
::xsd::cxx::tree::diagnostics< char > diagnostics
List of error conditions.
Definition hello.hxx:476
::xsd::cxx::tree::simple_type< char, type > simple_type
C++ type corresponding to the anySimpleType XML Schema built-in type.
Definition hello.hxx:110
double decimal
C++ type corresponding to the decimal XML Schema built-in type.
Definition hello.hxx:245
short short_
C++ type corresponding to the short XML Schema built-in type.
Definition hello.hxx:141
::xsd::cxx::tree::time< char, simple_type > time
C++ type corresponding to the time XML Schema built-in type.
Definition hello.hxx:423
::xsd::cxx::tree::exception< char > exception
Root of the C++/Tree exception hierarchy.
Definition hello.hxx:484
unsigned short unsigned_short
C++ type corresponding to the unsignedShort XML Schema built-in type.
Definition hello.hxx:147
::xsd::cxx::tree::hex_binary< char, simple_type > hex_binary
C++ type corresponding to the hexBinary XML Schema built-in type.
Definition hello.hxx:360
unsigned int unsigned_int
C++ type corresponding to the unsignedInt XML Schema built-in type.
Definition hello.hxx:163
::xsd::cxx::tree::entity< char, ncname > entity
C++ type corresponding to the ENTITY XML Schema built-in type.
Definition hello.hxx:433
unsigned char unsigned_byte
C++ type corresponding to the unsignedByte XML Schema built-in type.
Definition hello.hxx:131
::xsd::cxx::tree::flags flags
Parsing and serialization flags.
Definition hello.hxx:453
::xsd::cxx::tree::time_zone time_zone
Time zone type.
Definition hello.hxx:369
::xsd::cxx::tree::ncname< char, name > ncname
C++ type corresponding to the NCName XML Schema built-in type.
Definition hello.hxx:291
::xsd::cxx::tree::unexpected_enumerator< char > unexpected_enumerator
Exception indicating that an unexpected enumerator was encountered.
Definition hello.hxx:525
::xsd::cxx::tree::gmonth_day< char, simple_type > gmonth_day
C++ type corresponding to the gMonthDay XML Schema built-in type.
Definition hello.hxx:405
::xsd::cxx::tree::severity severity
Error severity.
Definition hello.hxx:466
long long integer
C++ type corresponding to the integer XML Schema built-in type.
Definition hello.hxx:189
double double_
C++ type corresponding to the double XML Schema built-in type.
Definition hello.hxx:239
::xsd::cxx::tree::gyear< char, simple_type > gyear
C++ type corresponding to the gYear XML Schema built-in type.
Definition hello.hxx:411
::xsd::cxx::tree::properties< char > properties
Parsing properties.
Definition hello.hxx:458
::xsd::cxx::tree::token< char, normalized_string > token
C++ type corresponding to the token XML Schema built-in type.
Definition hello.hxx:267
::xsd::cxx::xml::error_handler< char > error_handler
Error handler callback interface.
Definition hello.hxx:542
unsigned long long positive_integer
C++ type corresponding to the positiveInteger XML Schema built-in type.
Definition hello.hxx:207
::xsd::cxx::tree::name< char, token > name
C++ type corresponding to the Name XML Schema built-in type.
Definition hello.hxx:273
::xsd::cxx::tree::content_order content_order
Content order sequence entry.
Definition hello.hxx:446
::xsd::cxx::tree::duration< char, simple_type > duration
C++ type corresponding to the duration XML Schema built-in type.
Definition hello.hxx:387
::xsd::cxx::tree::gyear_month< char, simple_type > gyear_month
C++ type corresponding to the gYearMonth XML Schema built-in type.
Definition hello.hxx:417
long long negative_integer
C++ type corresponding to the negativeInteger XML Schema built-in type.
Definition hello.hxx:213
int int_
C++ type corresponding to the int XML Schema built-in type.
Definition hello.hxx:157
::xsd::cxx::tree::idref< char, ncname, type > idref
C++ type corresponding to the IDREF XML Schema built-in type.
Definition hello.hxx:313
::xsd::cxx::tree::date< char, simple_type > date
C++ type corresponding to the date XML Schema built-in type.
Definition hello.hxx:375
float float_
C++ type corresponding to the float XML Schema built-in type.
Definition hello.hxx:233
::xsd::cxx::tree::expected_attribute< char > expected_attribute
Exception indicating that an expected attribute was not encountered.
Definition hello.hxx:519
::xsd::cxx::tree::entities< char, simple_type, entity > entities
C++ type corresponding to the ENTITIES XML Schema built-in type.
Definition hello.hxx:439
::xsd::cxx::tree::idrefs< char, simple_type, idref > idrefs
C++ type corresponding to the IDREFS XML Schema built-in type.
Definition hello.hxx:319
::xsd::cxx::tree::language< char, token > language
C++ type corresponding to the language XML Schema built-in type.
Definition hello.hxx:297
bool boolean
C++ type corresponding to the boolean XML Schema built-in type.
Definition hello.hxx:223
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition hello.hxx:255
unsigned long long non_negative_integer
C++ type corresponding to the nonNegativeInteger XML Schema built-in type.
Definition hello.hxx:201
::xsd::cxx::tree::qname< char, simple_type, uri, ncname > qname
C++ type corresponding to the QName XML Schema built-in type.
Definition hello.hxx:339
::xsd::cxx::tree::nmtokens< char, simple_type, nmtoken > nmtokens
C++ type corresponding to the NMTOKENS XML Schema built-in type.
Definition hello.hxx:285
::xsd::cxx::tree::buffer< char > buffer
Binary buffer type.
Definition hello.hxx:348

Copyright © 2005-2023 Code Synthesis.