summaryrefslogtreecommitdiff
path: root/lib/dbRecordSet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dbRecordSet.cpp')
-rw-r--r--lib/dbRecordSet.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/dbRecordSet.cpp b/lib/dbRecordSet.cpp
index 3754130..d5e55f0 100644
--- a/lib/dbRecordSet.cpp
+++ b/lib/dbRecordSet.cpp
@@ -1,4 +1,5 @@
#include "dbRecordSet.h"
+#include "helpers.h"
namespace MyGrate {
RowView::RowView(const RecordSet * rs, std::size_t rw) : recordSet {rs}, row {rw} { }
@@ -9,6 +10,32 @@ namespace MyGrate {
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
{
@@ -20,4 +47,16 @@ namespace MyGrate {
{
return at(0, 0);
}
+
+ RowView
+ RecordSet::begin() const
+ {
+ return {this, 0};
+ }
+
+ RowView
+ RecordSet::end() const
+ {
+ return {this, rows()};
+ }
}