summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 19:12:51 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 19:12:51 +0100
commit6dbf5aa3e3c96a159161a93b38579da2a179cfc2 (patch)
tree9fb3d5b831391582359830bc0c075fe7139b5fe6
parentTest extracted types can be default constructed (diff)
downloadlibdbpp-6dbf5aa3e3c96a159161a93b38579da2a179cfc2.tar.bz2
libdbpp-6dbf5aa3e3c96a159161a93b38579da2a179cfc2.tar.xz
libdbpp-6dbf5aa3e3c96a159161a93b38579da2a179cfc2.zip
Expose Blob operator==
-rw-r--r--libdbpp/testCore.cpp6
-rw-r--r--libdbpp/types.cpp7
-rw-r--r--libdbpp/types.h2
3 files changed, 9 insertions, 6 deletions
diff --git a/libdbpp/testCore.cpp b/libdbpp/testCore.cpp
index 3c71daa..890cb18 100644
--- a/libdbpp/testCore.cpp
+++ b/libdbpp/testCore.cpp
@@ -63,12 +63,6 @@ TestCore::assertColumnValueHelper(DB::SelectCommand & sel, unsigned int col, con
sel[col].apply(a);
}
-bool
-operator==(const DB::Blob a, const DB::Blob b)
-{
- return a.len == b.len && memcmp(a.data, b.data, a.len) == 0;
-}
-
AdHocFormatter(BlobDbg, "Blob[length=%?, addr=%?]");
std::ostream &
operator<<(std::ostream & s, const DB::Blob b)
diff --git a/libdbpp/types.cpp b/libdbpp/types.cpp
index 65e8598..325a24c 100644
--- a/libdbpp/types.cpp
+++ b/libdbpp/types.cpp
@@ -1,4 +1,5 @@
#include "types.h"
+#include <memory.h>
DB::Blob::Blob() :
data(nullptr),
@@ -12,3 +13,9 @@ DB::Blob::Blob(const void * d, size_t l) :
{
}
+bool
+DB::Blob::operator==(const DB::Blob b) const
+{
+ return this->len == b.len && memcmp(this->data, b.data, this->len) == 0;
+}
+
diff --git a/libdbpp/types.h b/libdbpp/types.h
index d42d0c0..a75f0d3 100644
--- a/libdbpp/types.h
+++ b/libdbpp/types.h
@@ -28,6 +28,8 @@ namespace DB {
{
}
+ bool operator==(const DB::Blob b) const;
+
/// The beginning of the binary data.
const void * data;
/// The length of the binary data.