summaryrefslogtreecommitdiff
path: root/project2/files/streamRows.h
blob: 95d81310bd2bd29c576094b487137deb59b23bcb (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
#ifndef STREAMROWS_H
#define STREAMROWS_H

#include "variables.h"
#include "definedColumns.h"

class RowProcessor;

/// Base class for Project2 components that create a row set based on the contents of a byte stream
class StreamRows : public DefinedColumns, public RowSet {
	public:
		StreamRows(ScriptNodePtr p);
		~StreamRows();

	protected:
		class ParseState : public ColumnValues {
			public:
				ParseState(const StreamRows *, const RowProcessor *);
				~ParseState();

				const StreamRows * sr;
				const RowProcessor * rp;
				size_t skipheader;
				bool inQuotes;
				bool prevWasQuote;
				Glib::ustring tok;
				FieldValues::iterator curCol;

				friend class StreamRows;
		};
		void pushChar(gunichar ch, ParseState &) const;
		void end(ParseState &) const;

	public:
		const gunichar fieldSep;
		const gunichar quoteChar;
		const bool keepBlankRows;
		const bool countBlankRows;
		const Glib::ustring newline;
		const Glib::ustring newlin;
		const std::string encoding;
		const size_t skipheader;
};

#endif