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
|
#ifndef PRESENTER_H
#define PRESENTER_H
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <glibmm/ustring.h>
#include <libxml++/parsers/domparser.h>
#include "view.h"
#include "paramChecker.h"
#include "commonObjects.h"
class Presenter : public CommonObjects, public virtual IntrusivePtrBase {
public:
Presenter(const std::string & group, const std::string & file);
virtual ~Presenter() = 0;
virtual void pushSub(const Glib::ustring & name) const;
virtual void pushSub(const Glib::ustring & name, const Glib::ustring & ns) const = 0;
virtual void addAttr(const Glib::ustring & name, const Glib::ustring & value) const;
virtual void addAttr(const Glib::ustring & name, const Glib::ustring & ns, const Glib::ustring & value) const;
virtual void addField(const Glib::ustring & name, const Glib::ustring & value) const;
virtual void addField(const Glib::ustring & name, const Glib::ustring & ns, const Glib::ustring & value) const;
virtual void setText(const Glib::ustring & value) const = 0;
virtual void popSub() const = 0;
void execute() const;
protected:
Views views;
OrderedParamCheckers parameterChecks;
xmlpp::DomParser present;
};
typedef boost::intrusive_ptr<const Presenter> PresenterCPtr;
typedef boost::intrusive_ptr<Presenter> PresenterPtr;
class XmlPresenter : public Presenter {
public:
typedef boost::shared_ptr<xmlpp::Document> XmlDocumentPtr;
XmlPresenter(const std::string & group, const std::string & file);
~XmlPresenter();
void pushSub(const Glib::ustring & name, const Glib::ustring & ns) const;
void addAttr(const Glib::ustring & name, const Glib::ustring & ns, const Glib::ustring & value) const;
void setText(const Glib::ustring & value) const;
void popSub() const;
virtual XmlDocumentPtr getDataDocument() const;
const Glib::ustring responseRootNodeName;
const Glib::ustring responseStyle;
const Glib::ustring contentType;
private:
XmlDocumentPtr responseDoc;
mutable std::vector<xmlpp::Element *> nodeStack;
};
typedef boost::intrusive_ptr<XmlPresenter> XmlPresenterPtr;
#endif
|