summaryrefslogtreecommitdiff
path: root/project2/fileRows.h
blob: 1a4b7ed8605507631cb45ecdead13d184909300c (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
#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 "rowSet.h"
#include "fileStarGlibIoChannel.h"

class CommonObjects;

class FileRows : public RowSet {
	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;
		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;

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

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

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

#endif