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

#include <libxml++/nodes/element.h>
#include <boost/shared_ptr.hpp>
#include <map>
#include "view.h"
#include "iterate.h"
#include "rowBase.h"
#include "fileStarGlibIoChannel.h"

class _FileRows : public RowBase {
	public:
		_FileRows(const xmlpp::Element * p);
		~_FileRows();

		void execute() const;
		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;

		typedef std::set<gunichar> CharSet;
		const Glib::ustring 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::shared_ptr<_FileRows> FileRows;

typedef _GenericView<_FileRows> _FileView;
typedef boost::shared_ptr<_FileView> FileView;
typedef std::map<std::string, FileView> FileViews;

typedef _GenericIterate<_FileRows> _FileIterate;
typedef boost::shared_ptr<_FileIterate> FileIterate;
typedef std::map<std::string, FileIterate> FileIterates;

#endif