33 namespace ns_rapidjson
51 template <
typename StreamType>
55 using Ch =
typename StreamType::char_type;
62 typename StreamType::int_type c = stream_.peek();
63 return (c != StreamType::traits_type::eof()) ?
static_cast<Ch>(c) :
static_cast<Ch>(
'\0');
68 typename StreamType::int_type c = stream_.get();
69 if (c != StreamType::traits_type::eof())
72 return static_cast<Ch>(c);
86 RAPIDJSON_ASSERT(
false);
91 RAPIDJSON_ASSERT(
false);
95 RAPIDJSON_ASSERT(
false);
99 RAPIDJSON_ASSERT(
false);
106 RAPIDJSON_ASSERT(
sizeof(
Ch) == 1);
108 bool hasError =
false;
109 for (i = 0; i < 4; ++i)
111 typename StreamType::int_type c = stream_.get();
112 if (c == StreamType::traits_type::eof())
118 peekBuffer_[i] =
static_cast<Ch>(c);
120 for (--i; i >= 0; --i)
121 stream_.putback(peekBuffer_[i]);
122 return !hasError ? peekBuffer_ : 0;
131 mutable Ch peekBuffer_[4];
Wrapper of std::basic_istream into RapidJSON's Stream concept.
typename StreamType::char_type Ch
BasicIStreamWrapper & operator=(const BasicIStreamWrapper &)
BasicIStreamWrapper(const BasicIStreamWrapper &)
size_t count_
Number of characters read. Note:
BasicIStreamWrapper(StreamType &stream)