diff options
Diffstat (limited to 'sqlite')
-rw-r--r-- | sqlite/types/test.hxx | 79 | ||||
-rw-r--r-- | sqlite/types/traits.hxx | 2 |
2 files changed, 2 insertions, 79 deletions
diff --git a/sqlite/types/test.hxx b/sqlite/types/test.hxx index 971a89f..37190a0 100644 --- a/sqlite/types/test.hxx +++ b/sqlite/types/test.hxx @@ -9,87 +9,10 @@ #include <set> #include <string> #include <memory> // std::auto_ptr -#include <cstddef> // std::size_t -#include <cstring> // std::{memcmp,memcpy} #include <odb/core.hxx> -struct buffer -{ - ~buffer () - { - delete[] data_; - } - - buffer () - : data_ (0), size_ (0) - { - } - - buffer (const void* data, std::size_t size) - : data_ (0), size_ (size) - { - data_ = new char[size_]; - std::memcpy (data_, data, size_); - } - - buffer (const buffer& y) - : data_ (0), size_ (0) - { - assign (y.data_, y.size_); - } - - buffer& - operator= (const buffer& y) - { - if (this != &y) - assign (y.data_, y.size_); - - return *this; - } - - void - assign (const void* data, std::size_t size) - { - if (size_ < size) - { - char* p (new char[size]); - delete[] data_; - data_ = p; - } - - std::memcpy (data_, data, size); - size_ = size; - } - - char* - data () - { - return data_; - } - - const char* - data () const - { - return data_; - } - - std::size_t - size () const - { - return size_; - } - - bool - operator== (const buffer& y) const - { - return size_ == y.size_ && std::memcmp (data_, y.data_, size_) == 0; - } - -private: - char* data_; - std::size_t size_; -}; +#include <common/buffer.hxx> typedef std::auto_ptr<std::string> string_ptr; diff --git a/sqlite/types/traits.hxx b/sqlite/types/traits.hxx index 0f9c253..13eef34 100644 --- a/sqlite/types/traits.hxx +++ b/sqlite/types/traits.hxx @@ -10,7 +10,7 @@ #include <odb/sqlite/traits.hxx> -#include "test.hxx" // buffer +#include "test.hxx" // buffer, string_ptr namespace odb { |