1 #ifndef RAPIDJSON_MEMORYBUFFER_H_
2 #define RAPIDJSON_MEMORYBUFFER_H_
5 #include "internal/stack.h"
22 template <
typename Allocator = CrtAllocator>
28 void Put(Ch c) { *stack_.template Push<Ch>() = c; }
31 void Clear() { stack_.Clear(); }
32 Ch* Push(
size_t count) {
return stack_.template Push<Ch>(count); }
33 void Pop(
size_t count) { stack_.template Pop<Ch>(count); }
35 const Ch* GetBuffer()
const {
36 return stack_.template Bottom<Ch>();
39 size_t GetSize()
const {
return stack_.GetSize(); }
41 static const size_t kDefaultCapacity = 256;
42 mutable internal::Stack<Allocator> stack_;
49 inline void PutN(MemoryBuffer& memoryBuffer,
char c,
size_t n) {
50 memset(memoryBuffer.stack_.Push<
char>(n), c, n *
sizeof(c));
55 #endif // RAPIDJSON_MEMORYBUFFER_H_
Represents an in-memory output byte stream.
Definition: memorybuffer.h:23
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
Concept for allocating, resizing and freeing memory block.