blob: 445eb366b626b3fd72820f8a7e0ff0325a04ea48 (
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
// file : xsde/cxx/serializer/elements.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <assert.h>
#include <xsde/cxx/serializer/elements.hxx>
namespace xsde
{
namespace cxx
{
namespace serializer
{
// serializer_base
//
serializer_base::
~serializer_base ()
{
}
void serializer_base::
_pre ()
{
#ifdef XSDE_REUSE_STYLE_TIEIN
if (impl_)
impl_->_pre ();
#endif
}
void serializer_base::
_serialize_attributes ()
{
}
void serializer_base::
_serialize_content ()
{
}
void serializer_base::
_post ()
{
#ifdef XSDE_REUSE_STYLE_TIEIN
if (impl_)
impl_->_post ();
#endif
}
void serializer_base::
post ()
{
#ifdef XSDE_REUSE_STYLE_TIEIN
if (impl_)
impl_->post ();
#endif
}
void serializer_base::
_pre_impl (context& c)
{
#ifdef XSDE_REUSE_STYLE_TIEIN
assert (parent_ == 0);
// Set the parent_ pointers in the tied-in implementations.
//
_set_parent_chain ();
#endif
++depth_;
context_ = &c;
_pre ();
}
void serializer_base::
_post_impl ()
{
#if defined(XSDE_SERIALIZER_VALIDATION) || !defined(XSDE_EXCEPTIONS)
if (!context_->error_type ())
#endif
_post ();
if (--depth_ == 0)
context_ = 0;
}
#ifdef XSDE_POLYMORPHIC
const char* serializer_base::
_dynamic_type () const
{
return 0;
}
#endif
void serializer_base::
_reset ()
{
#ifdef XSDE_REUSE_STYLE_TIEIN
if (impl_)
impl_->_reset ();
#endif
#ifndef XSDE_EXCEPTIONS
error_type_ = error_none;
#endif
context_ = 0;
depth_ = 0;
}
#if defined (XSDE_REUSE_STYLE_TIEIN) && !defined (XSDE_EXCEPTIONS)
const serializer_base* serializer_base::
_ultimate_impl () const
{
const serializer_base* s = impl_;
for (; s->impl_ != 0; s = s->impl_) /*noop*/;
return s;
}
#endif
}
}
}
|