15 #ifndef RAPIDJSON_STRINGBUFFER_H_
16 #define RAPIDJSON_STRINGBUFFER_H_
20 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
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_);
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); }
65 *
stack_.template Push<Ch>() =
'\0';
66 stack_.template Pop<Ch>(1);
68 return stack_.template Bottom<Ch>();
88 std::memset(stream.stack_.Push<
char>(n), c, n *
sizeof(c));
93 #endif // RAPIDJSON_STRINGBUFFER_H_
size_t GetSize() const
Definition: stringbuffer.h:71
GenericStringBuffer & operator=(const GenericStringBuffer &)
const Ch * GetString() const
Definition: stringbuffer.h:63
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:119
void Put(Ch c)
Definition: stringbuffer.h:50
A type-unsafe stack for storing different types of data.
Definition: stack.h:30
void PutN(GenericStringBuffer< UTF8<> > &stream, char c, size_t n)
Implement specialized version of PutN() with memset() for better performance.
Definition: stringbuffer.h:87
static const size_t kDefaultCapacity
Definition: stringbuffer.h:73
GenericStringBuffer< UTF8<> > StringBuffer
String buffer with UTF8 encoding.
Definition: stringbuffer.h:83
Encoding::Ch Ch
Definition: stringbuffer.h:37
void ShrinkToFit()
Definition: stringbuffer.h:54
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:116
UTF-8 encoding.
Definition: encodings.h:96
Ch * Push(size_t count)
Definition: stringbuffer.h:60
void Flush()
Definition: stringbuffer.h:51
Represents an in-memory output stream.
Definition: stringbuffer.h:35
GenericStringBuffer(Allocator *allocator=0, size_t capacity=kDefaultCapacity)
Definition: stringbuffer.h:39
void Clear()
Definition: stringbuffer.h:53
common definitions and configuration
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
void Pop(size_t count)
Definition: stringbuffer.h:61