15 #ifndef RAPIDJSON_ISTREAMWRAPPER_H_
16 #define RAPIDJSON_ISTREAMWRAPPER_H_
23 RAPIDJSON_DIAG_OFF(padded)
28 RAPIDJSON_DIAG_OFF(4351)
31 RAPIDJSON_NAMESPACE_BEGIN
49 template <
typename StreamType>
52 typedef typename StreamType::char_type Ch;
56 typename StreamType::int_type c = stream_.peek();
57 return RAPIDJSON_LIKELY(c != StreamType::traits_type::eof()) ?
static_cast<Ch
>(c) :
'\0';
61 typename StreamType::int_type c = stream_.get();
64 return static_cast<Ch
>(c);
71 size_t Tell()
const {
return count_; }
79 const Ch* Peek4()
const {
82 bool hasError =
false;
83 for (i = 0; i < 4; ++i) {
84 typename StreamType::int_type c = stream_.get();
85 if (c == StreamType::traits_type::eof()) {
90 peekBuffer_[i] =
static_cast<Ch
>(c);
92 for (--i; i >= 0; --i)
93 stream_.putback(peekBuffer_[i]);
94 return !hasError ? peekBuffer_ : 0;
103 mutable Ch peekBuffer_[4];
109 #if defined(__clang__) || defined(_MSC_VER)
113 RAPIDJSON_NAMESPACE_END
115 #endif // RAPIDJSON_ISTREAMWRAPPER_H_