15 #ifndef CEREAL_RAPIDJSON_STRINGBUFFER_H_
16 #define CEREAL_RAPIDJSON_STRINGBUFFER_H_
21 #if CEREAL_RAPIDJSON_HAS_CXX11_RVALUE_REFS
27 #if defined(__clang__)
28 CEREAL_RAPIDJSON_DIAG_PUSH
29 CEREAL_RAPIDJSON_DIAG_OFF(c++98-compat)
40 template <
typename Encoding,
typename Allocator = CrtAllocator>
43 typedef typename Encoding::Ch
Ch;
47 #if CEREAL_RAPIDJSON_HAS_CXX11_RVALUE_REFS
51 stack_ = std::move(rhs.stack_);
63 *
stack_.template Push<Ch>() =
'\0';
65 stack_.template Pop<Ch>(1);
71 void Pop(
size_t count) {
stack_.template Pop<Ch>(count); }
75 *
stack_.template Push<Ch>() =
'\0';
76 stack_.template Pop<Ch>(1);
78 return stack_.template Bottom<Ch>();
99 template<
typename Encoding,
typename Allocator>
104 template<
typename Encoding,
typename Allocator>
112 std::memset(stream.stack_.Push<
char>(n), c, n *
sizeof(c));
117 #if defined(__clang__)
118 CEREAL_RAPIDJSON_DIAG_POP
Represents an in-memory output stream.
Definition: stringbuffer.h:41
void Pop(size_t count)
Definition: stringbuffer.h:71
GenericStringBuffer & operator=(const GenericStringBuffer &)
void ShrinkToFit()
Definition: stringbuffer.h:61
void Flush()
Definition: stringbuffer.h:58
void Clear()
Definition: stringbuffer.h:60
Ch * Push(size_t count)
Definition: stringbuffer.h:69
void Reserve(size_t count)
Definition: stringbuffer.h:68
Ch * PushUnsafe(size_t count)
Definition: stringbuffer.h:70
GenericStringBuffer(Allocator *allocator=0, size_t capacity=kDefaultCapacity)
Definition: stringbuffer.h:45
size_t GetSize() const
Get the size of string in bytes in the string buffer.
Definition: stringbuffer.h:82
Encoding::Ch Ch
Definition: stringbuffer.h:43
void Put(Ch c)
Definition: stringbuffer.h:56
void PutUnsafe(Ch c)
Definition: stringbuffer.h:57
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:88
const Ch * GetString() const
Definition: stringbuffer.h:73
size_t GetLength() const
Get the length of string in Ch in the string buffer.
Definition: stringbuffer.h:85
static const size_t kDefaultCapacity
Definition: stringbuffer.h:87
GenericStringBuffer(const GenericStringBuffer &)
A type-unsafe stack for storing different types of data.
Definition: stack.h:37
Concept for allocating, resizing and freeing memory block.
#define CEREAL_RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:121
#define CEREAL_RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:124
Definition: json.hpp:5678
void PutUnsafe(GenericStringBuffer< Encoding, Allocator > &stream, typename Encoding::Ch c)
Definition: stringbuffer.h:105
void PutN(GenericStringBuffer< UTF8<> > &stream, char c, size_t n)
Implement specialized version of PutN() with memset() for better performance.
Definition: stringbuffer.h:111
void PutReserve(GenericStringBuffer< Encoding, Allocator > &stream, size_t count)
Definition: stringbuffer.h:100
GenericStringBuffer< UTF8<> > StringBuffer
String buffer with UTF8 encoding.
Definition: stringbuffer.h:97
UTF-8 encoding.
Definition: encodings.h:96