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 --- libxsde/xsde/cxx/hybrid/xdr/istream.hxx | 181 ++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 libxsde/xsde/cxx/hybrid/xdr/istream.hxx (limited to 'libxsde/xsde/cxx/hybrid/xdr/istream.hxx') diff --git a/libxsde/xsde/cxx/hybrid/xdr/istream.hxx b/libxsde/xsde/cxx/hybrid/xdr/istream.hxx new file mode 100644 index 0000000..559b136 --- /dev/null +++ b/libxsde/xsde/cxx/hybrid/xdr/istream.hxx @@ -0,0 +1,181 @@ +// file : xsde/cxx/hybrid/xdr/istream.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSDE_CXX_HYBRID_XDR_ISTREAM_HXX +#define XSDE_CXX_HYBRID_XDR_ISTREAM_HXX + +#include + +#include // size_t +#include + +#ifdef XSDE_STL +# include +#endif + +#include +#include + +#ifdef XSDE_STL +# include +# include +#else +# include +# include +#endif + +#include +#include + +#ifdef XSDE_EXCEPTIONS +# include +#endif + +namespace xsde +{ + namespace cxx + { + namespace hybrid + { + class ixdrstream + { + public: + explicit + ixdrstream (XDR& xdr); + + XDR& + impl (); + + public: + struct as_size + { + explicit as_size (size_t& s) : s_ (s) {} + size_t& s_; + }; + + public: +#ifdef XSDE_EXCEPTIONS + + void operator>> (bool&); + void operator>> (signed char&); + void operator>> (unsigned char&); + void operator>> (short&); + void operator>> (unsigned short&); + void operator>> (int&); + void operator>> (unsigned int&); + void operator>> (long&); + void operator>> (unsigned long&); + +#ifdef XSDE_LONGLONG + void operator>> (long long&); + void operator>> (unsigned long long&); +#endif + void operator>> (as_size&); + void operator>> (float&); + void operator>> (double&); + +#ifdef XSDE_STL + void operator>> (std::string&); +#else + void operator>> (char*&); +#endif + void operator>> (buffer&); + +#else // XSDE_EXCEPTIONS + + bool operator>> (bool&); + bool operator>> (signed char&); + bool operator>> (unsigned char&); + bool operator>> (short&); + bool operator>> (unsigned short&); + bool operator>> (int&); + bool operator>> (unsigned int&); + bool operator>> (long&); + bool operator>> (unsigned long&); + +#ifdef XSDE_LONGLONG + bool operator>> (long long&); + bool operator>> (unsigned long long&); +#endif + bool operator>> (as_size&); + bool operator>> (float&); + bool operator>> (double&); + +#ifdef XSDE_STL + bool operator>> (std::string&); +#else + bool operator>> (char*&); +#endif + bool operator>> (buffer&); + +#endif // XSDE_EXCEPTIONS + + private: + ixdrstream (const ixdrstream&); + ixdrstream& operator= (const ixdrstream&); + + private: + XDR& xdr_; + }; + +#ifdef XSDE_EXCEPTIONS + void operator>> (ixdrstream&, any_type&); + void operator>> (ixdrstream&, any_simple_type&); + void operator>> (ixdrstream&, qname&); + void operator>> (ixdrstream&, string_sequence&); + void operator>> (ixdrstream&, time_zone&); + void operator>> (ixdrstream&, date&); + void operator>> (ixdrstream&, date_time&); + void operator>> (ixdrstream&, duration&); + void operator>> (ixdrstream&, gday&); + void operator>> (ixdrstream&, gmonth&); + void operator>> (ixdrstream&, gmonth_day&); + void operator>> (ixdrstream&, gyear&); + void operator>> (ixdrstream&, gyear_month&); + void operator>> (ixdrstream&, time&); +#else + bool operator>> (ixdrstream&, any_type&); + bool operator>> (ixdrstream&, any_simple_type&); + bool operator>> (ixdrstream&, qname&); + bool operator>> (ixdrstream&, string_sequence&); + bool operator>> (ixdrstream&, time_zone&); + bool operator>> (ixdrstream&, date&); + bool operator>> (ixdrstream&, date_time&); + bool operator>> (ixdrstream&, duration&); + bool operator>> (ixdrstream&, gday&); + bool operator>> (ixdrstream&, gmonth&); + bool operator>> (ixdrstream&, gmonth_day&); + bool operator>> (ixdrstream&, gyear&); + bool operator>> (ixdrstream&, gyear_month&); + bool operator>> (ixdrstream&, time&); +#endif + +#ifdef XSDE_EXCEPTIONS + template + void operator>> (ixdrstream&, pod_seq&); + + template + void operator>> (ixdrstream&, fix_seq&); + + template + void operator>> (ixdrstream&, var_seq&); +#else + template + bool operator>> (ixdrstream&, pod_seq&); + + template + bool operator>> (ixdrstream&, fix_seq&); + + template + bool operator>> (ixdrstream&, var_seq&); +#endif + } + } +} + +#include +#include + +#endif // XSDE_CXX_HYBRID_XDR_ISTREAM_HXX -- cgit v1.1