diff options
Diffstat (limited to 'libxsd/xsd/cxx/tree/serialization')
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/boolean.hxx | 50 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/byte.hxx | 44 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/date-time.txx | 618 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/decimal.hxx | 124 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/double.hxx | 94 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/element-map.txx | 38 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/float.hxx | 92 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/int.hxx | 44 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/long.hxx | 44 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/short.hxx | 44 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx | 44 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx | 44 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx | 44 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx | 44 |
14 files changed, 0 insertions, 1368 deletions
diff --git a/libxsd/xsd/cxx/tree/serialization/boolean.hxx b/libxsd/xsd/cxx/tree/serialization/boolean.hxx deleted file mode 100644 index bd53f73..0000000 --- a/libxsd/xsd/cxx/tree/serialization/boolean.hxx +++ /dev/null @@ -1,50 +0,0 @@ -// file : xsd/cxx/tree/serialization/boolean.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX -#define XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, bool b) - { - std::basic_ostringstream<char> os; - os.setf (std::ios_base::boolalpha); - os << b; - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, bool b) - { - std::basic_ostringstream<char> os; - os.setf (std::ios_base::boolalpha); - os << b; - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, bool b) - { - // We don't need to restore the original bool format flag - // since items in the list are all of the same type. - // - ls.os_.setf (std::ios_base::boolalpha); - ls.os_ << b; - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/byte.hxx b/libxsd/xsd/cxx/tree/serialization/byte.hxx deleted file mode 100644 index f0e121e..0000000 --- a/libxsd/xsd/cxx/tree/serialization/byte.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/byte.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_BYTE_HXX -#define XSD_CXX_TREE_SERIALIZATION_BYTE_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, signed char c) - { - std::basic_ostringstream<char> os; - os << static_cast<short> (c); - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, signed char c) - { - std::basic_ostringstream<char> os; - os << static_cast<short> (c); - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, signed char c) - { - ls.os_ << static_cast<short> (c); - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_BYTE_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/date-time.txx b/libxsd/xsd/cxx/tree/serialization/date-time.txx deleted file mode 100644 index fe305a4..0000000 --- a/libxsd/xsd/cxx/tree/serialization/date-time.txx +++ /dev/null @@ -1,618 +0,0 @@ -// file : xsd/cxx/tree/serialization/date-time.txx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <locale> -#include <string> -#include <ostream> -#include <sstream> - -#include <xsd/cxx/tree/bits/literals.hxx> // bits::{gday_prefix,gmonth_prefix} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - // time_zone - // - namespace bits - { - // Assumes the fill character is set to '0'. - // - template <typename C> - void - zone_insert (std::basic_ostream<C>& os, const time_zone& z) - { - // time-zone := Z|(+|-)HH:MM - // - short h = z.zone_hours (); - short m = z.zone_minutes (); - - if (h == 0 && m == 0) - { - os << C ('Z'); - } - else - { - if (h < 0 || m < 0) - { - h = -h; - m = -m; - os << C ('-'); - } - else - os << C ('+'); - - if (h >= 0 && h <= 14 && m >= 0 && m <= 59) - { - os.width (2); - os << h << C (':'); - os.width (2); - os << m; - } - } - } - } - - // gday - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::gday<C, B>& x) - { - if (x.day () < 32) - { - // Save some time and space by not restoring the fill character - // since it is the same in case of a list. - // - os.fill (C ('0')); - os << bits::gday_prefix<C> (); - os.width (2); - os << x.day (); - - if (x.zone_present ()) - zone_insert (os, x); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const gday<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const gday<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const gday<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // gmonth - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::gmonth<C, B>& x) - { - if (x.month () < 13) - { - os.fill (C ('0')); - os << bits::gmonth_prefix<C> (); - os.width (2); - os << x.month (); - - if (x.zone_present ()) - zone_insert (os, x); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const gmonth<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const gmonth<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const gmonth<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // gyear - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::gyear<C, B>& x) - { - os.fill (C ('0')); - os.width (4); - os << x.year (); - - if (x.zone_present ()) - zone_insert (os, x); - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const gyear<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const gyear<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const gyear<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // gmonth_day - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::gmonth_day<C, B>& x) - { - if (x.month () < 13 && x.day () < 32) - { - os.fill (C ('0')); - os << bits::gmonth_prefix<C> (); - os.width (2); - os << x.month () << C ('-'); - os.width (2); - os << x.day (); - - if (x.zone_present ()) - zone_insert (os, x); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const gmonth_day<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const gmonth_day<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const gmonth_day<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // gyear_month - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::gyear_month<C, B>& x) - { - if (x.month () < 13) - { - os.fill (C ('0')); - os.width (4); - os << x.year () << C ('-'); - os.width (2); - os << x.month (); - - if (x.zone_present ()) - zone_insert (os, x); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const gyear_month<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const gyear_month<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const gyear_month<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // date - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::date<C, B>& x) - { - if (x.month () < 13 && x.day () < 32) - { - os.fill (C ('0')); - os.width (4); - os << x.year () << C ('-'); - os.width (2); - os << x.month () << C ('-'); - os.width (2); - os << x.day (); - - if (x.zone_present ()) - zone_insert (os, x); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const date<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const date<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const date<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // time - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::time<C, B>& x) - { - if (x.hours () <= 24 && - x.minutes () <= 59 && - x.seconds () >= 0.0 && - x.seconds () < 60.0) - { - os.fill (C ('0')); - os.width (2); - os << x.hours () << C (':'); - - os.width (2); - os << x.minutes () << C (':'); - - std::basic_ostringstream<C> ostr; - ostr.imbue (std::locale::classic ()); - ostr.width (9); - ostr.fill (C ('0')); - ostr << std::fixed << x.seconds (); - - std::basic_string<C> s (ostr.str ()); - - // Remove the trailing zeros and the decimal point if necessary. - // - typedef typename std::basic_string<C>::size_type size_type; - - size_type size (s.size ()), n (size); - - for (; n > 0 && s[n - 1] == C ('0'); --n)/*noop*/; - - if (n > 0 && s[n - 1] == C ('.')) - --n; - - if (n != size) - s.resize (n); - - os << s; - - if (x.zone_present ()) - zone_insert (os, x); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const time<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const time<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const time<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // date_time - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::date_time<C, B>& x) - { - if (x.month () <= 12 && - x.day () <= 31 && - x.hours () <= 24 && - x.minutes () <= 59 && - x.seconds () >= 0.0 && - x.seconds () < 60.0) - { - os.fill (C ('0')); - os.width (4); - os << x.year () << C ('-'); - - os.width (2); - os << x.month () << C ('-'); - - os.width (2); - os << x.day () << C ('T'); - - os.width (2); - os << x.hours () << C (':'); - - os.width (2); - os << x.minutes () << C (':'); - - std::basic_ostringstream<C> ostr; - ostr.imbue (std::locale::classic ()); - ostr.width (9); - ostr.fill (C ('0')); - ostr << std::fixed << x.seconds (); - - std::basic_string<C> s (ostr.str ()); - - // Remove the trailing zeros and the decimal point if necessary. - // - typedef typename std::basic_string<C>::size_type size_type; - - size_type size (s.size ()), n (size); - - for (; n > 0 && s[n - 1] == C ('0'); --n)/*noop*/; - - if (n > 0 && s[n - 1] == C ('.')) - --n; - - if (n != size) - s.resize (n); - - os << s; - - if (x.zone_present ()) - zone_insert (os, x); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const date_time<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const date_time<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const date_time<C, B>& x) - { - bits::insert (ls.os_, x); - } - - // duration - // - namespace bits - { - template <typename C, typename B> - void - insert (std::basic_ostream<C>& os, const tree::duration<C, B>& x) - { - if (x.negative ()) - os << C ('-'); - - os << C ('P'); - - // years - // - // In case it is 0-duration, use the years field to handle - // this case. - // - if (x.years () != 0 || - (x.months () == 0 && - x.days () == 0 && - x.hours () == 0 && - x.minutes () == 0 && - x.seconds () == 0.0)) - { - os << x.years () << C ('Y'); - } - - // months - // - if (x.months () != 0) - { - os << x.months () << C ('M'); - } - - // days - // - if (x.days () != 0) - { - os << x.days () << C ('D'); - } - - // Figure out if we need the 'T' delimiter. - // - if (x.hours () != 0 || - x.minutes () != 0 || - x.seconds () != 0.0) - os << C ('T'); - - // hours - // - if (x.hours () != 0) - { - os << x.hours () << C ('H'); - } - - // minutes - // - if (x.minutes () != 0) - { - os << x.minutes () << C ('M'); - } - - // seconds - // - if (x.seconds () > 0.0) - { - std::basic_ostringstream<C> ostr; - ostr.imbue (std::locale::classic ()); - ostr << std::fixed << x.seconds (); - - std::basic_string<C> s (ostr.str ()); - - // Remove the trailing zeros and the decimal point if necessary. - // - typedef typename std::basic_string<C>::size_type size_type; - - size_type size (s.size ()), n (size); - - for (; n > 0 && s[n - 1] == C ('0'); --n)/*noop*/; - - if (n > 0 && s[n - 1] == C ('.')) - --n; - - if (n != size) - s.resize (n); - - os << s << C ('S'); - } - } - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMElement& e, const duration<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - e << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (xercesc::DOMAttr& a, const duration<C, B>& x) - { - std::basic_ostringstream<C> os; - bits::insert (os, x); - a << os.str (); - } - - template <typename C, typename B> - inline void - operator<< (list_stream<C>& ls, const duration<C, B>& x) - { - bits::insert (ls.os_, x); - } - } - } -} diff --git a/libxsd/xsd/cxx/tree/serialization/decimal.hxx b/libxsd/xsd/cxx/tree/serialization/decimal.hxx deleted file mode 100644 index adfd167..0000000 --- a/libxsd/xsd/cxx/tree/serialization/decimal.hxx +++ /dev/null @@ -1,124 +0,0 @@ -// file : xsd/cxx/tree/serialization/decimal.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_DECIMAL_HXX -#define XSD_CXX_TREE_SERIALIZATION_DECIMAL_HXX - -#include <limits> // std::numeric_limits -#include <locale> -#include <sstream> - -namespace xsd -{ - namespace cxx - { - namespace tree - { - namespace bits - { - // The formula for the number of decimla digits required is given in: - // - // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf - // - template <typename C> - std::basic_string<C> - insert (const as_decimal<double>& d) - { - std::basic_ostringstream<C> os; - os.imbue (std::locale::classic ()); - std::streamsize prec; - - const facet* f = d.facets ? - facet::find (d.facets, facet::fraction_digits) : 0; - - if (f) - prec = static_cast<std::streamsize> (f->value); - else - { - // Precision. - // -#if defined (XSD_CXX_TREE_DECIMAL_PRECISION_MAX) - prec = 2 + std::numeric_limits<double>::digits * 301/1000; -#elif defined (XSD_CXX_TREE_DECIMAL_PRECISION) - prec = XSD_CXX_TREE_DECIMAL_PRECISION; -#else - prec = std::numeric_limits<double>::digits10; -#endif - } - - os.precision (prec); - os << std::fixed << d.x; - std::basic_string<C> r (os.str ()); - const C* cr (r.c_str ()); - - // Remove the trailing zeros and the decimal point if necessary. - // - typename std::basic_string<C>::size_type size (r.size ()), n (size); - - if (prec != 0) - { - for (; n > 0 && cr[n - 1] == '0'; --n)/*noop*/; - - if (n > 0 && cr[n - 1] == '.') - --n; - } - - // See if we have a restriction on total digits. - // - f = d.facets ? facet::find (d.facets, facet::total_digits) : 0; - - if (f && n > f->value) - { - // Point and sign do not count so figure out if we have them. - // - typename std::basic_string<C>::size_type extra ( - cr[0] == '-' ? 1 : 0); - - if (r.find ('.') < n) - extra++; - - // Unless we have a point and the size difference is one, - // remove some digits. - // - if ((n - extra) > f->value) - n -= (n - extra - f->value); - - if (n > 0 && cr[n - 1] == '.') - --n; - } - - if (n != size) - r.resize (n); - - return r; - } - } - - template <typename C> - inline void - operator<< (list_stream<C>& ls, const as_decimal<double>& d) - { - ls.os_ << bits::insert<C> (d); - } - } - } -} - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, - const xsd::cxx::tree::as_decimal<double>& d) - { - e << xsd::cxx::tree::bits::insert<char> (d); - } - - inline void - operator<< (xercesc::DOMAttr& a, - const xsd::cxx::tree::as_decimal<double>& d) - { - a << xsd::cxx::tree::bits::insert<char> (d); - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_DECIMAL_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/double.hxx b/libxsd/xsd/cxx/tree/serialization/double.hxx deleted file mode 100644 index 1375836..0000000 --- a/libxsd/xsd/cxx/tree/serialization/double.hxx +++ /dev/null @@ -1,94 +0,0 @@ -// file : xsd/cxx/tree/serialization/double.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_DOUBLE_HXX -#define XSD_CXX_TREE_SERIALIZATION_DOUBLE_HXX - -#include <limits> // std::numeric_limits -#include <locale> -#include <sstream> - -#include <xsd/cxx/tree/bits/literals.hxx> - -namespace xsd -{ - namespace cxx - { - namespace tree - { - namespace bits - { - // The formula for the number of decimla digits required is given in: - // - // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf - // - template <typename C> - std::basic_string<C> - insert (const as_double<double>& d) - { - std::basic_string<C> r; - - if (d.x == std::numeric_limits<double>::infinity ()) - r = bits::positive_inf<C> (); - else if (d.x == -std::numeric_limits<double>::infinity ()) - r = bits::negative_inf<C> (); - else if (!(d.x == d.x)) - r = bits::nan<C> (); - else - { - std::basic_ostringstream<C> os; - os.imbue (std::locale::classic ()); - - // Precision. - // -#if defined (XSD_CXX_TREE_DOUBLE_PRECISION_MAX) - os.precision (2 + std::numeric_limits<double>::digits * 301/1000); -#elif defined (XSD_CXX_TREE_DOUBLE_PRECISION) - os.precision (XSD_CXX_TREE_DOUBLE_PRECISION); -#else - os.precision (std::numeric_limits<double>::digits10); -#endif - // Format. - // -#if defined (XSD_CXX_TREE_DOUBLE_FIXED) - os << std::fixed << d.x; -#elif defined (XSD_CXX_TREE_DOUBLE_SCIENTIFIC) - os << std::scientific << d.x; -#else - os << d.x; -#endif - r = os.str (); - } - - return r; - } - } - - template <typename C> - inline void - operator<< (list_stream<C>& ls, const as_double<double>& d) - { - ls.os_ << bits::insert<C> (d); - } - } - } -} - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, - const xsd::cxx::tree::as_double<double>& d) - { - e << xsd::cxx::tree::bits::insert<char> (d); - } - - inline void - operator<< (xercesc::DOMAttr& a, - const xsd::cxx::tree::as_double<double>& d) - { - a << xsd::cxx::tree::bits::insert<char> (d); - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_DOUBLE_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/element-map.txx b/libxsd/xsd/cxx/tree/serialization/element-map.txx deleted file mode 100644 index a4c199e..0000000 --- a/libxsd/xsd/cxx/tree/serialization/element-map.txx +++ /dev/null @@ -1,38 +0,0 @@ -// file : xsd/cxx/tree/serialization/element-map.txx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_ELEMENT_MAP_TXX -#define XSD_CXX_TREE_SERIALIZATION_ELEMENT_MAP_TXX - -#include <xsd/cxx/tree/exceptions.hxx> - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C, typename T> - void element_map<C, T>:: - serialize (xercesc::DOMElement& e, const element_type& x) - { - const qualified_name n (x._name (), x._namespace ()); - typename map::const_iterator i (map_->find (n)); - - if (i != map_->end () && i->second.serializer_ != 0) - return (i->second.serializer_) (e, x); - else - throw no_element_info<C> (n.name (), n.namespace_ ()); - } - - template<typename T, typename C, typename B> - void - serializer_impl (xercesc::DOMElement& e, const element_type<C, B>& x) - { - e << static_cast<const T&> (x); - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_ELEMENT_MAP_TXX diff --git a/libxsd/xsd/cxx/tree/serialization/float.hxx b/libxsd/xsd/cxx/tree/serialization/float.hxx deleted file mode 100644 index ef935a3..0000000 --- a/libxsd/xsd/cxx/tree/serialization/float.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// file : xsd/cxx/tree/serialization/float.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_FLOAT_HXX -#define XSD_CXX_TREE_SERIALIZATION_FLOAT_HXX - -#include <limits> // std::numeric_limits -#include <locale> -#include <sstream> - -#include <xsd/cxx/tree/bits/literals.hxx> - -namespace xsd -{ - namespace cxx - { - namespace tree - { - namespace bits - { - // The formula for the number of decimla digits required is given in: - // - // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf - // - template <typename C> - std::basic_string<C> - insert (float f) - { - std::basic_string<C> r; - - if (f == std::numeric_limits<float>::infinity ()) - r = bits::positive_inf<C> (); - else if (f == -std::numeric_limits<float>::infinity ()) - r = bits::negative_inf<C> (); - else if (!(f == f)) - r = bits::nan<C> (); - else - { - std::basic_ostringstream<C> os; - os.imbue (std::locale::classic ()); - - // Precision. - // -#if defined (XSD_CXX_TREE_FLOAT_PRECISION_MAX) - os.precision (2 + std::numeric_limits<float>::digits * 301/1000); -#elif defined (XSD_CXX_TREE_FLOAT_PRECISION) - os.precision (XSD_CXX_TREE_FLOAT_PRECISION); -#else - os.precision (std::numeric_limits<float>::digits10); -#endif - // Format. - // -#if defined (XSD_CXX_TREE_FLOAT_FIXED) - os << std::fixed << f; -#elif defined (XSD_CXX_TREE_FLOAT_SCIENTIFIC) - os << std::scientific << f; -#else - os << f; -#endif - r = os.str (); - } - - return r; - } - } - - template <typename C> - inline void - operator<< (list_stream<C>& ls, float f) - { - ls.os_ << bits::insert<C> (f); - } - } - } -} - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, float f) - { - e << xsd::cxx::tree::bits::insert<char> (f); - } - - inline void - operator<< (xercesc::DOMAttr& a, float f) - { - a << xsd::cxx::tree::bits::insert<char> (f); - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_FLOAT_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/int.hxx b/libxsd/xsd/cxx/tree/serialization/int.hxx deleted file mode 100644 index a01c11a..0000000 --- a/libxsd/xsd/cxx/tree/serialization/int.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/int.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_INT_HXX -#define XSD_CXX_TREE_SERIALIZATION_INT_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, int i) - { - std::basic_ostringstream<char> os; - os << i; - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, int i) - { - std::basic_ostringstream<char> os; - os << i; - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, int i) - { - ls.os_ << i; - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_INT_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/long.hxx b/libxsd/xsd/cxx/tree/serialization/long.hxx deleted file mode 100644 index 5978e55..0000000 --- a/libxsd/xsd/cxx/tree/serialization/long.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/long.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_LONG_HXX -#define XSD_CXX_TREE_SERIALIZATION_LONG_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, long long l) - { - std::basic_ostringstream<char> os; - os << l; - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, long long l) - { - std::basic_ostringstream<char> os; - os << l; - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, long long l) - { - ls.os_ << l; - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_LONG_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/short.hxx b/libxsd/xsd/cxx/tree/serialization/short.hxx deleted file mode 100644 index d10f047..0000000 --- a/libxsd/xsd/cxx/tree/serialization/short.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/short.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_SHORT_HXX -#define XSD_CXX_TREE_SERIALIZATION_SHORT_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, short s) - { - std::basic_ostringstream<char> os; - os << s; - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, short s) - { - std::basic_ostringstream<char> os; - os << s; - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, short s) - { - ls.os_ << s; - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_SHORT_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx b/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx deleted file mode 100644 index 889a0de..0000000 --- a/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/unsigned-byte.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_BYTE_HXX -#define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_BYTE_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, unsigned char c) - { - std::basic_ostringstream<char> os; - os << static_cast<unsigned short> (c); - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, unsigned char c) - { - std::basic_ostringstream<char> os; - os << static_cast<unsigned short> (c); - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, unsigned char c) - { - ls.os_ << static_cast<unsigned short> (c); - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_BYTE_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx b/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx deleted file mode 100644 index eb34a1d..0000000 --- a/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/unsigned-int.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_INT_HXX -#define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_INT_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, unsigned int i) - { - std::basic_ostringstream<char> os; - os << i; - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, unsigned int i) - { - std::basic_ostringstream<char> os; - os << i; - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, unsigned int i) - { - ls.os_ << i; - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_INT_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx b/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx deleted file mode 100644 index 2c857da..0000000 --- a/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/unsigned-long.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_LONG_HXX -#define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_LONG_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, unsigned long long l) - { - std::basic_ostringstream<char> os; - os << l; - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, unsigned long long l) - { - std::basic_ostringstream<char> os; - os << l; - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, unsigned long long l) - { - ls.os_ << l; - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_LONG_HXX diff --git a/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx b/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx deleted file mode 100644 index 15dc743..0000000 --- a/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx +++ /dev/null @@ -1,44 +0,0 @@ -// file : xsd/cxx/tree/serialization/unsigned-short.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_SHORT_HXX -#define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_SHORT_HXX - -#include <sstream> - -namespace XERCES_CPP_NAMESPACE -{ - inline void - operator<< (xercesc::DOMElement& e, unsigned short s) - { - std::basic_ostringstream<char> os; - os << s; - e << os.str (); - } - - inline void - operator<< (xercesc::DOMAttr& a, unsigned short s) - { - std::basic_ostringstream<char> os; - os << s; - a << os.str (); - } -} - -namespace xsd -{ - namespace cxx - { - namespace tree - { - template <typename C> - inline void - operator<< (list_stream<C>& ls, unsigned short s) - { - ls.os_ << s; - } - } - } -} - -#endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_SHORT_HXX |