From 6dbf5aa3e3c96a159161a93b38579da2a179cfc2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 5 Jun 2017 19:12:51 +0100 Subject: Expose Blob operator== --- libdbpp/testCore.cpp | 6 ------ libdbpp/types.cpp | 7 +++++++ libdbpp/types.h | 2 ++ 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 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. -- cgit v1.2.3