MCPcopy Create free account
hub / github.com/Tencent/rapidjson / PutUnsafe

Function PutUnsafe

include/rapidjson/stringbuffer.h:32–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#endif
31
32RAPIDJSON_NAMESPACE_BEGIN
33
34//! Represents an in-memory output stream.
35/*!
36 \tparam Encoding Encoding of the stream.
37 \tparam Allocator type for allocating memory buffer.
38 \note implements Stream concept
39*/
40template <typename Encoding, typename Allocator = CrtAllocator>
41class GenericStringBuffer {
42public:
43 typedef typename Encoding::Ch Ch;
44
45 GenericStringBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {}
46
47#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
48 GenericStringBuffer(GenericStringBuffer&& rhs) : stack_(std::move(rhs.stack_)) {}
49 GenericStringBuffer& operator=(GenericStringBuffer&& rhs) {
50 if (&rhs != this)
51 stack_ = std::move(rhs.stack_);
52 return *this;
53 }
54#endif
55
56 void Put(Ch c) { *stack_.template Push<Ch>() = c; }
57 void PutUnsafe(Ch c) { *stack_.template PushUnsafe<Ch>() = c; }
58 void Flush() {}
59
60 void Clear() { stack_.Clear(); }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected