17 #ifndef RAPIDJSON_STREAM_H_ 18 #define RAPIDJSON_STREAM_H_ 72 template<
typename Stream>
83 template<
typename Stream>
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) {
99 for (
size_t i = 0; i < n; i++)
112 #if defined(_MSC_VER) && _MSC_VER <= 1800 114 RAPIDJSON_DIAG_OFF(4702)
115 RAPIDJSON_DIAG_OFF(4512)
118 template <
typename InputStream,
typename Encoding = UTF8<> >
121 typedef typename Encoding::Ch
Ch;
124 Ch
Peek()
const {
return is_.Peek(); }
125 Ch
Take() {
return is_.Take(); }
126 size_t Tell() {
return is_.Tell(); }
128 void Put(Ch ch) { is_.Put(ch); }
130 size_t PutEnd(Ch* ch) {
return is_.PutEnd(ch); }
133 const Ch*
Peek4()
const {
return is_.Peek4(); }
137 bool HasBOM()
const {
return is_.HasBOM(); }
143 #if defined(_MSC_VER) && _MSC_VER <= 1800 153 template <
typename Encoding>
155 typedef typename Encoding::Ch
Ch;
159 Ch
Peek()
const {
return *src_; }
161 size_t Tell()
const {
return static_cast<size_t>(src_ - head_); }
172 template <
typename Encoding>
187 template <
typename Encoding>
189 typedef typename Encoding::Ch
Ch;
196 size_t Tell() {
return static_cast<size_t>(src_ - head_); }
202 size_t PutEnd(Ch* begin) {
return static_cast<size_t>(dst_ - begin); }
205 Ch*
Push(
size_t count) { Ch* begin = dst_; dst_ += count;
return begin; }
206 void Pop(
size_t count) { dst_ -= count; }
213 template <
typename Encoding>
223 #endif // RAPIDJSON_STREAM_H_
GenericStringStream< UTF8<> > StringStream
String stream with UTF8 encoding.
GenericInsituStringStream< UTF8<> > InsituStringStream
Insitu string stream with UTF8 encoding.
GenericStreamWrapper(InputStream &is)
GenericInsituStringStream(Ch *src)
UTFType
Runtime-specified UTF encoding type of a stream.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Provides additional information for stream.
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
const Ch * src_
Current read position.
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
void PutN(Stream &stream, Ch c, size_t n)
Put N copies of a character to a stream.
common definitions and configuration
GenericStringStream(const Ch *src)
const Ch * head_
Original head of the string.
A read-write string stream.
#define RAPIDJSON_ASSERT(x)
Assertion.