21 #ifndef RAPIDJSON_STREAM_H_ 22 #define RAPIDJSON_STREAM_H_ 78 template <
typename Stream>
90 template <
typename Stream>
97 template <
typename Stream>
98 inline void PutUnsafe(Stream &stream,
typename Stream::Ch c) {
103 template <
typename Stream,
typename Ch>
104 inline void PutN(Stream &stream, Ch c,
size_t n) {
106 for (
size_t i = 0; i < n; i++)
PutUnsafe(stream, c);
118 #if defined(_MSC_VER) && _MSC_VER <= 1800 120 RAPIDJSON_DIAG_OFF(4702)
121 RAPIDJSON_DIAG_OFF(4512)
124 template <
typename InputStream,
typename Encoding = UTF8<>>
127 typedef typename Encoding::Ch
Ch;
130 Ch
Peek()
const {
return is_.Peek(); }
131 Ch
Take() {
return is_.Take(); }
132 size_t Tell() {
return is_.Tell(); }
134 void Put(Ch ch) { is_.Put(ch); }
136 size_t PutEnd(Ch *ch) {
return is_.PutEnd(ch); }
139 const Ch *
Peek4()
const {
return is_.Peek4(); }
143 bool HasBOM()
const {
return is_.HasBOM(); }
149 #if defined(_MSC_VER) && _MSC_VER <= 1800 159 template <
typename Encoding>
161 typedef typename Encoding::Ch
Ch;
165 Ch
Peek()
const {
return *src_; }
167 size_t Tell()
const {
return static_cast<size_t>(src_ - head_); }
184 template <
typename Encoding>
199 template <
typename Encoding>
201 typedef typename Encoding::Ch
Ch;
208 size_t Tell() {
return static_cast<size_t>(src_ - head_); }
217 size_t PutEnd(Ch *begin) {
return static_cast<size_t>(dst_ - begin); }
225 void Pop(
size_t count) { dst_ -= count; }
232 template <
typename Encoding>
242 #endif // RAPIDJSON_STREAM_H_ GenericStringStream< UTF8<> > StringStream
String stream with UTF8 encoding.
GenericInsituStringStream< UTF8<> > InsituStringStream
Insitu string stream with UTF8 encoding.
UTFType
Runtime-specified UTF encoding type of a stream.
#define RAPIDJSON_ASSERT(x)
Assertion.
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
GenericInsituStringStream(Ch *src)
const Ch * src_
Current read position.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
A read-write string stream.
GenericStringStream(const Ch *src)
GenericStreamWrapper(InputStream &is)
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.
Provides additional information for stream.
void PutN(Stream &stream, Ch c, size_t n)
Put N copies of a character to a stream.
common definitions and configuration
const Ch * head_
Original head of the string.