From 8f214507614041a18c182c789f8c0610de03c200 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 1 Jul 2017 23:12:37 +0100 Subject: Rename types.* to avoid name clashes --- libdbpp/column.h | 2 +- libdbpp/command.h | 2 +- libdbpp/dbTypes.cpp | 21 +++++++++++++++++++++ libdbpp/dbTypes.h | 41 +++++++++++++++++++++++++++++++++++++++++ libdbpp/types.cpp | 21 --------------------- libdbpp/types.h | 41 ----------------------------------------- 6 files changed, 64 insertions(+), 64 deletions(-) create mode 100644 libdbpp/dbTypes.cpp create mode 100644 libdbpp/dbTypes.h delete mode 100644 libdbpp/types.cpp delete mode 100644 libdbpp/types.h diff --git a/libdbpp/column.h b/libdbpp/column.h index acfb2f3..cfe5ab5 100644 --- a/libdbpp/column.h +++ b/libdbpp/column.h @@ -7,7 +7,7 @@ #include #include #include -#include "types.h" +#include "dbTypes.h" #include "error.h" namespace DB { diff --git a/libdbpp/command.h b/libdbpp/command.h index e80a523..1647e50 100644 --- a/libdbpp/command.h +++ b/libdbpp/command.h @@ -8,7 +8,7 @@ #include #include #include -#include "types.h" +#include "dbTypes.h" #include "error.h" namespace DB { diff --git a/libdbpp/dbTypes.cpp b/libdbpp/dbTypes.cpp new file mode 100644 index 0000000..66e514a --- /dev/null +++ b/libdbpp/dbTypes.cpp @@ -0,0 +1,21 @@ +#include "dbTypes.h" +#include + +DB::Blob::Blob() : + data(nullptr), + len(0) +{ +} + +DB::Blob::Blob(const void * d, size_t l) : + data(d), + len(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/dbTypes.h b/libdbpp/dbTypes.h new file mode 100644 index 0000000..a75f0d3 --- /dev/null +++ b/libdbpp/dbTypes.h @@ -0,0 +1,41 @@ +#ifndef DB_TYPES_H +#define DB_TYPES_H + +#include +#include +#include + +namespace DB { + /// Wrapper class for reference an existing block of binary data. + class DLL_PUBLIC Blob { + public: + /// Construct a default blob pointing to no data. + Blob(); + /// Construct a reference using C-style pointer and length. + Blob(const void * data, size_t len); + /// Construct a reference using C++ template pointer to an object. + template + Blob(const T * t) : + data(t), + len(sizeof(T)) + { + } + /// Construct a reference using C++ vector pointer to a collection of objects. + template + Blob(const std::vector & v) : + data(&v.front()), + len(sizeof(T) * v.size()) + { + } + + bool operator==(const DB::Blob b) const; + + /// The beginning of the binary data. + const void * data; + /// The length of the binary data. + size_t len; + }; +} + +#endif + diff --git a/libdbpp/types.cpp b/libdbpp/types.cpp deleted file mode 100644 index 325a24c..0000000 --- a/libdbpp/types.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "types.h" -#include - -DB::Blob::Blob() : - data(nullptr), - len(0) -{ -} - -DB::Blob::Blob(const void * d, size_t l) : - data(d), - len(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 deleted file mode 100644 index a75f0d3..0000000 --- a/libdbpp/types.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef DB_TYPES_H -#define DB_TYPES_H - -#include -#include -#include - -namespace DB { - /// Wrapper class for reference an existing block of binary data. - class DLL_PUBLIC Blob { - public: - /// Construct a default blob pointing to no data. - Blob(); - /// Construct a reference using C-style pointer and length. - Blob(const void * data, size_t len); - /// Construct a reference using C++ template pointer to an object. - template - Blob(const T * t) : - data(t), - len(sizeof(T)) - { - } - /// Construct a reference using C++ vector pointer to a collection of objects. - template - Blob(const std::vector & v) : - data(&v.front()), - len(sizeof(T) * v.size()) - { - } - - bool operator==(const DB::Blob b) const; - - /// The beginning of the binary data. - const void * data; - /// The length of the binary data. - size_t len; - }; -} - -#endif - -- cgit v1.2.3