15 #ifndef RAPIDJSON_STRINGBUFFER_H_
16 #define RAPIDJSON_STRINGBUFFER_H_
20 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
24 #include "internal/stack.h"
26 RAPIDJSON_NAMESPACE_BEGIN
34 template <
typename Encoding,
typename Allocator = CrtAllocator>
37 typedef typename Encoding::Ch Ch;
41 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
45 stack_ = std::move(rhs.stack_);
50 void Put(Ch c) { *stack_.template Push<Ch>() = c; }
53 void Clear() { stack_.Clear(); }
56 *stack_.template Push<Ch>() =
'\0';
58 stack_.template Pop<Ch>(1);
60 Ch* Push(
size_t count) {
return stack_.template Push<Ch>(count); }
61 void Pop(
size_t count) { stack_.template Pop<Ch>(count); }
63 const Ch* GetString()
const {
65 *stack_.template Push<Ch>() =
'\0';
66 stack_.template Pop<Ch>(1);
68 return stack_.template Bottom<Ch>();
71 size_t GetSize()
const {
return stack_.GetSize(); }
73 static const size_t kDefaultCapacity = 256;
74 mutable internal::Stack<Allocator> stack_;
88 std::memset(stream.stack_.Push<
char>(n), c, n *
sizeof(c));
91 RAPIDJSON_NAMESPACE_END
93 #endif // RAPIDJSON_STRINGBUFFER_H_
Represents an in-memory output stream.
Definition: stringbuffer.h:35
common definitions and configuration
UTF-8 encoding.
Definition: encodings.h:96
Concept for allocating, resizing and freeing memory block.
void PutN(Stream &stream, Ch c, size_t n)
Put N copies of a character to a stream.
Definition: rapidjson.h:559