diff options
Diffstat (limited to 'xsd/libxsd/xsd/cxx/parser/non-validating')
8 files changed, 5665 insertions, 0 deletions
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx new file mode 100644 index 0000000..9eda6f4 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx @@ -0,0 +1,248 @@ +// file : xsd/cxx/parser/non-validating/parser.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_PARSER_NON_VALIDATING_PARSER_HXX +#define XSD_CXX_PARSER_NON_VALIDATING_PARSER_HXX + +#include <stack> +#include <string> +#include <cstddef> // std::size_t + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/parser/elements.hxx> + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + // + // + template <typename C> + struct empty_content: parser_base<C> + { + // The _*_any_* functions are called when wildcard content + // is encountered. Use them to handle mixed content models, + // any/anyAttribute, and anyType/anySimpleType. By default + // these functions do nothing. + // + + // The type argument is a type name and namespace from the + // xsi:type attribute in the form "<name> <namespace>" with + // the space and namespace part absent if the type does not + // have a namespace or 0 if xsi:type is not present. + // + virtual void + _start_any_element (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>* type); + + virtual void + _end_any_element (const ro_string<C>& ns, + const ro_string<C>& name); + + virtual void + _any_attribute (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value); + + virtual void + _any_characters (const ro_string<C>&); + + + // + // + virtual bool + _start_element_impl (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>*); + + virtual bool + _end_element_impl (const ro_string<C>&, + const ro_string<C>&); + + virtual bool + _attribute_impl (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>&); + + virtual bool + _characters_impl (const ro_string<C>&); + + + // + // + virtual void + _start_element (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>* type); + + virtual void + _end_element (const ro_string<C>& ns, + const ro_string<C>& name); + + virtual void + _attribute (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value); + + virtual void + _characters (const ro_string<C>& s); + }; + + + // + // + template <typename C> + struct simple_content: empty_content<C> + { + // + // + virtual void + _attribute (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value); + + virtual void + _characters (const ro_string<C>&); + }; + + + // + // + template <typename C> + struct complex_content: empty_content<C> + { + // + // + virtual void + _start_element (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>* type); + + virtual void + _end_element (const ro_string<C>& ns, + const ro_string<C>& name); + + virtual void + _attribute (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value); + + virtual void + _characters (const ro_string<C>&); + + + // + // + virtual void + _pre_impl (); + + virtual void + _post_impl (); + + protected: + struct state + { + state () + : any_ (false), depth_ (0), parser_ (0) + { + } + + bool any_; + std::size_t depth_; + parser_base<C>* parser_; + }; + + // Optimized state stack for non-recursive case (one element). + // + struct state_stack + { + state_stack () + : size_ (0) + { + } + + void + push (const state& s) + { + if (size_ > 0) + rest_.push (top_); + + top_ = s; + ++size_; + } + + void + pop () + { + if (size_ > 1) + { + top_ = rest_.top (); + rest_.pop (); + } + + --size_; + } + + const state& + top () const + { + return top_; + } + + state& + top () + { + return top_; + } + + state& + under_top () + { + return rest_.top (); + } + + private: + state top_; + std::stack<state> rest_; + std::size_t size_; + }; + + state_stack context_; + }; + + + // Base for xsd:list. + // + template <typename C> + struct list_base: simple_content<C> + { + virtual void + _xsd_parse_item (const ro_string<C>&) = 0; + + virtual void + _pre_impl (); + + virtual void + _characters (const ro_string<C>&); + + virtual void + _post_impl (); + + protected: + std::basic_string<C> buf_; + }; + } + } + } +} + +#include <xsd/cxx/parser/non-validating/parser.txx> + +#endif // XSD_CXX_PARSER_NON_VALIDATING_PARSER_HXX diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx new file mode 100644 index 0000000..c95b92e --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx @@ -0,0 +1,464 @@ +// file : xsd/cxx/parser/non-validating/parser.txx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <cassert> + +#include <xsd/cxx/xml/bits/literals.hxx> + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + + // empty_content + // + + template <typename C> + void empty_content<C>:: + _start_any_element (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>*) + { + } + + template <typename C> + void empty_content<C>:: + _end_any_element (const ro_string<C>&, + const ro_string<C>&) + { + } + + template <typename C> + void empty_content<C>:: + _any_attribute (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>&) + { + } + + template <typename C> + void empty_content<C>:: + _any_characters (const ro_string<C>&) + { + } + + // + // + template <typename C> + bool empty_content<C>:: + _start_element_impl (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>*) + { + return false; + } + + template <typename C> + bool empty_content<C>:: + _end_element_impl (const ro_string<C>&, + const ro_string<C>&) + { + return false; + } + + template <typename C> + bool empty_content<C>:: + _attribute_impl (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>&) + { + return false; + } + + template <typename C> + bool empty_content<C>:: + _characters_impl (const ro_string<C>&) + { + return false; + } + + template <typename C> + void empty_content<C>:: + _start_element (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>* type) + { + if (!_start_element_impl (ns, name, type)) + _start_any_element (ns, name, type); + } + + template <typename C> + void empty_content<C>:: + _end_element (const ro_string<C>& ns, + const ro_string<C>& name) + { + if (!_end_element_impl (ns, name)) + _end_any_element (ns, name); + } + + template <typename C> + void empty_content<C>:: + _attribute (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value) + { + // Weed out special attributes: xsi:type, xsi:nil, + // xsi:schemaLocation and noNamespaceSchemaLocation. + // See section 3.2.7 in Structures for details. + // + if (ns == xml::bits::xsi_namespace<C> () && + (name == xml::bits::type<C> () || + name == xml::bits::nil_lit<C> () || + name == xml::bits::schema_location<C> () || + name == xml::bits::no_namespace_schema_location<C> ())) + return; + + // Also some parsers (notably Xerces-C++) supplies us with + // namespace-prefix mapping attributes. + // + if (ns == xml::bits::xmlns_namespace<C> ()) + return; + + if (!_attribute_impl (ns, name, value)) + _any_attribute (ns, name, value); + } + + template <typename C> + void empty_content<C>:: + _characters (const ro_string<C>& s) + { + if (!_characters_impl (s)) + _any_characters (s); + } + + + // simple_content + // + + template <typename C> + void simple_content<C>:: + _attribute (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value) + { + // Weed out special attributes: xsi:type, xsi:nil, + // xsi:schemaLocation and xsi:noNamespaceSchemaLocation. + // See section 3.2.7 in Structures for details. + // + if (ns == xml::bits::xsi_namespace<C> () && + (name == xml::bits::type<C> () || + name == xml::bits::nil_lit<C> () || + name == xml::bits::schema_location<C> () || + name == xml::bits::no_namespace_schema_location<C> ())) + return; + + // Also some parsers (notably Xerces-C++) supplies us with + // namespace-prefix mapping attributes. + // + if (ns == xml::bits::xmlns_namespace<C> ()) + return; + + if (!this->_attribute_impl (ns, name, value)) + this->_any_attribute (ns, name, value); + } + + template <typename C> + void simple_content<C>:: + _characters (const ro_string<C>& str) + { + this->_characters_impl (str); + } + + + // complex_content + // + + template <typename C> + void complex_content<C>:: + _start_element (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>* type) + { + state& s (context_.top ()); + + if (s.depth_++ > 0) + { + if (s.any_) + this->_start_any_element (ns, name, type); + else if (s.parser_) + s.parser_->_start_element (ns, name, type); + } + else + { + if (!this->_start_element_impl (ns, name, type)) + { + this->_start_any_element (ns, name, type); + s.any_ = true; + } + else if (s.parser_ != 0) + s.parser_->_pre_impl (); + } + } + + template <typename C> + void complex_content<C>:: + _end_element (const ro_string<C>& ns, + const ro_string<C>& name) + { + // To understand what's going on here it is helpful to think of + // a "total depth" as being the sum of individual depths over + // all elements. + // + + if (context_.top ().depth_ == 0) + { + state& s (context_.under_top ()); // One before last. + + if (--s.depth_ > 0) + { + // Indirect recursion. + // + if (s.parser_) + s.parser_->_end_element (ns, name); + } + else + { + // Direct recursion. + // + assert (this == s.parser_); + + this->_post_impl (); + + if (!this->_end_element_impl (ns, name)) + assert (false); + } + } + else + { + state& s (context_.top ()); + + if (--s.depth_ > 0) + { + if (s.any_) + this->_end_any_element (ns, name); + else if (s.parser_) + s.parser_->_end_element (ns, name); + } + else + { + if (s.parser_ != 0 && !s.any_) + s.parser_->_post_impl (); + + if (!this->_end_element_impl (ns, name)) + { + s.any_ = false; + this->_end_any_element (ns, name); + } + } + } + } + + template <typename C> + void complex_content<C>:: + _attribute (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value) + { + // Weed out special attributes: xsi:type, xsi:nil, + // xsi:schemaLocation and xsi:noNamespaceSchemaLocation. + // See section 3.2.7 in Structures for details. + // + if (ns == xml::bits::xsi_namespace<C> () && + (name == xml::bits::type<C> () || + name == xml::bits::nil_lit<C> () || + name == xml::bits::schema_location<C> () || + name == xml::bits::no_namespace_schema_location<C> ())) + return; + + // Also some parsers (notably Xerces-C++) supplies us with + // namespace-prefix mapping attributes. + // + if (ns == xml::bits::xmlns_namespace<C> ()) + return; + + state& s (context_.top ()); + + if (s.depth_ > 0) + { + if (s.any_) + this->_any_attribute (ns, name, value); + else if (s.parser_) + s.parser_->_attribute (ns, name, value); + } + else + { + if (!this->_attribute_impl (ns, name, value)) + this->_any_attribute (ns, name, value); + } + } + + template <typename C> + void complex_content<C>:: + _characters (const ro_string<C>& str) + { + state& s (context_.top ()); + + if (s.depth_ > 0) + { + if (s.any_) + this->_any_characters (str); + else if (s.parser_) + s.parser_->_characters (str); + } + else + { + if (!this->_characters_impl (str)) + this->_any_characters (str); + } + } + + template <typename C> + void complex_content<C>:: + _pre_impl () + { + context_.push (state ()); + this->_pre (); + } + + template <typename C> + void complex_content<C>:: + _post_impl () + { + this->_post (); + context_.pop (); + } + + // list_base + // + namespace bits + { + // Find first non-space character. + // + template <typename C> + typename ro_string<C>::size_type + find_ns (const C* s, + typename ro_string<C>::size_type size, + typename ro_string<C>::size_type pos) + { + while (pos < size && + (s[pos] == C (0x20) || s[pos] == C (0x0A) || + s[pos] == C (0x0D) || s[pos] == C (0x09))) + ++pos; + + return pos < size ? pos : ro_string<C>::npos; + } + + // Find first space character. + // + template <typename C> + typename ro_string<C>::size_type + find_s (const C* s, + typename ro_string<C>::size_type size, + typename ro_string<C>::size_type pos) + { + while (pos < size && + s[pos] != C (0x20) && s[pos] != C (0x0A) && + s[pos] != C (0x0D) && s[pos] != C (0x09)) + ++pos; + + return pos < size ? pos : ro_string<C>::npos; + } + } + + // Relevant XML Schema Part 2: Datatypes sections: 4.2.1.2, 4.3.6. + // + + template <typename C> + void list_base<C>:: + _pre_impl () + { + simple_content<C>::_pre_impl (); + buf_.clear (); + } + + template <typename C> + void list_base<C>:: + _characters (const ro_string<C>& s) + { + typedef typename ro_string<C>::size_type size_type; + + const C* data (s.data ()); + size_type size (s.size ()); + + // Handle the previous chunk if we start with a ws. + // + if (!buf_.empty () && + (data[0] == C (0x20) || data[0] == C (0x0A) || + data[0] == C (0x0D) || data[0] == C (0x09))) + { + ro_string<C> tmp (buf_); // Private copy ctor. + _xsd_parse_item (tmp); + buf_.clear (); + } + + // Traverse the data while logically collapsing spaces. + // + for (size_type i (bits::find_ns (data, size, 0)); + i != ro_string<C>::npos;) + { + size_type j (bits::find_s (data, size, i)); + + if (j != ro_string<C>::npos) + { + if (buf_.empty ()) + { + ro_string<C> tmp (data + i, j - i); // Private copy ctor. + _xsd_parse_item (tmp); + } + else + { + // Assemble the first item in str from buf_ and s. + // + std::basic_string<C> str; + str.swap (buf_); + str.append (data + i, j - i); + ro_string<C> tmp (str); // Private copy ctor. + _xsd_parse_item (tmp); + } + + i = bits::find_ns (data, size, j); + } + else + { + // Last fragment, append it to the buf_. + // + buf_.append (data + i, size - i); + break; + } + } + } + + template <typename C> + void list_base<C>:: + _post_impl () + { + // Handle the last item. + // + if (!buf_.empty ()) + { + ro_string<C> tmp (buf_); // Private copy ctor. + _xsd_parse_item (tmp); + } + + simple_content<C>::_post_impl (); + } + } + } + } +} diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx new file mode 100644 index 0000000..397386d --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx @@ -0,0 +1,791 @@ +// file : xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_HXX +#define XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_HXX + +#include <string> + +#include <xsd/cxx/parser/non-validating/xml-schema-pskel.hxx> + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + // any_type + // + template <typename C> + struct any_type_pimpl: virtual any_type_pskel<C> + { + virtual void + post_any_type (); + }; + + // any_simple_type + // + template <typename C> + struct any_simple_type_pimpl: virtual any_simple_type_pskel<C> + { + virtual void + post_any_simple_type (); + }; + + // boolean + // + template <typename C> + struct boolean_pimpl: virtual boolean_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual bool + post_boolean (); + + protected: + std::basic_string<C> str_; + }; + + + // 8-bit + // + template <typename C> + struct byte_pimpl: virtual byte_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual signed char + post_byte (); + + protected: + std::basic_string<C> str_; + }; + + + template <typename C> + struct unsigned_byte_pimpl: virtual unsigned_byte_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual unsigned char + post_unsigned_byte (); + + protected: + std::basic_string<C> str_; + }; + + + // 16-bit + // + template <typename C> + struct short_pimpl: virtual short_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual short + post_short (); + + protected: + std::basic_string<C> str_; + }; + + + template <typename C> + struct unsigned_short_pimpl: virtual unsigned_short_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual unsigned short + post_unsigned_short (); + + protected: + std::basic_string<C> str_; + }; + + + // 32-bit + // + template <typename C> + struct int_pimpl: virtual int_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual int + post_int (); + + protected: + std::basic_string<C> str_; + }; + + + template <typename C> + struct unsigned_int_pimpl: virtual unsigned_int_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual unsigned int + post_unsigned_int (); + + protected: + std::basic_string<C> str_; + }; + + + // 64-bit + // + template <typename C> + struct long_pimpl: virtual long_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual long long + post_long (); + + protected: + std::basic_string<C> str_; + }; + + + template <typename C> + struct unsigned_long_pimpl: virtual unsigned_long_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual unsigned long long + post_unsigned_long (); + + protected: + std::basic_string<C> str_; + }; + + + // Arbitrary-length integers. + // + template <typename C> + struct integer_pimpl: virtual integer_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual long long + post_integer (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct negative_integer_pimpl: virtual negative_integer_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual long long + post_negative_integer (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct non_positive_integer_pimpl: virtual non_positive_integer_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual long long + post_non_positive_integer (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct positive_integer_pimpl: virtual positive_integer_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual unsigned long long + post_positive_integer (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct non_negative_integer_pimpl: virtual non_negative_integer_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual unsigned long long + post_non_negative_integer (); + + protected: + std::basic_string<C> str_; + }; + + + // Floats. + // + template <typename C> + struct float_pimpl: virtual float_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual float + post_float (); + + protected: + std::basic_string<C> str_; + }; + + + template <typename C> + struct double_pimpl: virtual double_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual double + post_double (); + + protected: + std::basic_string<C> str_; + }; + + + template <typename C> + struct decimal_pimpl: virtual decimal_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual double + post_decimal (); + + protected: + std::basic_string<C> str_; + }; + + + // Strings. + // + template <typename C> + struct string_pimpl: virtual string_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_string (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct normalized_string_pimpl: virtual normalized_string_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_normalized_string (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct token_pimpl: virtual token_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_token (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct name_pimpl: virtual name_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_name (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct nmtoken_pimpl: virtual nmtoken_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_nmtoken (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct nmtokens_pimpl: virtual nmtokens_pskel<C> + { + virtual void + _pre (); + + virtual void + _xsd_parse_item (const ro_string<C>&); + + virtual string_sequence<C> + post_nmtokens (); + + protected: + string_sequence<C> seq_; + nmtoken_pimpl<C> parser_; + }; + + template <typename C> + struct ncname_pimpl: virtual ncname_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_ncname (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct id_pimpl: virtual id_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_id (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct idref_pimpl: virtual idref_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_idref (); + + protected: + std::basic_string<C> str_; + }; + + template <typename C> + struct idrefs_pimpl: virtual idrefs_pskel<C> + { + virtual void + _pre (); + + virtual void + _xsd_parse_item (const ro_string<C>&); + + virtual string_sequence<C> + post_idrefs (); + + protected: + string_sequence<C> seq_; + idref_pimpl<C> parser_; + }; + + // language + // + template <typename C> + struct language_pimpl: virtual language_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_language (); + + protected: + std::basic_string<C> str_; + }; + + // anyURI + // + template <typename C> + struct uri_pimpl: virtual uri_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::basic_string<C> + post_uri (); + + protected: + std::basic_string<C> str_; + }; + + // QName + // + template <typename C> + struct qname_pimpl: virtual qname_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual qname<C> + post_qname (); + + protected: + std::basic_string<C> str_; + }; + + // base64Binary + // + template <typename C> + struct base64_binary_pimpl: virtual base64_binary_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::auto_ptr<buffer> + post_base64_binary (); + + protected: + std::basic_string<C> str_; + }; + + // hexBinary + // + template <typename C> + struct hex_binary_pimpl: virtual hex_binary_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual std::auto_ptr<buffer> + post_hex_binary (); + + protected: + std::basic_string<C> str_; + }; + + // gday + // + template <typename C> + struct gday_pimpl: virtual gday_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual gday + post_gday (); + + protected: + std::basic_string<C> str_; + }; + + // gmonth + // + template <typename C> + struct gmonth_pimpl: virtual gmonth_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual gmonth + post_gmonth (); + + protected: + std::basic_string<C> str_; + }; + + // gyear + // + template <typename C> + struct gyear_pimpl: virtual gyear_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual gyear + post_gyear (); + + protected: + std::basic_string<C> str_; + }; + + // gmonth_day + // + template <typename C> + struct gmonth_day_pimpl: virtual gmonth_day_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual gmonth_day + post_gmonth_day (); + + protected: + std::basic_string<C> str_; + }; + + // gyear_month + // + template <typename C> + struct gyear_month_pimpl: virtual gyear_month_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual gyear_month + post_gyear_month (); + + protected: + std::basic_string<C> str_; + }; + + // date + // + template <typename C> + struct date_pimpl: virtual date_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual date + post_date (); + + protected: + std::basic_string<C> str_; + }; + + // time + // + template <typename C> + struct time_pimpl: virtual time_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual time + post_time (); + + protected: + std::basic_string<C> str_; + }; + + // date_time + // + template <typename C> + struct date_time_pimpl: virtual date_time_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual date_time + post_date_time (); + + protected: + std::basic_string<C> str_; + }; + + // duration + // + template <typename C> + struct duration_pimpl: virtual duration_pskel<C> + { + virtual void + _pre (); + + virtual void + _characters (const ro_string<C>&); + + virtual duration + post_duration (); + + protected: + std::basic_string<C> str_; + }; + + // + // + namespace bits + { + // float literals: INF -INF NaN + // + template<typename C> + const C* + positive_inf (); + + template<typename C> + const C* + negative_inf (); + + template<typename C> + const C* + nan (); + + // boolean literals + // + template<typename C> + const C* + true_ (); + + template<typename C> + const C* + one (); + } + } + } + } +} + +#include <xsd/cxx/parser/non-validating/xml-schema-pimpl.txx> + +#endif // XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_HXX + +#include <xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx> diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx new file mode 100644 index 0000000..db9a5d1 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx @@ -0,0 +1,129 @@ +// file : xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR) + +#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_IXX_CHAR +#define XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_IXX_CHAR + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + namespace bits + { + // + // + template<> + inline const char* + positive_inf<char> () + { + return "INF"; + } + + template<> + inline const char* + negative_inf<char> () + { + return "-INF"; + } + + template<> + inline const char* + nan<char> () + { + return "NaN"; + } + + // + // + template<> + inline const char* + true_<char> () + { + return "true"; + } + + template<> + inline const char* + one<char> () + { + return "1"; + } + } + } + } + } +} + +#endif // XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_IXX_CHAR +#endif // XSD_CXX_PARSER_USE_CHAR + + +#if defined(XSD_CXX_PARSER_USE_WCHAR) || !defined(XSD_CXX_PARSER_USE_CHAR) + +#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_IXX_WCHAR +#define XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_IXX_WCHAR + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + namespace bits + { + // + // + template<> + inline const wchar_t* + positive_inf<wchar_t> () + { + return L"INF"; + } + + template<> + inline const wchar_t* + negative_inf<wchar_t> () + { + return L"-INF"; + } + + template<> + inline const wchar_t* + nan<wchar_t> () + { + return L"NaN"; + } + + // + // + template<> + inline const wchar_t* + true_<wchar_t> () + { + return L"true"; + } + + template<> + inline const wchar_t* + one<wchar_t> () + { + return L"1"; + } + } + } + } + } +} + +#endif // XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_IXX_WCHAR +#endif // XSD_CXX_PARSER_USE_WCHAR diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx new file mode 100644 index 0000000..c430f49 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx @@ -0,0 +1,2068 @@ +// file : xsd/cxx/parser/non-validating/xml-schema-pimpl.txx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <limits> +#include <locale> + +#include <xsd/cxx/zc-istream.hxx> + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + // Note that most of the types implemented here cannot have + // whitespaces in the value. As result we don't need to waste + // time collapsing whitespaces. All we need to do is trim the + // string representation which can be done without copying. + // + + // any_type + // + + template <typename C> + void any_type_pimpl<C>:: + post_any_type () + { + } + + // any_simple_type + // + + template <typename C> + void any_simple_type_pimpl<C>:: + post_any_simple_type () + { + } + + // boolean + // + template <typename C> + void boolean_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void boolean_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + bool boolean_pimpl<C>:: + post_boolean () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + return str == bits::true_<C> () || str == bits::one<C> (); + } + + // byte + // + + template <typename C> + void byte_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void byte_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + signed char byte_pimpl<C>:: + post_byte () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + short t; + zc_istream<C> is (str); + is >> t; + + return static_cast<signed char> (t); + } + + // unsigned_byte + // + + template <typename C> + void unsigned_byte_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void unsigned_byte_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + unsigned char unsigned_byte_pimpl<C>:: + post_unsigned_byte () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + unsigned short t; + zc_istream<C> is (str); + is >> t; + + return static_cast<unsigned char> (t); + } + + // short + // + + template <typename C> + void short_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void short_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + short short_pimpl<C>:: + post_short () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + short t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // unsigned_short + // + + template <typename C> + void unsigned_short_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void unsigned_short_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + unsigned short unsigned_short_pimpl<C>:: + post_unsigned_short () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + unsigned short t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // int + // + + template <typename C> + void int_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void int_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + int int_pimpl<C>:: + post_int () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + int t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // unsigned_int + // + + template <typename C> + void unsigned_int_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void unsigned_int_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + unsigned int unsigned_int_pimpl<C>:: + post_unsigned_int () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + unsigned int t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // long + // + template <typename C> + void long_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void long_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + long long long_pimpl<C>:: + post_long () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + long long t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // unsigned_long + // + template <typename C> + void unsigned_long_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void unsigned_long_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + unsigned long long unsigned_long_pimpl<C>:: + post_unsigned_long () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + unsigned long long t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // integer + // + template <typename C> + void integer_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void integer_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + long long integer_pimpl<C>:: + post_integer () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + long long t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // negative_integer + // + template <typename C> + void negative_integer_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void negative_integer_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + long long negative_integer_pimpl<C>:: + post_negative_integer () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + long long t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // non_positive_integer + // + template <typename C> + void non_positive_integer_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void non_positive_integer_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + long long non_positive_integer_pimpl<C>:: + post_non_positive_integer () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + long long t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // positive_integer + // + template <typename C> + void positive_integer_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void positive_integer_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + unsigned long long positive_integer_pimpl<C>:: + post_positive_integer () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + unsigned long long t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // non_negative_integer + // + template <typename C> + void non_negative_integer_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void non_negative_integer_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + unsigned long long non_negative_integer_pimpl<C>:: + post_non_negative_integer () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + unsigned long long t; + zc_istream<C> is (str); + is >> t; + + return t; + } + + // float + // + template <typename C> + void float_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void float_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + float float_pimpl<C>:: + post_float () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + if (str == bits::positive_inf<C> ()) + return std::numeric_limits<float>::infinity (); + + if (str == bits::negative_inf<C> ()) + return -std::numeric_limits<float>::infinity (); + + if (str == bits::nan<C> ()) + return std::numeric_limits<float>::quiet_NaN (); + + float t; + zc_istream<C> is (str); + is.imbue (std::locale::classic ()); + is >> t; + + return t; + } + + // double + // + template <typename C> + void double_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void double_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + double double_pimpl<C>:: + post_double () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + if (str == bits::positive_inf<C> ()) + return std::numeric_limits<double>::infinity (); + + if (str == bits::negative_inf<C> ()) + return -std::numeric_limits<double>::infinity (); + + if (str == bits::nan<C> ()) + return std::numeric_limits<double>::quiet_NaN (); + + double t; + zc_istream<C> is (str); + is.imbue (std::locale::classic ()); + is >> t; + + return t; + } + + // decimal + // + template <typename C> + void decimal_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void decimal_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + double decimal_pimpl<C>:: + post_decimal () + { + std::basic_string<C> tmp; + tmp.swap (str_); + + ro_string<C> str (tmp); + trim (str); + + double t; + zc_istream<C> is (str); + is.imbue (std::locale::classic ()); + is >> t; + + return t; + } + + + // string + // + template <typename C> + void string_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void string_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + std::basic_string<C> string_pimpl<C>:: + post_string () + { + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // normalized_string + // + template <typename C> + void normalized_string_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void normalized_string_pimpl<C>:: + _characters (const ro_string<C>& s) + { + str_ += s; + } + + template <typename C> + std::basic_string<C> normalized_string_pimpl<C>:: + post_normalized_string () + { + typedef typename std::basic_string<C>::size_type size_type; + + size_type size (str_.size ()); + + for (size_type i (0); i < size; ++i) + { + C& c = str_[i]; + + if (c == C (0x0A) || c == C (0x0D) || c == C (0x09)) + c = C (0x20); + } + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // token + // + template <typename C> + void token_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void token_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> token_pimpl<C>:: + post_token () + { + typedef typename std::basic_string<C>::size_type size_type; + + size_type size (str_.size ()); + size_type j (0); + + bool subs (false); + + for (size_type i (0); i < size; ++i) + { + C c = str_[i]; + + if (c == C (0x20) || c == C (0x0A) || + c == C (0x0D) || c == C (0x09)) + { + subs = true; + } + else + { + if (subs) + { + subs = false; + str_[j++] = C (0x20); + } + + str_[j++] = c; + } + } + + str_.resize (j); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // name + // + template <typename C> + void name_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void name_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> name_pimpl<C>:: + post_name () + { + ro_string<C> tmp (str_); + str_.resize (trim_right (tmp)); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // nmtoken + // + template <typename C> + void nmtoken_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void nmtoken_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> nmtoken_pimpl<C>:: + post_nmtoken () + { + ro_string<C> tmp (str_); + str_.resize (trim_right (tmp)); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // nmtokens + // + template <typename C> + void nmtokens_pimpl<C>:: + _pre () + { + nmtokens_pskel<C>::_pre (); + seq_.clear (); + } + + template <typename C> + string_sequence<C> nmtokens_pimpl<C>:: + post_nmtokens () + { + string_sequence<C> r; + r.swap (seq_); + return r; + } + + template <typename C> + void nmtokens_pimpl<C>:: + _xsd_parse_item (const ro_string<C>& s) + { + parser_.pre (); + parser_._pre (); + parser_._characters (s); + parser_._post (); + seq_.push_back (parser_.post_nmtoken ()); + } + + // ncname + // + template <typename C> + void ncname_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void ncname_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> ncname_pimpl<C>:: + post_ncname () + { + ro_string<C> tmp (str_); + str_.resize (trim_right (tmp)); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // id + // + template <typename C> + void id_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void id_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> id_pimpl<C>:: + post_id () + { + ro_string<C> tmp (str_); + str_.resize (trim_right (tmp)); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // idref + // + template <typename C> + void idref_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void idref_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> idref_pimpl<C>:: + post_idref () + { + ro_string<C> tmp (str_); + str_.resize (trim_right (tmp)); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // idrefs + // + template <typename C> + void idrefs_pimpl<C>:: + _pre () + { + idrefs_pskel<C>::_pre (); + seq_.clear (); + } + + template <typename C> + string_sequence<C> idrefs_pimpl<C>:: + post_idrefs () + { + string_sequence<C> r; + r.swap (seq_); + return r; + } + + template <typename C> + void idrefs_pimpl<C>:: + _xsd_parse_item (const ro_string<C>& s) + { + parser_.pre (); + parser_._pre (); + parser_._characters (s); + parser_._post (); + seq_.push_back (parser_.post_idref ()); + } + + // language + // + template <typename C> + void language_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void language_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> language_pimpl<C>:: + post_language () + { + ro_string<C> tmp (str_); + str_.resize (trim_right (tmp)); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // uri + // + template <typename C> + void uri_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void uri_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + std::basic_string<C> uri_pimpl<C>:: + post_uri () + { + ro_string<C> tmp (str_); + str_.resize (trim_right (tmp)); + + std::basic_string<C> r; + r.swap (str_); + return r; + } + + // qname + // + template <typename C> + void qname_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void qname_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + qname<C> qname_pimpl<C>:: + post_qname () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + size_type pos (tmp.find (C (':'))); + + if (pos != ro_string<C>::npos) + { + std::basic_string<C> prefix (tmp.data (), pos++); + std::basic_string<C> name (tmp.data () + pos, size - pos); + return qname<C> (prefix, name); + } + else + { + str_.resize (size); + return qname<C> (str_); + } + } + + // base64_binary + // + template <typename C> + void base64_binary_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void base64_binary_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + namespace bits + { + template <typename C> + inline unsigned char + base64_decode (C c) + { + unsigned char r (0xFF); + + if (c >= C('A') && c <= C ('Z')) + r = static_cast<unsigned char> (c - C ('A')); + else if (c >= C('a') && c <= C ('z')) + r = static_cast<unsigned char> (c - C ('a') + 26); + else if (c >= C('0') && c <= C ('9')) + r = static_cast<unsigned char> (c - C ('0') + 52); + else if (c == C ('+')) + r = 62; + else if (c == C ('/')) + r = 63; + + return r; + } + } + + template <typename C> + std::auto_ptr<buffer> base64_binary_pimpl<C>:: + post_base64_binary () + { + typedef typename std::basic_string<C>::size_type size_type; + + size_type size (str_.size ()); + const C* src (str_.c_str ()); + + // Remove all whitespaces. + // + { + size_type j (0); + + bool subs (false); + + for (size_type i (0); i < size; ++i) + { + C c = str_[i]; + + if (c == C (0x20) || c == C (0x0A) || + c == C (0x0D) || c == C (0x09)) + { + subs = true; + } + else + { + if (subs) + subs = false; + + str_[j++] = c; + } + } + + size = j; + str_.resize (size); + } + + // Our length should be a multiple of four. + // + size_type quad_count (size / 4); + size_type capacity (quad_count * 3 + 1); + + std::auto_ptr<buffer> buf (new buffer (capacity, capacity)); + char* dst (buf->data ()); + + size_type si (0), di (0); // Source and destination indexes. + + // Process all quads except the last one. + // + unsigned char b1, b2, b3, b4; + + for (size_type q (0); q < quad_count - 1; ++q) + { + b1 = bits::base64_decode (src[si++]); + b2 = bits::base64_decode (src[si++]); + b3 = bits::base64_decode (src[si++]); + b4 = bits::base64_decode (src[si++]); + + dst[di++] = (b1 << 2) | (b2 >> 4); + dst[di++] = (b2 << 4) | (b3 >> 2); + dst[di++] = (b3 << 6) | b4; + } + + // Process the last quad. The first two octets are always there. + // + b1 = bits::base64_decode (src[si++]); + b2 = bits::base64_decode (src[si++]); + + C e3 (src[si++]); + C e4 (src[si++]); + + if (e4 == C ('=')) + { + if (e3 == C ('=')) + { + // Two pads. Last 4 bits in b2 should be zero. + // + dst[di++] = (b1 << 2) | (b2 >> 4); + } + else + { + // One pad. Last 2 bits in b3 should be zero. + // + b3 = bits::base64_decode (e3); + + dst[di++] = (b1 << 2) | (b2 >> 4); + dst[di++] = (b2 << 4) | (b3 >> 2); + } + } + else + { + // No pads. + // + b3 = bits::base64_decode (e3); + b4 = bits::base64_decode (e4); + + dst[di++] = (b1 << 2) | (b2 >> 4); + dst[di++] = (b2 << 4) | (b3 >> 2); + dst[di++] = (b3 << 6) | b4; + } + + // Set the real size. + // + buf->size (di); + + return buf; + } + + // hex_binary + // + template <typename C> + void hex_binary_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void hex_binary_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + namespace bits + { + template <typename C> + inline unsigned char + hex_decode (C c) + { + unsigned char r (0xFF); + + if (c >= C('0') && c <= C ('9')) + r = static_cast<unsigned char> (c - C ('0')); + else if (c >= C ('A') && c <= C ('F')) + r = static_cast<unsigned char> (10 + (c - C ('A'))); + else if (c >= C ('a') && c <= C ('f')) + r = static_cast<unsigned char> (10 + (c - C ('a'))); + + return r; + } + } + + template <typename C> + std::auto_ptr<buffer> hex_binary_pimpl<C>:: + post_hex_binary () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + + buffer::size_t n (size / 2); + std::auto_ptr<buffer> buf (new buffer (n)); + + const C* src (tmp.data ()); + char* dst (buf->data ()); + + for (buffer::size_t i (0); i < n; ++i) + { + unsigned char h (bits::hex_decode (src[2 * i])); + unsigned char l (bits::hex_decode (src[2 * i + 1])); + dst[i] = (h << 4) | l; + } + + return buf; + } + + // time_zone + // + namespace bits + { + // Datatypes 3.2.7.3. + // + template <typename C> + void + parse_tz (const C* s, + typename std::basic_string<C>::size_type n, + short& h, short& m) + { + // time_zone := Z|(+|-)HH:MM + // + if (n == 0) + { + return; + } + else if (s[0] == 'Z') + { + h = 0; + m = 0; + } + else if (n == 6) + { + // Parse hours. + // + h = 10 * (s[1] - '0') + (s[2] - '0'); + + // Parse minutes. + // + m = 10 * (s[4] - '0') + (s[5] - '0'); + + if (s[0] == '-') + { + h = -h; + m = -m; + } + } + } + } + + // gday + // + template <typename C> + void gday_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void gday_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + gday gday_pimpl<C>:: + post_gday () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + unsigned short day (0); + bool z (false); + short zh (0), zm (0); + + // gday := ---DD[Z|(+|-)HH:MM] + // + if (size >= 5) + { + day = 10 * (s[3] - '0') + (s[4] - '0'); + + if (size > 5) + { + bits::parse_tz (s + 5, size - 5, zh, zm); + z = true; + } + } + + return z ? gday (day, zh, zm) : gday (day); + } + + // gmonth + // + template <typename C> + void gmonth_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void gmonth_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + gmonth gmonth_pimpl<C>:: + post_gmonth () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + unsigned short month (0); + bool z (false); + short zh (0), zm (0); + + // gmonth := --MM[Z|(+|-)HH:MM] + // + if (size >= 4) + { + month = 10 * (s[2] - '0') + (s[3] - '0'); + + if (size > 4) + { + bits::parse_tz (s + 4, size - 4, zh, zm); + z = true; + } + } + + return z ? gmonth (month, zh, zm) : gmonth (month); + } + + // gyear + // + template <typename C> + void gyear_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void gyear_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + gyear gyear_pimpl<C>:: + post_gyear () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + int year (0); + bool z (false); + short zh (0), zm (0); + + // gyear := [-]CCYY[N]*[Z|(+|-)HH:MM] + // + + if (size >= 4) + { + // Find the end of the year token. + // + size_type pos (4); + for (; pos < size; ++pos) + { + C c (s[pos]); + + if (c == C ('Z') || c == C ('+') || c == C ('-')) + break; + } + + ro_string<C> year_fragment (s, pos); + zc_istream<C> is (year_fragment); + is >> year; + + if (pos < size) + { + bits::parse_tz (s + pos, size - pos, zh, zm); + z = true; + } + } + + return z ? gyear (year, zh, zm) : gyear (year); + } + + // gmonth_day + // + template <typename C> + void gmonth_day_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void gmonth_day_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + gmonth_day gmonth_day_pimpl<C>:: + post_gmonth_day () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + unsigned short month (0), day (0); + bool z (false); + short zh (0), zm (0); + + // gmonth_day := --MM-DD[Z|(+|-)HH:MM] + // + if (size >= 7) + { + month = 10 * (s[2] - '0') + (s[3] - '0'); + day = 10 * (s[5] - '0') + (s[6] - '0'); + + if (size > 7) + { + bits::parse_tz (s + 7, size - 7, zh, zm); + z = true; + } + } + + return z + ? gmonth_day (month, day, zh, zm) + : gmonth_day (month, day); + } + + // gyear_month + // + template <typename C> + void gyear_month_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void gyear_month_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + gyear_month gyear_month_pimpl<C>:: + post_gyear_month () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + int year (0); + unsigned short month (0); + bool z (false); + short zh (0), zm (0); + + // gyear_month := [-]CCYY[N]*-MM[Z|(+|-)HH:MM] + // + + if (size >= 7) + { + // Find the end of the year token. + // + size_type pos (tmp.find (C ('-'), 4)); + + if (pos != ro_string<C>::npos && (size - pos - 1) >= 2) + { + ro_string<C> year_fragment (s, pos); + zc_istream<C> yis (year_fragment); + yis >> year; + + month = 10 * (s[pos + 1] - '0') + (s[pos + 2] - '0'); + + pos += 3; + + if (pos < size) + { + bits::parse_tz (s + pos, size - pos, zh, zm); + z = true; + } + } + } + + return z + ? gyear_month (year, month, zh, zm) + : gyear_month (year, month); + } + + // date + // + template <typename C> + void date_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void date_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + date date_pimpl<C>:: + post_date () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + int year (0); + unsigned short month (0), day (0); + bool z (false); + short zh (0), zm (0); + + // date := [-]CCYY[N]*-MM-DD[Z|(+|-)HH:MM] + // + + if (size >= 10) + { + // Find the end of the year token. + // + size_type pos (tmp.find (C ('-'), 4)); + + if (pos != ro_string<C>::npos && (size - pos - 1) >= 5) + { + ro_string<C> year_fragment (s, pos); + zc_istream<C> yis (year_fragment); + yis >> year; + + month = 10 * (s[pos + 1] - '0') + (s[pos + 2] - '0'); + day = 10 * (s[pos + 4] - '0') + (s[pos + 5] - '0'); + + pos += 6; + + if (pos < size) + { + bits::parse_tz (s + pos, size - pos, zh, zm); + z = true; + } + } + } + + return z + ? date (year, month, day, zh, zm) + : date (year, month, day); + } + + // time + // + template <typename C> + void time_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void time_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + time time_pimpl<C>:: + post_time () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + unsigned short hours (0), minutes (0); + double seconds (0.0); + bool z (false); + short zh (0), zm (0); + + // time := HH:MM:SS[.S+][Z|(+|-)HH:MM] + // + + if (size >= 8) + { + hours = 10 * (s[0] - '0') + (s[1] - '0'); + minutes = 10 * (s[3] - '0') + (s[4] - '0'); + + // Find the end of the seconds fragment. + // + size_type pos (8); + for (; pos < size; ++pos) + { + C c (s[pos]); + + if (c == C ('Z') || c == C ('+') || c == C ('-')) + break; + } + + ro_string<C> seconds_fragment (s + 6, pos - 6); + zc_istream<C> sis (seconds_fragment); + sis >> seconds; + + if (pos < size) + { + bits::parse_tz (s + pos, size - pos, zh, zm); + z = true; + } + } + + return z + ? time (hours, minutes, seconds, zh, zm) + : time (hours, minutes, seconds); + } + + + // date_time + // + template <typename C> + void date_time_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void date_time_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + template <typename C> + date_time date_time_pimpl<C>:: + post_date_time () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + const C* s (tmp.data ()); + + int year (0); + unsigned short month (0), day (0), hours (0), minutes (0); + double seconds (0.0); + bool z (false); + short zh (0), zm (0); + + // date_time := [-]CCYY[N]*-MM-DDTHH:MM:SS[.S+][Z|(+|-)HH:MM] + // + + if (size >= 19) + { + // Find the end of the year token. + // + size_type pos (tmp.find (C ('-'), 4)); + + if (pos != ro_string<C>::npos && (size - pos - 1) >= 14) + { + ro_string<C> year_fragment (s, pos); + zc_istream<C> yis (year_fragment); + yis >> year; + + month = 10 * (s[pos + 1] - '0') + (s[pos + 2] - '0'); + day = 10 * (s[pos + 4] - '0') + (s[pos + 5] - '0'); + + pos += 7; // Point to the first H. + + hours = 10 * (s[pos] - '0') + (s[pos + 1] - '0'); + minutes = 10 * (s[pos + 3] - '0') + (s[pos + 4] - '0'); + + // Find the end of the seconds fragment. + // + pos += 6; // Point to the first S. + + size_type sec_end (pos + 2); + for (; sec_end < size; ++sec_end) + { + C c (s[sec_end]); + + if (c == C ('Z') || c == C ('+') || c == C ('-')) + break; + } + + ro_string<C> seconds_fragment (s + pos, sec_end - pos); + zc_istream<C> sis (seconds_fragment); + sis >> seconds; + + if (sec_end < size) + { + bits::parse_tz (s + sec_end, size - sec_end, zh, zm); + z = true; + } + } + } + + return z + ? date_time (year, month, day, hours, minutes, seconds, zh, zm) + : date_time (year, month, day, hours, minutes, seconds); + } + + // duration + // + template <typename C> + void duration_pimpl<C>:: + _pre () + { + str_.clear (); + } + + template <typename C> + void duration_pimpl<C>:: + _characters (const ro_string<C>& s) + { + if (str_.size () == 0) + { + ro_string<C> tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; + } + + namespace bits + { + template <typename C> + inline typename ro_string<C>::size_type + duration_delim (const C* s, + typename ro_string<C>::size_type pos, + typename ro_string<C>::size_type size) + { + const C* p (s + pos); + for (; p < (s + size); ++p) + { + if (*p == C ('Y') || *p == C ('D') || *p == C ('M') || + *p == C ('H') || *p == C ('M') || *p == C ('S') || + *p == C ('T')) + break; + } + + return p - s; + } + } + + template <typename C> + duration duration_pimpl<C>:: + post_duration () + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str_); + size_type size (trim_right (tmp)); + + bool negative (false); + unsigned int years (0), months (0), days (0), hours (0), minutes (0); + double seconds (0.0); + + // duration := [-]P[nY][nM][nD][TnHnMn[.n+]S] + // + const C* s (tmp.data ()); + + if (size >= 3) + { + size_type pos (0); + + if (s[0] == C ('-')) + { + negative = true; + pos++; + } + + pos++; // Skip 'P'. + + size_type del (bits::duration_delim (s, pos, size)); + + if (del != size && s[del] == C ('Y')) + { + ro_string<C> fragment (s + pos, del - pos); + zc_istream<C> is (fragment); + is >> years; + + pos = del + 1; + del = bits::duration_delim (s, pos, size); + } + + if (del != size && s[del] == C ('M')) + { + ro_string<C> fragment (s + pos, del - pos); + zc_istream<C> is (fragment); + is >> months; + + pos = del + 1; + del = bits::duration_delim (s, pos, size); + } + + if (del != size && s[del] == C ('D')) + { + ro_string<C> fragment (s + pos, del - pos); + zc_istream<C> is (fragment); + is >> days; + + pos = del + 1; + del = bits::duration_delim (s, pos, size); + } + + if (del != size && s[del] == C ('T')) + { + pos = del + 1; + del = bits::duration_delim (s, pos, size); + + if (del != size && s[del] == C ('H')) + { + ro_string<C> fragment (s + pos, del - pos); + zc_istream<C> is (fragment); + is >> hours; + + pos = del + 1; + del = bits::duration_delim (s, pos, size); + } + + if (del != size && s[del] == C ('M')) + { + ro_string<C> fragment (s + pos, del - pos); + zc_istream<C> is (fragment); + is >> minutes; + + pos = del + 1; + del = bits::duration_delim (s, pos, size); + } + + if (del != size && s[del] == C ('S')) + { + ro_string<C> fragment (s + pos, del - pos); + zc_istream<C> is (fragment); + is >> seconds; + } + } + } + + return duration ( + negative, years, months, days, hours, minutes, seconds); + } + } + } + } +} diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx new file mode 100644 index 0000000..8e4972a --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx @@ -0,0 +1,647 @@ +// file : xsd/cxx/parser/non-validating/xml-schema-pskel.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_HXX +#define XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_HXX + +#include <string> +#include <memory> // auto_ptr + +#include <xsd/cxx/parser/xml-schema.hxx> +#include <xsd/cxx/parser/non-validating/parser.hxx> + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + // anyType and anySimpleType. All events are routed to the + // _any_* callbacks. + // + template <typename C> + struct any_type_pskel: complex_content<C> + { + virtual bool + _start_element_impl (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>*); + + virtual bool + _end_element_impl (const ro_string<C>&, + const ro_string<C>&); + + virtual bool + _attribute_impl (const ro_string<C>&, + const ro_string<C>&, + const ro_string<C>&); + + virtual bool + _characters_impl (const ro_string<C>&); + + virtual void + post_any_type () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct any_simple_type_pskel: simple_content<C> + { + virtual bool + _characters_impl (const ro_string<C>&); + + virtual void + post_any_simple_type () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // Boolean. + // + template <typename C> + struct boolean_pskel: simple_content<C> + { + virtual bool + post_boolean () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // 8-bit + // + template <typename C> + struct byte_pskel: simple_content<C> + { + virtual signed char + post_byte () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct unsigned_byte_pskel: simple_content<C> + { + virtual unsigned char + post_unsigned_byte () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // 16-bit + // + template <typename C> + struct short_pskel: simple_content<C> + { + virtual short + post_short () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct unsigned_short_pskel: simple_content<C> + { + virtual unsigned short + post_unsigned_short () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // 32-bit + // + template <typename C> + struct int_pskel: simple_content<C> + { + virtual int + post_int () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct unsigned_int_pskel: simple_content<C> + { + virtual unsigned int + post_unsigned_int () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // 64-bit + // + template <typename C> + struct long_pskel: simple_content<C> + { + virtual long long + post_long () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct unsigned_long_pskel: simple_content<C> + { + virtual unsigned long long + post_unsigned_long () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // Arbitrary-length integers. + // + template <typename C> + struct integer_pskel: simple_content<C> + { + virtual long long + post_integer () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct negative_integer_pskel: simple_content<C> + { + virtual long long + post_negative_integer () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct non_positive_integer_pskel: simple_content<C> + { + virtual long long + post_non_positive_integer () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct positive_integer_pskel: simple_content<C> + { + virtual unsigned long long + post_positive_integer () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct non_negative_integer_pskel: simple_content<C> + { + virtual unsigned long long + post_non_negative_integer () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // Floats. + // + template <typename C> + struct float_pskel: simple_content<C> + { + virtual float + post_float () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct double_pskel: simple_content<C> + { + virtual double + post_double () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct decimal_pskel: simple_content<C> + { + virtual double + post_decimal () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + + // Strings. + // + template <typename C> + struct string_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_string () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct normalized_string_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_normalized_string () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct token_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_token () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct name_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_name () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct nmtoken_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_nmtoken () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct nmtokens_pskel: list_base<C> + { + virtual string_sequence<C> + post_nmtokens () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct ncname_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_ncname () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct id_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_id () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct idref_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_idref () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct idrefs_pskel: list_base<C> + { + virtual string_sequence<C> + post_idrefs () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + // Language. + // + template <typename C> + struct language_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_language () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + // URI. + // + template <typename C> + struct uri_pskel: simple_content<C> + { + virtual std::basic_string<C> + post_uri () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + // QName. + // + template <typename C> + struct qname_pskel: simple_content<C> + { + virtual qname<C> + post_qname () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + // Base64 and hex binaries. + // + template <typename C> + struct base64_binary_pskel: simple_content<C> + { + virtual std::auto_ptr<buffer> + post_base64_binary () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct hex_binary_pskel: simple_content<C> + { + virtual std::auto_ptr<buffer> + post_hex_binary () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + // Time and date types. + // + template <typename C> + struct gday_pskel: simple_content<C> + { + virtual gday + post_gday () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct gmonth_pskel: simple_content<C> + { + virtual gmonth + post_gmonth () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct gyear_pskel: simple_content<C> + { + virtual gyear + post_gyear () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct gmonth_day_pskel: simple_content<C> + { + virtual gmonth_day + post_gmonth_day () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct gyear_month_pskel: simple_content<C> + { + virtual gyear_month + post_gyear_month () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct date_pskel: simple_content<C> + { + virtual date + post_date () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct time_pskel: simple_content<C> + { + virtual time + post_time () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct date_time_pskel: simple_content<C> + { + virtual date_time + post_date_time () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + + template <typename C> + struct duration_pskel: simple_content<C> + { + virtual duration + post_duration () = 0; + + static const C* + _static_type (); + + virtual const C* + _dynamic_type () const; + }; + } + } + } +} + +#include <xsd/cxx/parser/non-validating/xml-schema-pskel.txx> + +#endif // XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_HXX + +#include <xsd/cxx/parser/non-validating/xml-schema-pskel.ixx> diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx new file mode 100644 index 0000000..13b1fab --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx @@ -0,0 +1,1249 @@ +// file : xsd/cxx/parser/non-validating/xml-schema-pskel.ixx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR) + +#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_IXX_CHAR +#define XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_IXX_CHAR + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + template<> + inline const char* any_type_pskel<char>:: + _static_type () + { + return "anyType http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* any_type_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* any_simple_type_pskel<char>:: + _static_type () + { + return "anySimpleType http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* any_simple_type_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* boolean_pskel<char>:: + _static_type () + { + return "boolean http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* boolean_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* byte_pskel<char>:: + _static_type () + { + return "byte http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* byte_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* unsigned_byte_pskel<char>:: + _static_type () + { + return "unsignedByte http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* unsigned_byte_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* short_pskel<char>:: + _static_type () + { + return "short http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* short_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* unsigned_short_pskel<char>:: + _static_type () + { + return "unsignedShort http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* unsigned_short_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* int_pskel<char>:: + _static_type () + { + return "int http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* int_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* unsigned_int_pskel<char>:: + _static_type () + { + return "unsignedInt http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* unsigned_int_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* long_pskel<char>:: + _static_type () + { + return "long http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* long_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* unsigned_long_pskel<char>:: + _static_type () + { + return "unsignedLong http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* unsigned_long_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* integer_pskel<char>:: + _static_type () + { + return "integer http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* integer_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* negative_integer_pskel<char>:: + _static_type () + { + return "negativeInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* negative_integer_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* non_positive_integer_pskel<char>:: + _static_type () + { + return "nonPositiveInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* non_positive_integer_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* positive_integer_pskel<char>:: + _static_type () + { + return "positiveInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* positive_integer_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* non_negative_integer_pskel<char>:: + _static_type () + { + return "nonNegativeInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* non_negative_integer_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* float_pskel<char>:: + _static_type () + { + return "float http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* float_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* double_pskel<char>:: + _static_type () + { + return "double http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* double_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* decimal_pskel<char>:: + _static_type () + { + return "decimal http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* decimal_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* string_pskel<char>:: + _static_type () + { + return "string http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* string_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* normalized_string_pskel<char>:: + _static_type () + { + return "normalizedString http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* normalized_string_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* token_pskel<char>:: + _static_type () + { + return "token http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* token_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* name_pskel<char>:: + _static_type () + { + return "Name http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* name_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* nmtoken_pskel<char>:: + _static_type () + { + return "NMTOKEN http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* nmtoken_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* nmtokens_pskel<char>:: + _static_type () + { + return "NMTOKENS http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* nmtokens_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* ncname_pskel<char>:: + _static_type () + { + return "NCName http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* ncname_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* id_pskel<char>:: + _static_type () + { + return "ID http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* id_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* idref_pskel<char>:: + _static_type () + { + return "IDREF http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* idref_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* idrefs_pskel<char>:: + _static_type () + { + return "IDREFS http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* idrefs_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* language_pskel<char>:: + _static_type () + { + return "language http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* language_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* uri_pskel<char>:: + _static_type () + { + return "anyURI http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* uri_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* qname_pskel<char>:: + _static_type () + { + return "QName http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* qname_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* base64_binary_pskel<char>:: + _static_type () + { + return "base64Binary http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* base64_binary_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* hex_binary_pskel<char>:: + _static_type () + { + return "hexBinary http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* hex_binary_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* gday_pskel<char>:: + _static_type () + { + return "gDay http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* gday_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* gmonth_pskel<char>:: + _static_type () + { + return "gMonth http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* gmonth_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* gyear_pskel<char>:: + _static_type () + { + return "gYear http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* gyear_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* gmonth_day_pskel<char>:: + _static_type () + { + return "gMonthDay http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* gmonth_day_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* gyear_month_pskel<char>:: + _static_type () + { + return "gYearMonth http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* gyear_month_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* date_pskel<char>:: + _static_type () + { + return "date http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* date_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* time_pskel<char>:: + _static_type () + { + return "time http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* time_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* date_time_pskel<char>:: + _static_type () + { + return "dateTime http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* date_time_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const char* duration_pskel<char>:: + _static_type () + { + return "duration http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const char* duration_pskel<char>:: + _dynamic_type () const + { + return _static_type (); + } + } + } + } +} + +#endif // XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_IXX_CHAR +#endif // XSD_CXX_PARSER_USE_CHAR + + +#if defined(XSD_CXX_PARSER_USE_WCHAR) || !defined(XSD_CXX_PARSER_USE_CHAR) + +#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_IXX_WCHAR +#define XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_IXX_WCHAR + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + template<> + inline const wchar_t* any_type_pskel<wchar_t>:: + _static_type () + { + return L"anyType http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* any_type_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* any_simple_type_pskel<wchar_t>:: + _static_type () + { + return L"anySimpleType http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* any_simple_type_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* boolean_pskel<wchar_t>:: + _static_type () + { + return L"boolean http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* boolean_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* byte_pskel<wchar_t>:: + _static_type () + { + return L"byte http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* byte_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* unsigned_byte_pskel<wchar_t>:: + _static_type () + { + return L"unsignedByte http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* unsigned_byte_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* short_pskel<wchar_t>:: + _static_type () + { + return L"short http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* short_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* unsigned_short_pskel<wchar_t>:: + _static_type () + { + return L"unsignedShort http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* unsigned_short_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* int_pskel<wchar_t>:: + _static_type () + { + return L"int http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* int_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* unsigned_int_pskel<wchar_t>:: + _static_type () + { + return L"unsignedInt http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* unsigned_int_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* long_pskel<wchar_t>:: + _static_type () + { + return L"long http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* long_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* unsigned_long_pskel<wchar_t>:: + _static_type () + { + return L"unsignedLong http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* unsigned_long_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* integer_pskel<wchar_t>:: + _static_type () + { + return L"integer http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* integer_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* negative_integer_pskel<wchar_t>:: + _static_type () + { + return L"negativeInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* negative_integer_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* non_positive_integer_pskel<wchar_t>:: + _static_type () + { + return L"nonPositiveInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* non_positive_integer_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* positive_integer_pskel<wchar_t>:: + _static_type () + { + return L"positiveInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* positive_integer_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* non_negative_integer_pskel<wchar_t>:: + _static_type () + { + return L"nonNegativeInteger http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* non_negative_integer_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* float_pskel<wchar_t>:: + _static_type () + { + return L"float http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* float_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* double_pskel<wchar_t>:: + _static_type () + { + return L"double http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* double_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* decimal_pskel<wchar_t>:: + _static_type () + { + return L"decimal http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* decimal_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* string_pskel<wchar_t>:: + _static_type () + { + return L"string http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* string_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* normalized_string_pskel<wchar_t>:: + _static_type () + { + return L"normalizedString http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* normalized_string_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* token_pskel<wchar_t>:: + _static_type () + { + return L"token http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* token_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* name_pskel<wchar_t>:: + _static_type () + { + return L"Name http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* name_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* nmtoken_pskel<wchar_t>:: + _static_type () + { + return L"NMTOKEN http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* nmtoken_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* nmtokens_pskel<wchar_t>:: + _static_type () + { + return L"NMTOKENS http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* nmtokens_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* ncname_pskel<wchar_t>:: + _static_type () + { + return L"NCName http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* ncname_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* id_pskel<wchar_t>:: + _static_type () + { + return L"ID http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* id_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* idref_pskel<wchar_t>:: + _static_type () + { + return L"IDREF http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* idref_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* idrefs_pskel<wchar_t>:: + _static_type () + { + return L"IDREFS http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* idrefs_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* language_pskel<wchar_t>:: + _static_type () + { + return L"language http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* language_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* uri_pskel<wchar_t>:: + _static_type () + { + return L"anyURI http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* uri_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* qname_pskel<wchar_t>:: + _static_type () + { + return L"QName http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* qname_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* base64_binary_pskel<wchar_t>:: + _static_type () + { + return L"base64Binary http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* base64_binary_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* hex_binary_pskel<wchar_t>:: + _static_type () + { + return L"hexBinary http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* hex_binary_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* gday_pskel<wchar_t>:: + _static_type () + { + return L"gDay http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* gday_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* gmonth_pskel<wchar_t>:: + _static_type () + { + return L"gMonth http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* gmonth_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* gyear_pskel<wchar_t>:: + _static_type () + { + return L"gYear http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* gyear_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* gmonth_day_pskel<wchar_t>:: + _static_type () + { + return L"gMonthDay http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* gmonth_day_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* gyear_month_pskel<wchar_t>:: + _static_type () + { + return L"gYearMonth http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* gyear_month_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* date_pskel<wchar_t>:: + _static_type () + { + return L"date http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* date_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* time_pskel<wchar_t>:: + _static_type () + { + return L"time http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* time_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* date_time_pskel<wchar_t>:: + _static_type () + { + return L"dateTime http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* date_time_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + + template<> + inline const wchar_t* duration_pskel<wchar_t>:: + _static_type () + { + return L"duration http://www.w3.org/2001/XMLSchema"; + } + + template<> + inline const wchar_t* duration_pskel<wchar_t>:: + _dynamic_type () const + { + return _static_type (); + } + } + } + } +} + +#endif // XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_IXX_WCHAR +#endif // XSD_CXX_PARSER_USE_WCHAR diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx new file mode 100644 index 0000000..b6352df --- /dev/null +++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx @@ -0,0 +1,69 @@ +// file : xsd/cxx/parser/non-validating/xml-schema-pskel.txx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + // any_type + // + + template <typename C> + bool any_type_pskel<C>:: + _start_element_impl (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>* type) + { + this->_start_any_element (ns, name, type); + this->complex_content<C>::context_.top ().any_ = true; + return true; + } + + template <typename C> + bool any_type_pskel<C>:: + _end_element_impl (const ro_string<C>& ns, const ro_string<C>& name) + { + this->complex_content<C>::context_.top ().any_ = false; + this->_end_any_element (ns, name); + return true; + } + + + template <typename C> + bool any_type_pskel<C>:: + _attribute_impl (const ro_string<C>& ns, + const ro_string<C>& name, + const ro_string<C>& value) + { + this->_any_attribute (ns, name, value); + return true; + } + + template <typename C> + bool any_type_pskel<C>:: + _characters_impl (const ro_string<C>& s) + { + this->_any_characters (s); + return true; + } + + // any_simple_type + // + + template <typename C> + bool any_simple_type_pskel<C>:: + _characters_impl (const ro_string<C>& s) + { + this->_any_characters (s); + return true; + } + } + } + } +} |