16#ifndef RAPIDJSON_MEMORYBUFFER_H_
17#define RAPIDJSON_MEMORYBUFFER_H_
20#include "internal/stack.h"
37template <
typename Allocator = CrtAllocator>
43 void Put(Ch c) { *stack_.template Push<Ch>() = c; }
46 void Clear() { stack_.Clear(); }
47 void ShrinkToFit() { stack_.ShrinkToFit(); }
48 Ch* Push(
size_t count) {
return stack_.template Push<Ch>(count); }
49 void Pop(
size_t count) { stack_.template Pop<Ch>(count); }
51 const Ch* GetBuffer()
const {
52 return stack_.template Bottom<Ch>();
55 size_t GetSize()
const {
return stack_.GetSize(); }
57 static const size_t kDefaultCapacity = 256;
65inline void PutN(
MemoryBuffer& memoryBuffer,
char c,
size_t n) {
66 std::memset(memoryBuffer.stack_.Push<
char>(n), c, n *
sizeof(c));
A type-unsafe stack for storing different types of data.
Concept for allocating, resizing and freeing memory block.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Represents an in-memory output byte stream.