summaryrefslogtreecommitdiff
path: root/project2/xmlRows.h
blob: 8b19e9ae29ac618d119fbdb86d9d534b0284dd8c (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
#ifndef XMLITERATE_H
#define XMLITERATE_H

#include <libxml++/nodes/element.h>
#include <boost/intrusive_ptr.hpp>
#include <map>
#include "iterate.h"
#include "view.h"

class ApplicationEngine;

class _XmlRows : public PerRowValues {
	public:
		typedef std::map<Glib::ustring, Glib::ustring> Values;
		typedef std::vector<std::string> Path;
		typedef std::map<Path, Glib::ustring> Interests;

		_XmlRows(const xmlpp::Element * p);
		~_XmlRows();

		void execute() const;
		virtual void loadComplete();
		unsigned int columnCount() const;
		const Glib::ustring & getColumnName(unsigned int col) const;
		const Glib::ustring & getCurrentValue(const Glib::ustring & id) const;
		const Glib::ustring & getCurrentValue(unsigned int col) const;
		bool isNull(unsigned int col) const;
		virtual void rowReady() const = 0;

		const Glib::ustring recordRoot;
		const Glib::ustring recordTrigger;
		const std::string filename;

	private:
		mutable Values values;

		Path root;
		Path trigger;
		Interests fields;
		bool anyInterestingAttributes;
		std::vector<Glib::ustring> fieldNames;
};
typedef boost::intrusive_ptr<_XmlRows> XmlRows;

typedef _GenericView<_XmlRows> _XmlView;
typedef boost::intrusive_ptr<_XmlView> XmlView;
typedef std::map<std::string, XmlView> XmlViews;

typedef _GenericIterate<_XmlRows> _XmlIterate;
typedef boost::intrusive_ptr<_XmlIterate> XmlIterate;
typedef std::map<std::string, XmlIterate> XmlIterates;

#endif