aboutsummaryrefslogtreecommitdiff
path: root/odb/buffer.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/buffer.hxx')
-rw-r--r--odb/buffer.hxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/odb/buffer.hxx b/odb/buffer.hxx
index 99482ae..2a07735 100644
--- a/odb/buffer.hxx
+++ b/odb/buffer.hxx
@@ -6,6 +6,7 @@
#ifndef ODB_BUFFER_HXX
#define ODB_BUFFER_HXX
+#include <new>
#include <cstddef> // std::size_t
namespace odb
@@ -13,10 +14,32 @@ namespace odb
class buffer
{
public:
- buffer ();
+ ~buffer ()
+ {
+ if (data_)
+ operator delete (data_);
+ }
+
+ buffer ()
+ : capacity_ (512)
+ {
+ data_ = static_cast<char*> (operator new (capacity_));
+ }
+
+ char*
+ data ()
+ {
+ return data_;
+ }
+
+ std::size_t
+ capacity () const
+ {
+ return capacity_;
+ }
void
- grow (std::size_t new_capacity, std::size_t data_size);
+ capacity (std::size_t, std::size_t data_size = 0);
private:
char* data_;