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
|
#include "viewHost.h"
#include "xmlPresenter.h"
#include <boost/foreach.hpp>
#include <iostream>
#define FOREACH_PRESENTER BOOST_FOREACH (const PresenterPtr & p, presenters)
ViewHost::ViewHost(const std::string & group, const std::string & name) :
XmlScriptParser(group, name, false),
CheckHost(group, name)
{
loader.supportedStorers.insert(Storer::into(&views));
loader.supportedStorers.insert(Storer::into(&pmp.presenters));
}
ViewHost::ViewHost(const std::string & file) :
XmlScriptParser(file, false),
CheckHost(file)
{
loader.supportedStorers.insert(Storer::into(&views));
loader.supportedStorers.insert(Storer::into(&pmp.presenters));
}
ViewHost::~ViewHost()
{
}
void
ViewHost::executeViews(const DefaultPresenterProvider & dpp) const
{
parseDocument();
if (pmp.presenters.empty()) {
pmp.presenters.insert(dpp(get_document()->get_root_node()));
}
BOOST_FOREACH(const Views::value_type & s, views) {
s->execute(&pmp);
}
}
void
ViewHost::doTransforms() const
{
BOOST_FOREACH (const PresenterPtr & p, pmp.presenters) {
TransformSourcePtr ts = boost::dynamic_pointer_cast<TransformSource>(p);
if (ts) {
ts->doTransforms();
}
}
}
PresenterPtr
ViewHost::headPresenter() const
{
return *pmp.presenters.begin();
}
void
ViewHost::PresenterMultiplexer::declareNamespace(const Glib::ustring & prefix, const Glib::ustring & ns) const
{
FOREACH_PRESENTER { p->declareNamespace(prefix, ns); }
}
void
ViewHost::PresenterMultiplexer::setNamespace(const Glib::ustring & prefix, const Glib::ustring & ns) const
{
FOREACH_PRESENTER { p->setNamespace(prefix, ns); }
}
void
ViewHost::PresenterMultiplexer::pushSub(const Glib::ustring & name) const
{
FOREACH_PRESENTER { p->pushSub(name); }
}
void
ViewHost::PresenterMultiplexer::pushSub(const Glib::ustring & name, const Glib::ustring & ns) const
{
FOREACH_PRESENTER { p->pushSub(name, ns); }
}
void
ViewHost::PresenterMultiplexer::addAttr(const Glib::ustring & name, const VariableType & value) const
{
FOREACH_PRESENTER { p->addAttr(name, value); }
}
void
ViewHost::PresenterMultiplexer::addAttr(const Glib::ustring & name, const Glib::ustring & ns, const VariableType & value) const
{
FOREACH_PRESENTER { p->addAttr(name, ns, value); }
}
void
ViewHost::PresenterMultiplexer::addField(const Glib::ustring & name, const VariableType & value) const
{
FOREACH_PRESENTER { p->addField(name, value); }
}
void
ViewHost::PresenterMultiplexer::addField(const Glib::ustring & name, const Glib::ustring & ns, const VariableType & value) const
{
FOREACH_PRESENTER { p->addField(name, ns, value); }
}
void
ViewHost::PresenterMultiplexer::addText(const VariableType & value) const
{
FOREACH_PRESENTER { p->addText(value); }
}
void
ViewHost::PresenterMultiplexer::popSub() const
{
FOREACH_PRESENTER { p->popSub(); }
}
|