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

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

/// Project2 component to create a row set based on the contents of an XML file
class XmlRows : public RowSet {
	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 RowProcessor *) const;
		virtual void loadComplete(const CommonObjects *);
		virtual void setFilter(const Glib::ustring &);
		unsigned int columnCount() const;
		const Glib::ustring & getColumnName(unsigned int col) const;
		VariableType getCurrentValue(const Glib::ustring & id) const;
		VariableType getCurrentValue(unsigned int col) const;
		bool isNull(unsigned int col) const;
		bool isNull(const Glib::ustring & id) const;

		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;
};

#endif