aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/binary/custom/orawstream.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-03-08 17:23:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-03-08 17:23:30 +0200
commit0bce70a0e483294b83b8bf9d5468838a63405612 (patch)
treed11afb4998d6980435c15c4df6e40b1979531672 /examples/cxx/hybrid/binary/custom/orawstream.ixx
parent6c63b913179127e09ed7d9da8920493ccceec6ce (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/orawstream.ixx')
-rw-r--r--examples/cxx/hybrid/binary/custom/orawstream.ixx110
1 files changed, 110 insertions, 0 deletions
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 <boris@codesynthesis.com>
+// 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<signed char*> (align (1, 1)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned char x)
+{
+ *reinterpret_cast<unsigned char*> (align (1, 1)) = x;
+}
+
+inline void orawstream::
+operator<< (short x)
+{
+ *reinterpret_cast<short*> (align (2, 2)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned short x)
+{
+ *reinterpret_cast<unsigned short*> (align (2, 2)) = x;
+}
+
+inline void orawstream::
+operator<< (int x)
+{
+ *reinterpret_cast<int*> (align (4, 4)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned int x)
+{
+ *reinterpret_cast<unsigned int*> (align (4, 4)) = x;
+}
+
+inline void orawstream::
+operator<< (long x)
+{
+ *reinterpret_cast<long*> (
+ align (sizeof (long), sizeof (long))) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned long x)
+{
+ *reinterpret_cast<unsigned long*> (
+ align (sizeof (unsigned long), sizeof (unsigned long))) = x;
+}
+
+#ifdef XSDE_LONGLONG
+inline void orawstream::
+operator<< (long long x)
+{
+ *reinterpret_cast<long long*> (align (8, 8)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned long long x)
+{
+ *reinterpret_cast<unsigned long long*> (align (8, 8)) = x;
+}
+#endif
+
+inline void orawstream::
+operator<< (as_size x)
+{
+ *reinterpret_cast<size_t*> (
+ align (sizeof (size_t), sizeof (size_t))) = x.s_;
+}
+
+inline void orawstream::
+operator<< (float x)
+{
+ *reinterpret_cast<float*> (
+ align (sizeof (float), sizeof (float))) = x;
+}
+
+inline void orawstream::
+operator<< (double x)
+{
+ *reinterpret_cast<double*> (
+ 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&)
+{
+}