blob: 87ee97f47fa0bde303aee8afe72eea61fb7eab65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// 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 <odb/pre.hxx>
#include <new>
#include <cstddef> // std::size_t
#include <odb/details/export.hxx>
namespace odb
{
namespace details
{
class LIBODB_EXPORT 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_;
};
}
}
#include <odb/post.hxx>
#endif // ODB_BUFFER_DETAILS_HXX
|