aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/binary/custom/irawstream.ixx
blob: fa73d396c630e75823ba5fca72b032565a5cab98 (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/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) ? 1 : 0; // Suppress VC++ "forcing value" warning.
}

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&)
{
}