diff options
Diffstat (limited to 'xsd/libxsd/xsd/cxx/tree/parsing')
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx | 76 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx | 80 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx | 702 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx | 85 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/double.hxx | 94 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx | 42 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/float.hxx | 94 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/int.hxx | 80 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/long.hxx | 80 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/short.hxx | 80 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx | 80 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx | 80 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx | 80 | ||||
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx | 80 |
14 files changed, 1733 insertions, 0 deletions
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx new file mode 100644 index 0000000..3dafdaa --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx @@ -0,0 +1,76 @@ +// file : xsd/cxx/tree/parsing/boolean.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_TREE_PARSING_BOOLEAN_HXX +#define XSD_CXX_TREE_PARSING_BOOLEAN_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content +#include <xsd/cxx/tree/bits/literals.hxx> + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<bool, C, schema_type::other> + { + typedef bool type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + bool traits<bool, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + bool traits<bool, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + bool traits<bool, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + return tmp == bits::true_<C> () || tmp == bits::one<C> (); + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_BOOLEAN_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx new file mode 100644 index 0000000..0a127c9 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/byte.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_TREE_PARSING_BYTE_HXX +#define XSD_CXX_TREE_PARSING_BYTE_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<signed char, C, schema_type::other> + { + typedef signed char type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + signed char traits<signed char, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + signed char traits<signed char, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + signed char traits<signed char, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + short t; + is >> t; + + return static_cast<type> (t); + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_BYTE_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx b/xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx new file mode 100644 index 0000000..913786c --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx @@ -0,0 +1,702 @@ +// file : xsd/cxx/tree/parsing/date-time.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 <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // time_zone + // + template <typename C> + void time_zone:: + zone_parse (const C* s, std::size_t n) + { + // time_zone := Z|(+|-)HH:MM + // + if (n == 0) + { + return; + } + else if (s[0] == C ('Z')) + { + hours_ = 0; + minutes_ = 0; + present_ = true; + } + else if (n == 6) + { + // Parse hours. + // + hours_ = 10 * (s[1] - C ('0')) + (s[2] - C ('0')); + + // Parse minutes. + // + minutes_ = 10 * (s[4] - C ('0')) + (s[5] - C ('0')); + + if (s[0] == C ('-')) + { + hours_ = -hours_; + minutes_ = -minutes_; + } + present_ = true; + } + } + + // gday + // + template <typename C, typename B> + gday<C, B>:: + gday (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + gday<C, B>:: + gday (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + gday<C, B>:: + gday (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void gday<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // gday := ---DD[Z|(+|-)HH:MM] + // + if (n >= 5) + { + day_ = 10 * (s[3] - C ('0')) + (s[4] - C ('0')); + + if (n > 5) + zone_parse (s + 5, n - 5); + } + } + + // gmonth + // + template <typename C, typename B> + gmonth<C, B>:: + gmonth (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + gmonth<C, B>:: + gmonth (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + gmonth<C, B>:: + gmonth (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void gmonth<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // gmonth := --MM[Z|(+|-)HH:MM] + // + if (n >= 4) + { + month_ = 10 * (s[2] - C ('0')) + (s[3] - C ('0')); + + if (n > 4) + zone_parse (s + 4, n - 4); + } + } + + // gyear + // + template <typename C, typename B> + gyear<C, B>:: + gyear (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + gyear<C, B>:: + gyear (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + gyear<C, B>:: + gyear (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void gyear<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // gyear := [-]CCYY[N]*[Z|(+|-)HH:MM] + // + if (n >= 4) + { + // Find the end of the year token. + // + size_type pos (4); + for (; pos < n; ++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 < n) + zone_parse (s + pos, n - pos); + } + } + + // gmonth_day + // + template <typename C, typename B> + gmonth_day<C, B>:: + gmonth_day (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + gmonth_day<C, B>:: + gmonth_day (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + gmonth_day<C, B>:: + gmonth_day (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void gmonth_day<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // gmonth_day := --MM-DD[Z|(+|-)HH:MM] + // + if (n >= 7) + { + month_ = 10 * (s[2] - C ('0')) + (s[3] - C ('0')); + day_ = 10 * (s[5] - C ('0')) + (s[6] - C ('0')); + + if (n > 7) + zone_parse (s + 7, n - 7); + } + } + + // gyear_month + // + template <typename C, typename B> + gyear_month<C, B>:: + gyear_month (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + gyear_month<C, B>:: + gyear_month (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + gyear_month<C, B>:: + gyear_month (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void gyear_month<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // gyear_month := [-]CCYY[N]*-MM[Z|(+|-)HH:MM] + // + + if (n >= 7) + { + // Find the end of the year token. + // + size_type pos (tmp.find (C ('-'), 4)); + + if (pos != ro_string<C>::npos && (n - pos - 1) >= 2) + { + ro_string<C> year_fragment (s, pos); + zc_istream<C> is (year_fragment); + is >> year_; + + month_ = 10 * (s[pos + 1] - C ('0')) + (s[pos + 2] - C ('0')); + + pos += 3; + + if (pos < n) + zone_parse (s + pos, n - pos); + } + } + } + + // date + // + template <typename C, typename B> + date<C, B>:: + date (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + date<C, B>:: + date (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + date<C, B>:: + date (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void date<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // date := [-]CCYY[N]*-MM-DD[Z|(+|-)HH:MM] + // + + if (n >= 10) + { + // Find the end of the year token. + // + size_type pos (tmp.find (C ('-'), 4)); + + if (pos != ro_string<C>::npos && (n - pos - 1) >= 5) + { + ro_string<C> year_fragment (s, pos); + zc_istream<C> is (year_fragment); + is >> year_; + + month_ = 10 * (s[pos + 1] - C ('0')) + (s[pos + 2] - C ('0')); + day_ = 10 * (s[pos + 4] - C ('0')) + (s[pos + 5] - C ('0')); + + pos += 6; + + if (pos < n) + zone_parse (s + pos, n - pos); + } + } + } + + // time + // + template <typename C, typename B> + time<C, B>:: + time (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + time<C, B>:: + time (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + time<C, B>:: + time (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void time<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // time := HH:MM:SS[.S+][Z|(+|-)HH:MM] + // + + if (n >= 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 < n; ++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> is (seconds_fragment); + is >> seconds_; + + if (pos < n) + zone_parse (s + pos, n - pos); + } + } + + // date_time + // + template <typename C, typename B> + date_time<C, B>:: + date_time (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + date_time<C, B>:: + date_time (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + date_time<C, B>:: + date_time (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (s); + } + + template <typename C, typename B> + void date_time<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // date_time := [-]CCYY[N]*-MM-DDTHH:MM:SS[.S+][Z|(+|-)HH:MM] + // + + if (n >= 19) + { + // Find the end of the year token. + // + size_type pos (tmp.find (C ('-'), 4)); + + if (pos != ro_string<C>::npos && (n - pos - 1) >= 14) + { + ro_string<C> year_fragment (s, pos); + zc_istream<C> yis (year_fragment); + yis >> year_; + + month_ = 10 * (s[pos + 1] - C ('0')) + (s[pos + 2] - C ('0')); + pos += 3; + + day_ = 10 * (s[pos + 1] - C ('0')) + (s[pos + 2] - C ('0')); + pos += 3; + + hours_ = 10 * (s[pos + 1] - C ('0')) + (s[pos + 2] - C ('0')); + pos += 3; + + minutes_ = 10 * (s[pos + 1] - C ('0')) + (s[pos + 2] - C ('0')); + pos += 4; // Point to the first S. + + // Find the end of the seconds fragment. + // + size_type sec_end (pos + 2); + for (; sec_end < n; ++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 < n) + zone_parse (s + sec_end, n - sec_end); + } + } + } + + // duration + // + template <typename C, typename B> + duration<C, B>:: + duration (const xercesc::DOMElement& e, flags f, container* c) + : B (e, f, c) + { + parse (text_content<C> (e)); + } + + template <typename C, typename B> + duration<C, B>:: + duration (const xercesc::DOMAttr& a, flags f, container* c) + : B (a, f, c) + { + parse (xml::transcode<C> (a.getValue ())); + } + + template <typename C, typename B> + duration<C, B>:: + duration (const std::basic_string<C>& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : B (s, e, f, c) + { + parse (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, typename B> + void duration<C, B>:: + parse (const std::basic_string<C>& str) + { + typedef typename ro_string<C>::size_type size_type; + + ro_string<C> tmp (str); + size_type n (trim (tmp)); + const C* s (tmp.data ()); + + // Set all the fields since some of them may not be specified. + // + years_ = months_ = days_ = hours_ = minutes_ = 0; + seconds_ = 0.0; + + // duration := [-]P[nY][nM][nD][TnHnMn[.n+]S] + // + if (n >= 3) + { + size_type pos (0); + + if (s[0] == C ('-')) + { + negative_ = true; + pos++; + } + else + negative_ = false; + + pos++; // Skip 'P'. + + size_type del (bits::duration_delim (s, pos, n)); + + if (del != n && 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, n); + } + + if (del != n && 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, n); + } + + if (del != n && 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, n); + } + + if (del != n && s[del] == C ('T')) + { + pos = del + 1; + del = bits::duration_delim (s, pos, n); + + if (del != n && 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, n); + } + + if (del != n && 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, n); + } + + if (del != n && s[del] == C ('S')) + { + ro_string<C> fragment (s + pos, del - pos); + zc_istream<C> is (fragment); + is >> seconds_; + } + } + } + } + } + } +} diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx new file mode 100644 index 0000000..636c0f5 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx @@ -0,0 +1,85 @@ +// file : xsd/cxx/tree/parsing/decimal.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_TREE_PARSING_DECIMAL_HXX +#define XSD_CXX_TREE_PARSING_DECIMAL_HXX + +#include <limits> +#include <locale> + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content +#include <xsd/cxx/tree/bits/literals.hxx> + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<double, C, schema_type::decimal> + { + typedef double type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + double traits<double, C, schema_type::decimal>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + double traits<double, C, schema_type::decimal>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + double traits<double, C, schema_type::decimal>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + is.imbue (std::locale::classic ()); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_DECIMAL_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/double.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/double.hxx new file mode 100644 index 0000000..1507ccf --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/double.hxx @@ -0,0 +1,94 @@ +// file : xsd/cxx/tree/parsing/double.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_TREE_PARSING_DOUBLE_HXX +#define XSD_CXX_TREE_PARSING_DOUBLE_HXX + +#include <limits> +#include <locale> + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content +#include <xsd/cxx/tree/bits/literals.hxx> + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<double, C, schema_type::double_> + { + typedef double type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + double traits<double, C, schema_type::double_>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + double traits<double, C, schema_type::double_>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + double traits<double, C, schema_type::double_>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + if (tmp == bits::positive_inf<C> ()) + return std::numeric_limits<double>::infinity (); + + if (tmp == bits::negative_inf<C> ()) + return -std::numeric_limits<double>::infinity (); + + if (tmp == bits::nan<C> ()) + return std::numeric_limits<double>::quiet_NaN (); + + zc_istream<C> is (tmp); + is.imbue (std::locale::classic ()); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_DOUBLE_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx b/xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx new file mode 100644 index 0000000..bb9a4c6 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx @@ -0,0 +1,42 @@ +// file : xsd/cxx/tree/parsing/element-map.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 + +#ifndef XSD_CXX_TREE_PARSING_ELEMENT_MAP_TXX +#define XSD_CXX_TREE_PARSING_ELEMENT_MAP_TXX + +#include <xsd/cxx/xml/dom/elements.hxx> + +#include <xsd/cxx/tree/exceptions.hxx> + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C, typename T> + std::auto_ptr<element_type<C, T> > element_map<C, T>:: + parse (const xercesc::DOMElement& e, flags f) + { + const qualified_name n (xml::dom::name<C> (e)); + typename map::const_iterator i (map_->find (n)); + + if (i != map_->end () && i->second.parser_ != 0) + return (i->second.parser_) (e, f); + else + throw no_element_info<C> (n.name (), n.namespace_ ()); + } + + template<typename T, typename C, typename B> + std::auto_ptr<element_type<C, B> > + parser_impl (const xercesc::DOMElement& e, flags f) + { + return std::auto_ptr<element_type<C, B> > (new T (e, f)); + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_ELEMENT_MAP_TXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/float.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/float.hxx new file mode 100644 index 0000000..3e34f93 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/float.hxx @@ -0,0 +1,94 @@ +// file : xsd/cxx/tree/parsing/float.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_TREE_PARSING_FLOAT_HXX +#define XSD_CXX_TREE_PARSING_FLOAT_HXX + +#include <limits> +#include <locale> + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content +#include <xsd/cxx/tree/bits/literals.hxx> + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<float, C, schema_type::other> + { + typedef float type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + float traits<float, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + float traits<float, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + float traits<float, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + if (tmp == bits::positive_inf<C> ()) + return std::numeric_limits<float>::infinity (); + + if (tmp == bits::negative_inf<C> ()) + return -std::numeric_limits<float>::infinity (); + + if (tmp == bits::nan<C> ()) + return std::numeric_limits<float>::quiet_NaN (); + + zc_istream<C> is (tmp); + is.imbue (std::locale::classic ()); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_FLOAT_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/int.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/int.hxx new file mode 100644 index 0000000..d996d3a --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/int.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/int.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_TREE_PARSING_INT_HXX +#define XSD_CXX_TREE_PARSING_INT_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<int, C, schema_type::other> + { + typedef int type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + int traits<int, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + int traits<int, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + int traits<int, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_INT_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/long.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/long.hxx new file mode 100644 index 0000000..742ade1 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/long.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/long.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_TREE_PARSING_LONG_HXX +#define XSD_CXX_TREE_PARSING_LONG_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<long long, C, schema_type::other> + { + typedef long long type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + long long traits<long long, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + long long traits<long long, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + long long traits<long long, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_LONG_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/short.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/short.hxx new file mode 100644 index 0000000..3a7ead8 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/short.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/short.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_TREE_PARSING_SHORT_HXX +#define XSD_CXX_TREE_PARSING_SHORT_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<short, C, schema_type::other> + { + typedef short type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + short traits<short, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + short traits<short, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + short traits<short, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_SHORT_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx new file mode 100644 index 0000000..ce336be --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/unsigned-byte.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_TREE_PARSING_UNSIGNED_BYTE_HXX +#define XSD_CXX_TREE_PARSING_UNSIGNED_BYTE_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<unsigned char, C, schema_type::other> + { + typedef unsigned char type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + unsigned char traits<unsigned char, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + unsigned char traits<unsigned char, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + unsigned char traits<unsigned char, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + unsigned short t; + is >> t; + + return static_cast<type> (t); + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_UNSIGNED_BYTE_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx new file mode 100644 index 0000000..e908dd0 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/unsigned-int.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_TREE_PARSING_UNSIGNED_INT_HXX +#define XSD_CXX_TREE_PARSING_UNSIGNED_INT_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<unsigned int, C, schema_type::other> + { + typedef unsigned int type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + unsigned int traits<unsigned int, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + unsigned int traits<unsigned int, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + unsigned int traits<unsigned int, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_UNSIGNED_INT_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx new file mode 100644 index 0000000..647b8dd --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/unsigned-long.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_TREE_PARSING_UNSIGNED_LONG_HXX +#define XSD_CXX_TREE_PARSING_UNSIGNED_LONG_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<unsigned long long, C, schema_type::other> + { + typedef unsigned long long type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + unsigned long long traits<unsigned long long, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + unsigned long long traits<unsigned long long, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + unsigned long long traits<unsigned long long, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_UNSIGNED_LONG_HXX diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx new file mode 100644 index 0000000..f53c724 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx @@ -0,0 +1,80 @@ +// file : xsd/cxx/tree/parsing/unsigned-short.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_TREE_PARSING_UNSIGNED_SHORT_HXX +#define XSD_CXX_TREE_PARSING_UNSIGNED_SHORT_HXX + +#include <xsd/cxx/ro-string.hxx> +#include <xsd/cxx/zc-istream.hxx> + +#include <xsd/cxx/xml/string.hxx> // xml::transcode + +#include <xsd/cxx/tree/text.hxx> // text_content + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template <typename C> + struct traits<unsigned short, C, schema_type::other> + { + typedef unsigned short type; + + static type + create (const xercesc::DOMElement& e, flags f, container* c); + + static type + create (const xercesc::DOMAttr& a, flags f, container* c); + + static type + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*); + }; + + template <typename C> + unsigned short traits<unsigned short, C, schema_type::other>:: + create (const xercesc::DOMElement& e, flags f, container* c) + { + return create (text_content<C> (e), 0, f, c); + } + + template <typename C> + unsigned short traits<unsigned short, C, schema_type::other>:: + create (const xercesc::DOMAttr& a, flags f, container* c) + { + return create (xml::transcode<C> (a.getValue ()), 0, f, c); + } + + template <typename C> + unsigned short traits<unsigned short, C, schema_type::other>:: + create (const std::basic_string<C>& s, + const xercesc::DOMElement*, + flags, + container*) + { + // This type cannot have whitespaces in its values. 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. + // + ro_string<C> tmp (s); + trim (tmp); + + zc_istream<C> is (tmp); + + type t; + is >> t; + + return t; + } + } + } +} + +#endif // XSD_CXX_TREE_PARSING_UNSIGNED_SHORT_HXX |