blob: ec3db4a685ba00271b708cf8794f7da6112746b7 (
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
|
#include "dbRecordSet.h"
#include "helpers.h"
namespace MyGrate {
RowView::RowView(const RecordSet * rs, std::size_t rw) : recordSet {rs}, row {rw} { }
DbValue
RowView::operator[](std::size_t col) const
{
return recordSet->at(row, col);
}
bool
RowView::operator==(const RowView & that) const
{
verify<std::logic_error>(this->recordSet == that.recordSet, "Cannot iterator between RecordSets");
return this->row == that.row;
}
RowView &
RowView::operator++()
{
row++;
return *this;
}
const RowView &
RowView::operator*() const
{
return *this;
}
std::size_t
RowView::currentRow() const
{
return row;
}
RowView
RecordSet::operator[](std::size_t row) const
{
return RowView {this, row};
}
DbValue
RecordSet::operator*() const
{
return at(0, 0);
}
RowView
RecordSet::begin() const
{
return RowView {this, 0};
}
RowView
RecordSet::end() const
{
return RowView {this, rows()};
}
}
|