17 #ifndef RAPIDJSON_STREAM_H_
18 #define RAPIDJSON_STREAM_H_
20 #include "encodings.h"
72 template<
typename Stream>
79 enum { copyOptimization = 0 };
83 template<
typename Stream>
84 inline void PutReserve(
Stream& stream,
size_t count) {
90 template<
typename Stream>
91 inline void PutUnsafe(
Stream& stream,
typename Stream::Ch c) {
96 template<
typename Stream,
typename Ch>
97 inline void PutN(
Stream& stream, Ch c,
size_t n) {
98 PutReserve(stream, n);
99 for (
size_t i = 0; i < n; i++)
100 PutUnsafe(stream, c);
109 template <
typename Encoding>
111 typedef typename Encoding::Ch Ch;
115 Ch Peek()
const {
return *
src_; }
116 Ch Take() {
return *
src_++; }
117 size_t Tell()
const {
return static_cast<size_t>(
src_ -
head_); }
128 template <
typename Encoding>
130 enum { copyOptimization = 1 };
143 template <
typename Encoding>
145 typedef typename Encoding::Ch Ch;
150 Ch Peek() {
return *src_; }
151 Ch Take() {
return *src_++; }
152 size_t Tell() {
return static_cast<size_t>(src_ - head_); }
157 Ch* PutBegin() {
return dst_ = src_; }
158 size_t PutEnd(Ch* begin) {
return static_cast<size_t>(dst_ - begin); }
161 Ch* Push(
size_t count) { Ch* begin = dst_; dst_ += count;
return begin; }
162 void Pop(
size_t count) { dst_ -= count; }
169 template <
typename Encoding>
171 enum { copyOptimization = 1 };
Concept for encoding of Unicode characters.
Concept for reading and writing characters.
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:402
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:116
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:119
common definitions and configuration
A read-write string stream.
Definition: stream.h:144
Read-only string stream.
Definition: stream.h:110
const Ch * head_
Original head of the string.
Definition: stream.h:125
const Ch * src_
Current read position.
Definition: stream.h:124
Provides additional information for stream.
Definition: stream.h:73