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
|
// file : examples/cxx/tree/custom/wildcard/wildcard-custom.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : not copyrighted - public domain
#include <ostream>
// Include wildcard.hxx instead of wildcard-custom.hxx here.
//
#include "wildcard.hxx"
namespace wildcard
{
data::
data (const xml_schema::string& d)
: data_base (d), scope_present_ (false)
{
}
data::
data (const xercesc::DOMElement& e,
xml_schema::flags f,
xml_schema::container* c)
: data_base (e, f, c), scope_present_ (false)
{
// Check if we've got the scope attribute.
//
namespace xml = xsd::cxx::xml;
xml::string name ("scope");
if (e.hasAttribute (name.c_str ()))
{
scope (xml::transcode<char> (e.getAttribute (name.c_str ())));
}
}
data::
data (const data& d,
xml_schema::flags f,
xml_schema::container* c)
: data_base (d, f, c),
scope_present_ (d.scope_present_),
scope_ (d.scope_)
{
}
data* data::
_clone (xml_schema::flags f, xml_schema::container* c) const
{
return new data (*this, f, c);
}
void
operator<< (xercesc::DOMElement& e, const data& x)
{
// Use our base to serialize data and id.
//
const data_base& b (x);
e << b;
// Add the scope attribute if present.
//
if (x.scope_present ())
{
namespace xml = xsd::cxx::xml;
xml::string name ("scope");
xml::string value (x.scope ());
e.setAttribute (name.c_str (), value.c_str ());
}
}
std::ostream&
operator<< (std::ostream& os, const data& x)
{
// Use our base to print date and id.
//
const data_base& b (x);
os << b;
if (x.scope_present ())
os << std::endl << "scope: " << x.scope ();
return os;
}
}
|