blob: f94e0228acc1fa6dbc563c1e51d03cd46589d8e5 (
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
|
// file : xsde/cxx/hybrid/xdr/qname.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsde/cxx/hybrid/xdr/istream.hxx>
#include <xsde/cxx/hybrid/xdr/ostream.hxx>
namespace xsde
{
namespace cxx
{
namespace hybrid
{
#ifdef XSDE_EXCEPTIONS
void
operator<< (oxdrstream& s, const qname& x)
{
s << x.prefix ();
s << x.name ();
}
void
operator>> (ixdrstream& s, qname& x)
{
#ifdef XSDE_STL
std::string p, n;
#else
char* p;
char* n;
#endif
s >> p;
x.prefix (p);
s >> n; // x will free p in case extraction fails
x.name (n);
}
#else // XSDE_EXCEPTIONS
bool
operator<< (oxdrstream& s, const qname& x)
{
return s << x.prefix () && s << x.name ();
}
bool
operator>> (ixdrstream& s, qname& x)
{
#ifdef XSDE_STL
std::string p, n;
#else
char* p;
char* n;
#endif
if (!(s >> p))
return false;
x.prefix (p);
if (!(s >> n))
return false; // x will free p
x.name (n);
return true;
}
#endif // XSDE_EXCEPTIONS
}
}
}
|