Skip to content

Commit 852e6ee

Browse files
committed
Restore files to their original state from main branch so just Buffer is changed
1 parent e953ea5 commit 852e6ee

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

include/velocypack/Builder.h

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ namespace arangodb::velocypack {
5050
class ArrayIterator;
5151
class ObjectIterator;
5252

53-
template<typename BufferType = Buffer<uint8_t>>
5453
class Builder {
5554
friend class Parser; // The parser needs access to internals.
5655

@@ -75,12 +74,12 @@ class Builder {
7574
// buffer. Whenever the stack is empty, one can use the start,
7675
// size and slice methods to get out the ready built VPack
7776
// object(s).
78-
public:
79-
using buffer_type = BufferType;
8077

8178
private:
82-
std::shared_ptr<BufferType> _buffer;
83-
BufferType* _bufferPtr;
79+
// Here we collect the result
80+
std::shared_ptr<Buffer<uint8_t>> _buffer;
81+
// used for quicker access than shared_ptr
82+
Buffer<uint8_t>* _bufferPtr;
8483
// Always points to the start of _buffer
8584
uint8_t* _start;
8685
// the append position
@@ -115,19 +114,19 @@ class Builder {
115114
explicit Builder(Options const* options);
116115

117116
// create an empty Builder, using an existing buffer and default Options
118-
explicit Builder(std::shared_ptr<BufferType> buffer);
117+
explicit Builder(std::shared_ptr<Buffer<uint8_t>> buffer);
119118

120119
// create an empty Builder, using an existing buffer and Options
121-
explicit Builder(std::shared_ptr<BufferType> buffer,
120+
explicit Builder(std::shared_ptr<Buffer<uint8_t>> buffer,
122121
Options const* options);
123122

124123
// create a Builder that uses an existing Buffer and default Options.
125124
// the Builder will not claim ownership for its Buffer
126-
explicit Builder(BufferType& buffer) noexcept;
125+
explicit Builder(Buffer<uint8_t>& buffer) noexcept;
127126

128127
// create a Builder that uses an existing Buffer. the Builder will not
129128
// claim ownership for this Buffer
130-
explicit Builder(BufferType& buffer, Options const* options);
129+
explicit Builder(Buffer<uint8_t>& buffer, Options const* options);
131130

132131
// populate a Builder from a Slice
133132
explicit Builder(Slice slice, Options const* options = &Options::Defaults);
@@ -142,9 +141,9 @@ class Builder {
142141
// get a reference to the Builder's Buffer object
143142
// note: this object may be a nullptr if the buffer was already stolen
144143
// from the Builder, or if the Builder has no ownership for the Buffer
145-
std::shared_ptr<BufferType> const& buffer() const { return _buffer; }
144+
std::shared_ptr<Buffer<uint8_t>> const& buffer() const { return _buffer; }
146145

147-
BufferType& bufferRef() const {
146+
Buffer<uint8_t>& bufferRef() const {
148147
if (_bufferPtr == nullptr) {
149148
throw Exception(Exception::InternalError, "Builder has no Buffer");
150149
}
@@ -154,9 +153,9 @@ class Builder {
154153
// steal the Builder's Buffer object. afterwards the Builder
155154
// is unusable - note: this may return a nullptr if the Builder does not
156155
// own the Buffer!
157-
std::shared_ptr<BufferType> steal() {
156+
std::shared_ptr<Buffer<uint8_t>> steal() {
158157
// After a steal the Builder is broken!
159-
std::shared_ptr<BufferType> res(std::move(_buffer));
158+
std::shared_ptr<Buffer<uint8_t>> res(std::move(_buffer));
160159
_bufferPtr = nullptr;
161160
_start = nullptr;
162161
clear();
@@ -614,7 +613,7 @@ class Builder {
614613
close();
615614
return *this;
616615
}
617-
616+
618617
void resetTo(std::size_t value) {
619618
_pos = value;
620619
VELOCYPACK_ASSERT(_bufferPtr != nullptr);
@@ -1146,7 +1145,7 @@ struct ArrayBuilder final : public BuilderContainer,
11461145

11471146
} // namespace arangodb::velocypack
11481147

1149-
using VPackBuilder = arangodb::velocypack::Builder<arangodb::velocypack::Buffer<uint8_t>>;
1148+
using VPackBuilder = arangodb::velocypack::Builder;
11501149
using VPackBuilderNonDeleter = arangodb::velocypack::BuilderNonDeleter;
11511150
using VPackBuilderContainer = arangodb::velocypack::BuilderContainer;
11521151
using VPackObjectBuilder = arangodb::velocypack::ObjectBuilder;

0 commit comments

Comments
 (0)