diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-08 17:23:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-08 17:23:30 +0200 |
commit | 0bce70a0e483294b83b8bf9d5468838a63405612 (patch) | |
tree | d11afb4998d6980435c15c4df6e40b1979531672 /examples/cxx/hybrid/binary/custom/irawstream.ixx | |
parent | 6c63b913179127e09ed7d9da8920493ccceec6ce (diff) |
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
Diffstat (limited to 'examples/cxx/hybrid/binary/custom/irawstream.ixx')
-rw-r--r-- | examples/cxx/hybrid/binary/custom/irawstream.ixx | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/binary/custom/irawstream.ixx b/examples/cxx/hybrid/binary/custom/irawstream.ixx new file mode 100644 index 0000000..bc9ff9a --- /dev/null +++ b/examples/cxx/hybrid/binary/custom/irawstream.ixx @@ -0,0 +1,110 @@ +// file : examples/cxx/hybrid/binary/custom/irawstream.ixx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +inline irawstream:: +irawstream (const xml_schema::buffer& buf, size_t start) + : buf_ (buf), pos_ (start) +{ +} + +inline void irawstream:: +operator>> (bool& x) +{ + x = *align (1, 1); +} + +inline void irawstream:: +operator>> (signed char& x) +{ + x = *reinterpret_cast<const signed char*> (align (1, 1)); +} + +inline void irawstream:: +operator>> (unsigned char& x) +{ + x = *reinterpret_cast<const unsigned char*> (align (1, 1)); +} + +inline void irawstream:: +operator>> (short& x) +{ + x = *reinterpret_cast<const short*> (align (2, 2)); +} + +inline void irawstream:: +operator>> (unsigned short& x) +{ + x = *reinterpret_cast<const unsigned short*> (align (2, 2)); +} + +inline void irawstream:: +operator>> (int& x) +{ + x = *reinterpret_cast<const int*> (align (4, 4)); +} + +inline void irawstream:: +operator>> (unsigned int& x) +{ + x = *reinterpret_cast<const unsigned int*> (align (4, 4)); +} + +inline void irawstream:: +operator>> (long& x) +{ + x = *reinterpret_cast<const long*> ( + align (sizeof (long), sizeof (long))); +} + +inline void irawstream:: +operator>> (unsigned long& x) +{ + x = *reinterpret_cast<const unsigned long*> ( + align (sizeof (unsigned long), sizeof (unsigned long))); +} + +#ifdef XSDE_LONGLONG +inline void irawstream:: +operator>> (long long& x) +{ + x = *reinterpret_cast<const long long*> (align (8, 8)); +} + +inline void irawstream:: +operator>> (unsigned long long& x) +{ + x = *reinterpret_cast<const unsigned long long*> (align (8, 8)); +} +#endif + +inline void irawstream:: +operator>> (as_size& x) +{ + x.s_ = *reinterpret_cast<const size_t*> ( + align (sizeof (size_t), sizeof (size_t))); +} + +inline void irawstream:: +operator>> (float& x) +{ + x = *reinterpret_cast<const float*> ( + align (sizeof (float), sizeof (float))); +} + +inline void irawstream:: +operator>> (double& x) +{ + x = *reinterpret_cast<const double*> ( + align (sizeof (double), sizeof (double))); +} + +inline void +operator>> (irawstream&, xml_schema::any_type&) +{ +} + +inline void +operator>> (irawstream&, xml_schema::any_simple_type&) +{ +} |