21 #ifndef RAPIDJSON_MEMORYBUFFER_H_
22 #define RAPIDJSON_MEMORYBUFFER_H_
25 #include "internal/stack.h"
42 template <
typename Allocator = CrtAllocator>
48 void Put(Ch c) { *stack_.template Push<Ch>() = c; }
51 void Clear() { stack_.Clear(); }
52 Ch* Push(
size_t count) {
return stack_.template Push<Ch>(count); }
53 void Pop(
size_t count) { stack_.template Pop<Ch>(count); }
55 const Ch* GetBuffer()
const {
56 return stack_.template Bottom<Ch>();
59 size_t GetSize()
const {
return stack_.GetSize(); }
61 static const size_t kDefaultCapacity = 256;
62 mutable internal::Stack<Allocator> stack_;
70 memset(memoryBuffer.stack_.Push<
char>(n), c, n *
sizeof(c));
75 #endif // RAPIDJSON_MEMORYBUFFER_H_
Represents an in-memory output byte stream.
Definition: memorybuffer.h:43
void PutN(FileWriteStream &stream, char c, size_t n)
Implement specialized version of PutN() with memset() for better performance.
Definition: filewritestream.h:91
common definitions and configuration
Concept for allocating, resizing and freeing memory block.