blob: cc95de96142a364abf725160e0a4b24a29bd7648 (
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
|
// file : examples/cxx/hybrid/binary/custom/orawostream.txx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : not copyrighted - public domain
#include <string.h> // memcpy
template <typename T>
void
operator<< (orawstream& s, const xml_schema::pod_sequence<T>& x)
{
size_t n = x.size ();
s << orawstream::as_size (x.size ());
if (n != 0)
{
size_t mn = sizeof (T) * n;
char* p = s.align (sizeof (T), mn);
memcpy (p, x.begin (), mn);
}
}
template <typename T>
void
operator<< (orawstream& s, const xml_schema::fix_sequence<T>& x)
{
s << orawstream::as_size (x.size ());
for (typename xml_schema::fix_sequence<T>::const_iterator i = x.begin ();
i != x.end (); ++i)
{
s << *i;
}
}
template <typename T>
void
operator<< (orawstream& s, const xml_schema::var_sequence<T>& x)
{
s << orawstream::as_size (x.size ());
for (typename xml_schema::var_sequence<T>::const_iterator i = x.begin ();
i != x.end (); ++i)
{
s << *i;
}
}
|