summaryrefslogtreecommitdiff
path: root/project2/fileRows.h
blob: 899205c05256fa17213e55a0dfc2ca489e0d68b4 (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 "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;
};
typedef boost::intrusive_ptr<_FileRows> FileRows;

#endif