diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-18 18:48:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-01-13 22:32:43 +0300 |
commit | 2615896faa646e5830abf2c269150e1165c66515 (patch) | |
tree | 7d95978ec0a83094c9462ed4e1f59d42f4ff8ddb /libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx | |
parent | 7420f85ea19b0562ffdd8123442f32bc8bac1267 (diff) |
Switch to build2
Diffstat (limited to 'libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx')
-rw-r--r-- | libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx | 346 |
1 files changed, 0 insertions, 346 deletions
diff --git a/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx b/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx deleted file mode 100644 index 3da39d2..0000000 --- a/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx +++ /dev/null @@ -1,346 +0,0 @@ -// file : xsd/cxx/tree/ace-cdr-stream-extraction.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_TREE_ACE_CDR_STREAM_EXTRACTION_HXX -#define XSD_CXX_TREE_ACE_CDR_STREAM_EXTRACTION_HXX - -#include <cstddef> // std::size_t -#include <string> - -#include <ace/ACE.h> // ACE::strdelete -#include <ace/CDR_Stream.h> - -#include <xsd/cxx/config.hxx> // XSD_CXX11 - -#ifdef XSD_CXX11 -# include <memory> // std::unique_ptr -#else -# include <xsd/cxx/auto-array.hxx> -#endif - -#include <xsd/cxx/tree/buffer.hxx> -#include <xsd/cxx/tree/istream.hxx> -#include <xsd/cxx/tree/ace-cdr-stream-common.hxx> - -namespace xsd -{ - namespace cxx - { - namespace tree - { - struct ace_cdr_stream_extraction: ace_cdr_stream_operation - { - virtual const char* - what () const throw () - { - return "ACE CDR stream extraction operation failed"; - } - }; - - - // as_size - // - -#ifdef XSD_CXX_TREE_USE_64_BIT_SIZE - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_size<T>& x) - { - ACE_CDR::ULongLong r; - - if (!s.impl ().read_ulonglong (r) || - r > ~(T (0))) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } -#else - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_size<T>& x) - { - ACE_CDR::ULong r; - - if (!s.impl ().read_ulong (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } -#endif - - - // 8-bit - // - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_int8<T>& x) - { - ACE_CDR::Octet r; - - if (!s.impl ().read_octet (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_uint8<T>& x) - { - ACE_CDR::Octet r; - - if (!s.impl ().read_octet (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - - // 16-bit - // - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_int16<T>& x) - { - ACE_CDR::Short r; - - if (!s.impl ().read_short (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_uint16<T>& x) - { - ACE_CDR::UShort r; - - if (!s.impl ().read_ushort (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - - // 32-bit - // - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_int32<T>& x) - { - ACE_CDR::Long r; - - if (!s.impl ().read_long (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_uint32<T>& x) - { - ACE_CDR::ULong r; - - if (!s.impl ().read_ulong (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - - // 64-bit - // - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_int64<T>& x) - { - ACE_CDR::LongLong r; - - if (!s.impl ().read_longlong (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_uint64<T>& x) - { - ACE_CDR::ULongLong r; - - if (!s.impl ().read_ulonglong (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - - // Boolean - // - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_bool<T>& x) - { - ACE_CDR::Boolean r; - - if (!s.impl ().read_boolean (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - - // Floating-point - // - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_float32<T>& x) - { - ACE_CDR::Float r; - - if (!s.impl ().read_float (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - template <typename T> - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, - istream<ACE_InputCDR>::as_float64<T>& x) - { - ACE_CDR::Double r; - - if (!s.impl ().read_double (r)) - throw ace_cdr_stream_extraction (); - - x.x_ = static_cast<T> (r); - - return s; - } - - // Extraction of std::basic_string. - // - - namespace bits - { - template <typename C> - struct ace_str_deleter - { - void - operator() (C* s) const - { - ACE::strdelete (s); - } - }; - } - - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, std::basic_string<char>& x) - { - typedef bits::ace_str_deleter<char> deleter; - - deleter d; - char* r; - - if (!s.impl ().read_string (r)) - throw ace_cdr_stream_extraction (); - -#ifdef XSD_CXX11 - std::unique_ptr<char[], deleter&> ar ( -#else - auto_array<char, deleter> ar ( -#endif - r, d); - - x = r; - return s; - } - -#ifdef ACE_HAS_WCHAR - inline istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, std::basic_string<wchar_t>& x) - { - typedef bits::ace_str_deleter<wchar_t> deleter; - - deleter d; - wchar_t* r; - - if (!s.impl ().read_wstring (r)) - throw ace_cdr_stream_extraction (); - -#ifdef XSD_CXX11 - std::unique_ptr<wchar_t[], deleter&> ar ( -#else - auto_array<wchar_t, deleter> ar ( -#endif - r, d); - - x = r; - return s; - } -#endif - - - // Extraction of a binary buffer. - // - template <typename C> - istream<ACE_InputCDR>& - operator>> (istream<ACE_InputCDR>& s, buffer<C>& x) - { - ACE_CDR::ULong size; - - if (!s.impl ().read_ulong (size)) - throw ace_cdr_stream_extraction (); - - x.size (size); - - if (!s.impl ().read_octet_array ( - reinterpret_cast<ACE_CDR::Octet*> (x.data ()), size)) - throw ace_cdr_stream_extraction (); - - return s; - } - } - } -} - -#endif // XSD_CXX_TREE_ACE_CDR_STREAM_EXTRACTION_HXX |