1 #ifndef RAPIDJSON_STRINGBUFFER_H_
2 #define RAPIDJSON_STRINGBUFFER_H_
5 #include "internal/stack.h"
15 template <
typename Encoding,
typename Allocator = CrtAllocator>
17 typedef typename Encoding::Ch Ch;
21 void Put(Ch c) { *stack_.template Push<Ch>() = c; }
24 void Clear() { stack_.Clear(); }
25 Ch* Push(
size_t count) {
return stack_.template Push<Ch>(count); }
26 void Pop(
size_t count) { stack_.template Pop<Ch>(count); }
28 const Ch* GetString()
const {
30 *stack_.template Push<Ch>() =
'\0';
31 stack_.template Pop<Ch>(1);
33 return stack_.template Bottom<Ch>();
36 size_t GetSize()
const {
return stack_.GetSize(); }
38 static const size_t kDefaultCapacity = 256;
39 mutable internal::Stack<Allocator> stack_;
48 memset(stream.stack_.Push<
char>(n), c, n *
sizeof(c));
53 #endif // RAPIDJSON_STRINGBUFFER_H_
Represents an in-memory output stream.
Definition: stringbuffer.h:16
void PutN(FileWriteStream &stream, char c, size_t n)
Implement specialized version of PutN() with memset() for better performance.
Definition: filewritestream.h:71
main RapidJSON namespace
Definition: allocators.h:6
common definitions and configuration
UTF-8 encoding.
Definition: encodings.h:81
Concept for allocating, resizing and freeing memory block.
GenericStringBuffer< UTF8<> > StringBuffer
String buffer with UTF8 encoding.
Definition: stringbuffer.h:43