diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:46 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:46 +0100 |
commit | 372a0e99c2f61543d9e14d9933b59d9d1f4cb26e (patch) | |
tree | bbadf39aed0610c8f8f7b41fefff47773b8ac205 /xsd/examples/cxx/tree/custom/double/double-custom.cxx | |
parent | 23d41842168ac1a1580111b9c5c73500ceee3d57 (diff) | |
parent | 4538829ab86b5a1cd4e845e7eab165029c9d6d46 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'xsd/examples/cxx/tree/custom/double/double-custom.cxx')
-rw-r--r-- | xsd/examples/cxx/tree/custom/double/double-custom.cxx | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/xsd/examples/cxx/tree/custom/double/double-custom.cxx b/xsd/examples/cxx/tree/custom/double/double-custom.cxx deleted file mode 100644 index 6aad908..0000000 --- a/xsd/examples/cxx/tree/custom/double/double-custom.cxx +++ /dev/null @@ -1,96 +0,0 @@ -// file : examples/cxx/tree/custom/double/double-custom.cxx -// copyright : not copyrighted - public domain - -// Include xml-schema.hxx instead of double-custom.hxx here. -// -#include "xml-schema.hxx" - -#include <limits> -#include <locale> -#include <sstream> - -#include <xsd/cxx/ro-string.hxx> -#include <xsd/cxx/zc-istream.hxx> - -using namespace std; - -// Parsing. -// -namespace xsd -{ - namespace cxx - { - namespace tree - { - double traits<double, char, schema_type::double_>:: - create (const std::string& s, - const xercesc::DOMElement*, - flags, - type*) - { - // 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<char> tmp (s); - trim (tmp); - - zc_istream<char> is (tmp); - is.imbue (locale::classic ()); - - double t; - is >> t; - - return t; - } - } - } -} - -// Serialization. -// -namespace XERCES_CPP_NAMESPACE -{ - void - operator<< (xercesc::DOMElement& e, const xml_schema::as_double& d) - { - ostringstream os; - os.imbue (locale::classic ()); - - os.precision (2); - os << fixed << d.x; - - e << os.str (); - } - - void - operator<< (xercesc::DOMAttr& a, const xml_schema::as_double& d) - { - ostringstream os; - os.imbue (locale::classic ()); - - os.precision (2); - os << fixed << d.x; - - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - void - operator<< (xml_schema::list_stream& ls, - const xml_schema::as_double& d) - { - ls.os_.imbue (locale::classic ()); - ls.os_.precision (2); - ls.os_ << fixed << d.x; - } - } - } -} |