summaryrefslogtreecommitdiff
path: root/project2/console/consoleAppEngine.h
blob: d8cdca57438b31f3098c47d57784f4ee44f7507d (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
#ifndef CGIAPPENGINE_H
#define CGIAPPENGINE_H

#include "../appEngine.h"
#include "../task.h"
#include "../paramChecker.h"
#include "../presenter.h"
#include "../commonObjects.h"
#include "../view.h"
#include "../fileStrmVarWriter.h"
#include <boost/intrusive_ptr.hpp>
#include <boost/filesystem/path.hpp>
#include <libxml++/document.h>

class ConsoleEnvironment;

class ConsoleApplicationEngine : public ApplicationEngine, public Presenter {
	public:
		ConsoleApplicationEngine(const ConsoleEnvironment *, const boost::filesystem::path &);
		virtual ~ConsoleApplicationEngine();

		void process() const;
		const Environment * env() const;
		SessionPtr session() const;
		virtual Glib::ustring resolveCurrentConfig() const;
		virtual void addAppData(const Presenter * p) const;

	protected:
		const ConsoleEnvironment * _env;

	private:
		typedef std::map<Glib::ustring, const Glib::ustring> ConsolePlatforms;
		mutable ConsolePlatforms conplat;
		void loadEngineSection(const xmlpp::Element *) const;


		// Presenter interface
	public:
		void pushSub(const Glib::ustring & ns, const Glib::ustring & name) const;
		void addAttr(const Glib::ustring & name, const Glib::ustring & ns, const VariableType & value) const;
		void addField(const Glib::ustring & name, const Glib::ustring & ns, const VariableType & value) const;
		void setText(const VariableType & value) const;
		void popSub() const;
	private:
		mutable unsigned int indent;

		typedef Storage<ParamChecker>::Objects ParamCheckers;
		ParamCheckers parameterChecks;
		typedef Storage<NoOutputExecute>::Objects Tasks;
		Tasks tasks;
		typedef Storage<View>::Objects Views;
		Views views;
		SessionPtr runtime;
		FileStreamVariableWriter out;
};

#endif