summaryrefslogtreecommitdiff
path: root/project2/xmlRows.h
blob: 3ab889e7829a79e0ab7ae0a4cc3434ef71615ce6 (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
#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::vector<std::string> Path;
		typedef std::map<Path, unsigned int> Interests;

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

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

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

	private:
		class XmlState : public RowState {
			public:
				XmlState(const XmlRows *);
				const Columns & getColumns() const;
				const XmlRows * rs;
		};

		Path root;
		Path trigger;
		Interests fields;
		bool anyInterestingAttributes;
		Columns fieldNames;
};

#endif