Line data Source code
1 : // file : xsd/cxx/xml/elements.hxx
2 : // copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
3 : // license : GNU GPL v2 + exceptions; see accompanying LICENSE file
4 :
5 : #ifndef XSD_CXX_XML_ELEMENTS_HXX
6 : #define XSD_CXX_XML_ELEMENTS_HXX
7 :
8 : #include <string>
9 :
10 : #include <xercesc/util/XercesVersion.hpp>
11 : #include <xercesc/util/PlatformUtils.hpp>
12 :
13 : #if _XERCES_VERSION < 30000
14 : # error Xerces-C++ 2-series is not supported
15 : #endif
16 :
17 : namespace xsd
18 : {
19 : namespace cxx
20 : {
21 : namespace xml
22 : {
23 : template <typename C>
24 : class properties
25 : {
26 : public:
27 : struct argument {};
28 :
29 :
30 : // Schema location properties. Note that all locations are
31 : // relative to an instance document unless they are full
32 : // URIs. For example if you want to use a local schema then
33 : // you will need to use 'file:///absolute/path/to/your/schema'.
34 : //
35 :
36 : // Add a location for a schema with a target namespace.
37 : //
38 : void
39 : schema_location (const std::basic_string<C>& namespace_,
40 : const std::basic_string<C>& location);
41 :
42 : // Add a location for a schema without a target namespace.
43 : //
44 : void
45 : no_namespace_schema_location (const std::basic_string<C>& location);
46 :
47 : public:
48 : const std::basic_string<C>&
49 0 : schema_location () const
50 : {
51 0 : return schema_location_;
52 : }
53 :
54 : const std::basic_string<C>&
55 0 : no_namespace_schema_location () const
56 : {
57 0 : return no_namespace_schema_location_;
58 : }
59 :
60 : private:
61 : std::basic_string<C> schema_location_;
62 : std::basic_string<C> no_namespace_schema_location_;
63 : };
64 :
65 :
66 : //
67 : //
68 :
69 : template <typename C>
70 : std::basic_string<C>
71 : prefix (const std::basic_string<C>& n);
72 :
73 : template <typename C>
74 : std::basic_string<C>
75 : uq_name (const std::basic_string<C>& n);
76 :
77 :
78 : //
79 : //
80 :
81 : inline void
82 0 : initialize ()
83 : {
84 0 : xercesc::XMLPlatformUtils::Initialize ();
85 0 : }
86 :
87 : inline void
88 0 : terminate ()
89 : {
90 0 : xercesc::XMLPlatformUtils::Terminate ();
91 0 : }
92 :
93 : struct auto_initializer
94 : {
95 0 : auto_initializer (bool initialize = true, bool terminate = true)
96 0 : : terminate_ (initialize && terminate)
97 : {
98 0 : if (initialize)
99 0 : xml::initialize ();
100 0 : }
101 :
102 0 : ~auto_initializer ()
103 : {
104 0 : if (terminate_)
105 0 : terminate ();
106 0 : }
107 :
108 : private:
109 : bool terminate_;
110 : };
111 : }
112 : }
113 : }
114 :
115 : #include <xsd/cxx/xml/elements.txx>
116 :
117 : #endif // XSD_CXX_XML_ELEMENTS_HXX
|