aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-08-18 18:26:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-08-18 18:26:33 +0200
commitdce5d0658e67ced4d5fa64f98f598b86917927a7 (patch)
treee910d86848a672ef4d0e3977d351e21d3f633227 /odb
parent854af2dbb1ee01f6e1c8d4f8f513ff2bad7da4f0 (diff)
Move buffer to the details namespace
Diffstat (limited to 'odb')
-rw-r--r--odb/buffer.cxx34
-rw-r--r--odb/buffer.hxx56
-rw-r--r--odb/details/buffer.cxx37
-rw-r--r--odb/details/buffer.hxx59
-rw-r--r--odb/makefile3
-rw-r--r--odb/traits.hxx1
6 files changed, 98 insertions, 92 deletions
diff --git a/odb/buffer.cxx b/odb/buffer.cxx
deleted file mode 100644
index f920258..0000000
--- a/odb/buffer.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-// file : odb/buffer.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#include <cstring> // std::memcpy
-
-#include <odb/buffer.hxx>
-
-using namespace std;
-
-namespace odb
-{
- void buffer::
- capacity (size_t c, size_t data_size)
- {
- if (c > capacity_)
- {
- size_t n (capacity_ * 2 > c ? capacity_ * 2 : c);
- char* d (static_cast<char*> (operator new (n)));
-
- if (data_ != 0)
- {
- if (data_size != 0)
- memcpy (d, data_, data_size);
-
- operator delete (data_);
- }
-
- data_ = d;
- capacity_ = n;
- }
- }
-}
diff --git a/odb/buffer.hxx b/odb/buffer.hxx
deleted file mode 100644
index 4f4ce0b..0000000
--- a/odb/buffer.hxx
+++ /dev/null
@@ -1,56 +0,0 @@
-// file : odb/buffer.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#ifndef ODB_BUFFER_HXX
-#define ODB_BUFFER_HXX
-
-#include <new>
-#include <cstddef> // std::size_t
-
-namespace odb
-{
- class buffer
- {
- public:
- ~buffer ()
- {
- if (data_)
- operator delete (data_);
- }
-
- buffer ()
- : capacity_ (512)
- {
- data_ = static_cast<char*> (operator new (capacity_));
- }
-
- char*
- data ()
- {
- return data_;
- }
-
- const char*
- data () const
- {
- return data_;
- }
-
- std::size_t
- capacity () const
- {
- return capacity_;
- }
-
- void
- capacity (std::size_t, std::size_t data_size = 0);
-
- private:
- char* data_;
- std::size_t capacity_;
- };
-}
-
-#endif // ODB_BUFFER_HXX
diff --git a/odb/details/buffer.cxx b/odb/details/buffer.cxx
new file mode 100644
index 0000000..0d02460
--- /dev/null
+++ b/odb/details/buffer.cxx
@@ -0,0 +1,37 @@
+// file : odb/details/buffer.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <cstring> // std::memcpy
+
+#include <odb/details/buffer.hxx>
+
+using namespace std;
+
+namespace odb
+{
+ namespace details
+ {
+ void buffer::
+ capacity (size_t c, size_t data_size)
+ {
+ if (c > capacity_)
+ {
+ size_t n (capacity_ * 2 > c ? capacity_ * 2 : c);
+ char* d (static_cast<char*> (operator new (n)));
+
+ if (data_ != 0)
+ {
+ if (data_size != 0)
+ memcpy (d, data_, data_size);
+
+ operator delete (data_);
+ }
+
+ data_ = d;
+ capacity_ = n;
+ }
+ }
+ }
+}
diff --git a/odb/details/buffer.hxx b/odb/details/buffer.hxx
new file mode 100644
index 0000000..4393114
--- /dev/null
+++ b/odb/details/buffer.hxx
@@ -0,0 +1,59 @@
+// file : odb/details/buffer.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BUFFER_DETAILS_HXX
+#define ODB_BUFFER_DETAILS_HXX
+
+#include <new>
+#include <cstddef> // std::size_t
+
+namespace odb
+{
+ namespace details
+ {
+ class buffer
+ {
+ public:
+ ~buffer ()
+ {
+ if (data_)
+ operator delete (data_);
+ }
+
+ buffer ()
+ : capacity_ (512)
+ {
+ data_ = static_cast<char*> (operator new (capacity_));
+ }
+
+ char*
+ data ()
+ {
+ return data_;
+ }
+
+ const char*
+ data () const
+ {
+ return data_;
+ }
+
+ std::size_t
+ capacity () const
+ {
+ return capacity_;
+ }
+
+ void
+ capacity (std::size_t, std::size_t data_size = 0);
+
+ private:
+ char* data_;
+ std::size_t capacity_;
+ };
+ }
+}
+
+#endif // ODB_BUFFER_DETAILS_HXX
diff --git a/odb/makefile b/odb/makefile
index 047ff1c..2038b01 100644
--- a/odb/makefile
+++ b/odb/makefile
@@ -7,12 +7,13 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
cxx_tun := \
shared-ptr/base.cxx \
-buffer.cxx \
exception.cxx \
exceptions.cxx \
database.cxx \
transaction.cxx
+cxx_tun += details/buffer.cxx
+
# POSIX-based implementation details.
#
cxx_tun += details/posix/exceptions.cxx details/posix/thread.cxx
diff --git a/odb/traits.hxx b/odb/traits.hxx
index e5c9eed..d393b3d 100644
--- a/odb/traits.hxx
+++ b/odb/traits.hxx
@@ -7,7 +7,6 @@
#define ODB_TRAITS_HXX
#include <odb/forward.hxx>
-#include <odb/buffer.hxx>
#include <odb/shared-ptr.hxx>
#include <odb/pointer-traits.hxx>