summaryrefslogtreecommitdiff
path: root/project2/fileRows.h
blob: ec937addab1be2eb17223a4b6ed0d9bfdc6b7f65 (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
#ifndef FILEROWS_H
#define FILEROWS_H

#include <libxml++/nodes/element.h>
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <map>
#include "variables.h"
#include "perRowValues.h"
#include "fileStarGlibIoChannel.h"

class CommonObjects;

class FileRows : public PerRowValues {
	public:
		FileRows(const xmlpp::Element * p);
		~FileRows();

		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;
		const Glib::ustring & getCurrentValue(const Glib::ustring & id) const;
		const Glib::ustring & getCurrentValue(unsigned int col) const;
		bool isNull(unsigned int col) const;
		bool isNull(const Glib::ustring & id) const;

		typedef std::set<gunichar> CharSet;
		const Variable path;

	protected:
		virtual FileStarChannel doOpen() const;
		void addColumn(const Glib::ustring & rawtok) const;
		typedef boost::shared_ptr<Glib::ustring> ValPtr;
		typedef std::vector<ValPtr> Values;
		mutable Values values;

	private:
		gunichar fieldSep;
		gunichar quoteChar;
		std::string newline;
		std::string encoding;
		typedef std::vector<Glib::ustring> Columns;
		mutable Columns columns;
};

#endif