15 #ifndef RAPIDJSON_ISTREAMWRAPPER_H_
16 #define RAPIDJSON_ISTREAMWRAPPER_H_
24 RAPIDJSON_DIAG_OFF(padded)
25 #elif defined(_MSC_VER)
27 RAPIDJSON_DIAG_OFF(4351)
48 template <
typename StreamType>
52 typedef typename StreamType::char_type
Ch;
80 bufferSize_(bufferSize),
91 Ch Peek()
const {
return *current_; }
98 size_t Tell()
const {
return count_ +
static_cast<size_t>(current_ - buffer_); }
115 const Ch*
Peek4()
const {
return (current_ + 4 - !eof_ <= bufferLast_) ? current_ : 0; }
124 if(current_ < bufferLast_)
128 count_ += readCount_;
129 readCount_ = bufferSize_;
130 bufferLast_ = buffer_ + readCount_ - 1;
133 if(!stream_.read(buffer_,
static_cast<std::streamsize
>(bufferSize_)))
135 readCount_ =
static_cast<size_t>(stream_.gcount());
136 *(bufferLast_ = buffer_ + readCount_) =
'\0';
143 Ch peekBuffer_[4], *buffer_;
155 #if defined(__clang__) || defined(_MSC_VER)
Wrapper of std::basic_istream into RapidJSON's Stream concept.
Definition: istreamwrapper.h:50
Ch Peek() const
Definition: istreamwrapper.h:91
void Flush()
Definition: istreamwrapper.h:102
BasicIStreamWrapper(StreamType &stream)
Constructor.
Definition: istreamwrapper.h:58
Ch * PutBegin()
Definition: istreamwrapper.h:103
BasicIStreamWrapper(StreamType &stream, char *buffer, size_t bufferSize)
Constructor.
Definition: istreamwrapper.h:77
StreamType::char_type Ch
Definition: istreamwrapper.h:52
size_t PutEnd(Ch *)
Definition: istreamwrapper.h:108
size_t Tell() const
Definition: istreamwrapper.h:98
const Ch * Peek4() const
Definition: istreamwrapper.h:115
void Put(Ch)
Definition: istreamwrapper.h:101
Ch Take()
Definition: istreamwrapper.h:92
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:451
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:121
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:124
BasicIStreamWrapper< std::istream > IStreamWrapper
Definition: istreamwrapper.h:152
BasicIStreamWrapper< std::wistream > WIStreamWrapper
Definition: istreamwrapper.h:153