aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/binary/custom/orawstream.ixx
blob: 62eaff4462287c1e1da6ef5b9cecc0f54e0ad81e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// 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&)
{
}