From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/xml/elements.hxx | 113 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 libxsd/xsd/cxx/xml/elements.hxx (limited to 'libxsd/xsd/cxx/xml/elements.hxx') diff --git a/libxsd/xsd/cxx/xml/elements.hxx b/libxsd/xsd/cxx/xml/elements.hxx new file mode 100644 index 0000000..c64afda --- /dev/null +++ b/libxsd/xsd/cxx/xml/elements.hxx @@ -0,0 +1,113 @@ +// file : xsd/cxx/xml/elements.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_XML_ELEMENTS_HXX +#define XSD_CXX_XML_ELEMENTS_HXX + +#include + +#include + +namespace xsd +{ + namespace cxx + { + namespace xml + { + template + class properties + { + public: + struct argument {}; + + + // Schema location properties. Note that all locations are + // relative to an instance document unless they are full + // URIs. For example if you want to use a local schema then + // you will need to use 'file:///absolute/path/to/your/schema'. + // + + // Add a location for a schema with a target namespace. + // + void + schema_location (const std::basic_string& namespace_, + const std::basic_string& location); + + // Add a location for a schema without a target namespace. + // + void + no_namespace_schema_location (const std::basic_string& location); + + public: + const std::basic_string& + schema_location () const + { + return schema_location_; + } + + const std::basic_string& + no_namespace_schema_location () const + { + return no_namespace_schema_location_; + } + + private: + std::basic_string schema_location_; + std::basic_string no_namespace_schema_location_; + }; + + + // + // + + template + std::basic_string + prefix (const std::basic_string& n); + + template + std::basic_string + uq_name (const std::basic_string& n); + + + // + // + + inline void + initialize () + { + xercesc::XMLPlatformUtils::Initialize (); + } + + inline void + terminate () + { + xercesc::XMLPlatformUtils::Terminate (); + } + + struct auto_initializer + { + auto_initializer (bool initialize = true, bool terminate = true) + : terminate_ (initialize && terminate) + { + if (initialize) + xml::initialize (); + } + + ~auto_initializer () + { + if (terminate_) + terminate (); + } + + private: + bool terminate_; + }; + } + } +} + +#include + +#endif // XSD_CXX_XML_ELEMENTS_HXX -- cgit v1.1