summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-13 21:28:21 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-13 21:28:21 +0100
commitb333d17308d935825a5da3c82276ff9f827dab18 (patch)
tree3d112aa1e260a3aa2df15055fdc002bad49995a9
parentCode for setting up an initial source from scratch (diff)
downloadmygrate-b333d17308d935825a5da3c82276ff9f827dab18.tar.bz2
mygrate-b333d17308d935825a5da3c82276ff9f827dab18.tar.xz
mygrate-b333d17308d935825a5da3c82276ff9f827dab18.zip
Add operator* to RecordSet, shorthand for getting scalar from 0,0
-rw-r--r--lib/dbRecordSet.cpp6
-rw-r--r--lib/dbRecordSet.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/dbRecordSet.cpp b/lib/dbRecordSet.cpp
index 66ade0e..3754130 100644
--- a/lib/dbRecordSet.cpp
+++ b/lib/dbRecordSet.cpp
@@ -14,4 +14,10 @@ namespace MyGrate {
{
return {this, row};
}
+
+ DbValue
+ RecordSet::operator*() const
+ {
+ return at(0, 0);
+ }
}
diff --git a/lib/dbRecordSet.h b/lib/dbRecordSet.h
index c84bb46..e430e58 100644
--- a/lib/dbRecordSet.h
+++ b/lib/dbRecordSet.h
@@ -38,6 +38,7 @@ namespace MyGrate {
virtual std::size_t columns() const = 0;
virtual DbValue at(std::size_t, std::size_t) const = 0;
RowView operator[](std::size_t row) const;
+ DbValue operator*() const;
};
using RecordSetPtr = std::unique_ptr<RecordSet>;
}