summaryrefslogtreecommitdiff
path: root/project2/xml/xslRows.h
blob: 9611ca479a8bedbcdab2166809bedbd8e0eb5102 (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
#ifndef XSLROWS_H
#define XSLROWS_H

#include <libxml++/nodes/element.h>
#include <libxml/tree.h>
#include <boost/intrusive_ptr.hpp>
#include <map>
#include "rowSet.h"
#include "variables.h"
#include "xslRowsCache.h"
#include "curlHelper.h"
#include "definedColumns.h"

/// Project2 component to create a row set based on the contents of an XML resource and specific XPaths with its hierarchy
class XslRows : public RowSet, XslRowsCache, VariableCurlHelper {
	public:
		XslRows(const xmlpp::Element * p);
		~XslRows();

		void execute(const Glib::ustring &, const RowProcessor *) const;
		virtual void loadComplete(const CommonObjects *);

		const bool html;
		const bool warnings;

	private:
		class FilterViewColumn : public Column {
			public:
				FilterViewColumn(unsigned int, const xmlpp::Element *);
				static FilterViewColumn * make(unsigned int, const xmlpp::Element *);
				const Variable path;
		};
		class FilterView : public DefinedColumns, public virtual IntrusivePtrBase {
			public:
				typedef std::map<const Glib::ustring, Variable> XPaths;

				FilterView(const xmlpp::Element * p);

				const Glib::ustring name;
				const Variable root;
		};
		typedef boost::intrusive_ptr<FilterView> FilterViewPtr;
		typedef boost::intrusive_ptr<const FilterView> FilterViewCPtr;
		typedef std::map<const Glib::ustring, FilterViewPtr> FilterViews;
		FilterViews fvs;

		virtual CurlPtr newCurl() const;
		virtual bool asHtml() const;
		virtual bool withWarnings() const;

		typedef std::map<const Glib::ustring, Glib::ustring> Namespaces;
		Namespaces namespaces;
		class XslState : public RowState {
			public:
				XslState(FilterViewCPtr);
				const Columns & getColumns() const;
			private:
				const FilterViewCPtr fv;
		};
		const Variable encoding;
};

#endif