19 #ifndef RAPIDJSON_STRINGBUFFER_H_ 20 #define RAPIDJSON_STRINGBUFFER_H_ 25 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS 31 #if defined(__clang__) 33 RAPIDJSON_DIAG_OFF(c++ 98 - compat)
44 template <
typename Encoding,
typename Allocator = CrtAllocator>
47 typedef typename Encoding::Ch
Ch;
51 :
stack_(allocator, capacity) {}
53 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS 55 :
stack_(std::move(rhs.stack_)) {}
57 if (&rhs !=
this)
stack_ = std::move(rhs.stack_);
69 *
stack_.template Push<Ch>() =
'\0';
71 stack_.template Pop<Ch>(1);
75 Ch *
Push(
size_t count) {
return stack_.template Push<Ch>(count); }
77 void Pop(
size_t count) {
stack_.template Pop<Ch>(count); }
81 *
stack_.template Push<Ch>() =
'\0';
82 stack_.template Pop<Ch>(1);
84 return stack_.template Bottom<Ch>();
105 template <
typename Encoding,
typename Allocator>
111 template <
typename Encoding,
typename Allocator>
113 typename Encoding::Ch c) {
121 std::memset(stream.stack_.Push<
char>(n), c, n *
sizeof(c));
126 #if defined(__clang__) 130 #endif // RAPIDJSON_STRINGBUFFER_H_ void PutReserve(GenericStringBuffer< Encoding, Allocator > &stream, size_t count)
size_t GetSize() const
Get the size of string in bytes in the string buffer.
GenericStringBuffer & operator=(const GenericStringBuffer &)
const Ch * GetString() const
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
A type-unsafe stack for storing different types of data.
static const size_t kDefaultCapacity
GenericStringBuffer< UTF8<> > StringBuffer
String buffer with UTF8 encoding.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
void Reserve(size_t count)
Ch * PushUnsafe(size_t count)
Represents an in-memory output stream.
GenericStringBuffer(Allocator *allocator=0, size_t capacity=kDefaultCapacity)
size_t GetLength() const
Get the length of string in Ch in the string buffer.
internal::Stack< Allocator > stack_
void PutN(GenericStringBuffer< UTF8<>> &stream, char c, size_t n)