diff options
Diffstat (limited to 'libxsd/xsd/cxx/tree/parsing/double.hxx')
-rw-r--r-- | libxsd/xsd/cxx/tree/parsing/double.hxx | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/libxsd/xsd/cxx/tree/parsing/double.hxx b/libxsd/xsd/cxx/tree/parsing/double.hxx deleted file mode 100644 index 7e1a7cc..0000000 --- a/libxsd/xsd/cxx/tree/parsing/double.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// file : xsd/cxx/tree/parsing/double.hxx -// 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 (tree::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 |