blob: 6187f1265a8a88affe8fe5b3ff91e37d8a4f56d3 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#ifndef STREAMROWS_H
#define STREAMROWS_H
#include "rowSet.h"
#include "variables.h"
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
class StreamRows : public RowSet {
public:
StreamRows(const xmlpp::Element * p);
~StreamRows();
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;
protected:
void begin() const;
void pushChar(gunichar ch, const RowProcessor *) const;
void end(const RowProcessor *) const;
private:
void addColumn(Glib::ustring & rawtok) const;
class Column {
public:
Column(unsigned int idx, const Glib::ustring &);
Column(unsigned int idx, const xmlpp::Element * p);
void operator=(const VariableType &) const;
const unsigned int idx;
const Glib::ustring col;
mutable VariableType value;
const Variable defValue;
};
struct byColIdx {};
struct byColName {};
typedef boost::multi_index::multi_index_container<
Column,
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<
boost::multi_index::tag<byColName>, BOOST_MULTI_INDEX_MEMBER(Column, const Glib::ustring, col)>,
boost::multi_index::ordered_unique<
boost::multi_index::tag<byColIdx>, BOOST_MULTI_INDEX_MEMBER(Column, const unsigned int, idx)>
> > Columns;
mutable Columns columns;
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;
// Used in callback
mutable size_t skipheader;
mutable bool mkCols;
mutable bool inQuotes;
mutable bool prevWasQuote;
typedef boost::shared_ptr<Glib::ustring> StringPtr;
mutable StringPtr tok;
mutable Columns::index<byColIdx>::type::iterator curCol;
};
#endif
|