From 0bce70a0e483294b83b8bf9d5468838a63405612 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 8 Mar 2009 17:23:30 +0200 Subject: Add support for binary representations xsde/cxx/hybrid/insertion-*: insertion operators generator xsde/cxx/hybrid/extraction-*: extraction operators generator libxsde/xsde/cxx/hybrid/cdr/: CDR support code libxsde/xsde/cxx/hybrid/xdr/: XDR support code tests/cxx/hybrid/binary/: new tests examples/cxx/hybrid/binary/: new examples documentation/cxx/hybrid/guide/: new chapter --- examples/cxx/hybrid/binary/custom/orawstream.ixx | 110 +++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 examples/cxx/hybrid/binary/custom/orawstream.ixx (limited to 'examples/cxx/hybrid/binary/custom/orawstream.ixx') diff --git a/examples/cxx/hybrid/binary/custom/orawstream.ixx b/examples/cxx/hybrid/binary/custom/orawstream.ixx new file mode 100644 index 0000000..577eb1b --- /dev/null +++ b/examples/cxx/hybrid/binary/custom/orawstream.ixx @@ -0,0 +1,110 @@ +// file : examples/cxx/hybrid/binary/custom/orawstream.ixx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +inline orawstream:: +orawstream (xml_schema::buffer& buf) + : buf_ (buf) +{ +} + +inline void orawstream:: +operator<< (bool x) +{ + *align (1, 1) = x; +} + +inline void orawstream:: +operator<< (signed char x) +{ + *reinterpret_cast (align (1, 1)) = x; +} + +inline void orawstream:: +operator<< (unsigned char x) +{ + *reinterpret_cast (align (1, 1)) = x; +} + +inline void orawstream:: +operator<< (short x) +{ + *reinterpret_cast (align (2, 2)) = x; +} + +inline void orawstream:: +operator<< (unsigned short x) +{ + *reinterpret_cast (align (2, 2)) = x; +} + +inline void orawstream:: +operator<< (int x) +{ + *reinterpret_cast (align (4, 4)) = x; +} + +inline void orawstream:: +operator<< (unsigned int x) +{ + *reinterpret_cast (align (4, 4)) = x; +} + +inline void orawstream:: +operator<< (long x) +{ + *reinterpret_cast ( + align (sizeof (long), sizeof (long))) = x; +} + +inline void orawstream:: +operator<< (unsigned long x) +{ + *reinterpret_cast ( + align (sizeof (unsigned long), sizeof (unsigned long))) = x; +} + +#ifdef XSDE_LONGLONG +inline void orawstream:: +operator<< (long long x) +{ + *reinterpret_cast (align (8, 8)) = x; +} + +inline void orawstream:: +operator<< (unsigned long long x) +{ + *reinterpret_cast (align (8, 8)) = x; +} +#endif + +inline void orawstream:: +operator<< (as_size x) +{ + *reinterpret_cast ( + align (sizeof (size_t), sizeof (size_t))) = x.s_; +} + +inline void orawstream:: +operator<< (float x) +{ + *reinterpret_cast ( + align (sizeof (float), sizeof (float))) = x; +} + +inline void orawstream:: +operator<< (double x) +{ + *reinterpret_cast ( + align (sizeof (double), sizeof (double))) = x; +} + +inline void +operator<< (orawstream&, const xml_schema::any_type&) +{ +} + +inline void +operator<< (orawstream&, const xml_schema::any_simple_type&) +{ +} -- cgit v1.1