18#ifndef RAPIDJSON_STREAM_H_
19#define RAPIDJSON_STREAM_H_
73template<
typename Stream>
80 enum { copyOptimization = 0 };
84template<
typename Stream>
85inline void PutReserve(
Stream& stream,
size_t count) {
91template<
typename Stream>
92inline void PutUnsafe(
Stream& stream,
typename Stream::Ch c) {
97template<
typename Stream,
typename Ch>
98inline void PutN(
Stream& stream, Ch c,
size_t n) {
99 PutReserve(stream, n);
100 for (
size_t i = 0; i < n; i++)
101 PutUnsafe(stream, c);
113#if defined(_MSC_VER) && _MSC_VER <= 1800
115RAPIDJSON_DIAG_OFF(4702)
116RAPIDJSON_DIAG_OFF(4512)
119template <
typename InputStream,
typename Encoding = UTF8<> >
122 typedef typename Encoding::Ch Ch;
125 Ch Peek()
const {
return is_.Peek(); }
126 Ch Take() {
return is_.Take(); }
127 size_t Tell() {
return is_.Tell(); }
128 Ch* PutBegin() {
return is_.PutBegin(); }
129 void Put(Ch ch) { is_.Put(ch); }
130 void Flush() { is_.Flush(); }
131 size_t PutEnd(Ch* ch) {
return is_.PutEnd(ch); }
134 const Ch* Peek4()
const {
return is_.Peek4(); }
137 UTFType GetType()
const {
return is_.GetType(); }
138 bool HasBOM()
const {
return is_.HasBOM(); }
144#if defined(_MSC_VER) && _MSC_VER <= 1800
154template <
typename Encoding>
156 typedef typename Encoding::Ch Ch;
160 Ch Peek()
const {
return *
src_; }
161 Ch Take() {
return *
src_++; }
162 size_t Tell()
const {
return static_cast<size_t>(
src_ -
head_); }
173template <
typename Encoding>
175 enum { copyOptimization = 1 };
188template <
typename Encoding>
190 typedef typename Encoding::Ch Ch;
195 Ch Peek() {
return *src_; }
196 Ch Take() {
return *src_++; }
197 size_t Tell() {
return static_cast<size_t>(src_ - head_); }
202 Ch* PutBegin() {
return dst_ = src_; }
203 size_t PutEnd(Ch* begin) {
return static_cast<size_t>(dst_ - begin); }
206 Ch* Push(
size_t count) { Ch* begin = dst_; dst_ += count;
return begin; }
207 void Pop(
size_t count) { dst_ -= count; }
214template <
typename Encoding>
216 enum { copyOptimization = 1 };
Concept for encoding of Unicode characters.
Concept for reading and writing characters.
#define RAPIDJSON_ASSERT(x)
Assertion.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
common definitions and configuration
A read-write string stream.
const Ch * head_
Original head of the string.
const Ch * src_
Current read position.
Provides additional information for stream.