 |
Blamite Game Engine - blam!
00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
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>
51 typedef typename StreamType::char_type
Ch;
57 BasicIStreamWrapper(StreamType &stream) : stream_(stream), buffer_(peekBuffer_), bufferSize_(4), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) {
67 BasicIStreamWrapper(StreamType &stream,
char* buffer,
size_t bufferSize) : stream_(stream), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) {
72 Ch Peek()
const {
return *current_; }
73 Ch Take() {
Ch c = *current_; Read();
return c; }
74 size_t Tell()
const {
return count_ +
static_cast<size_t>(current_ - buffer_); }
84 return (current_ + 4 - !eof_ <= bufferLast_) ? current_ : 0;
93 if (current_ < bufferLast_)
97 readCount_ = bufferSize_;
98 bufferLast_ = buffer_ + readCount_ - 1;
101 if (!stream_.read(buffer_,
static_cast<std::streamsize
>(bufferSize_))) {
102 readCount_ =
static_cast<size_t>(stream_.gcount());
103 *(bufferLast_ = buffer_ + readCount_) =
'\0';
110 Ch peekBuffer_[4], *buffer_;
122 #if defined(__clang__) || defined(_MSC_VER)
128 #endif // RAPIDJSON_ISTREAMWRAPPER_H_
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:124
Ch * PutBegin()
Definition: istreamwrapper.h:79
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:121
void Flush()
Definition: istreamwrapper.h:78
size_t Tell() const
Definition: istreamwrapper.h:74
const Ch * Peek4() const
Definition: istreamwrapper.h:83
BasicIStreamWrapper(StreamType &stream)
Constructor.
Definition: istreamwrapper.h:57
Ch Take()
Definition: istreamwrapper.h:73
BasicIStreamWrapper< std::wistream > WIStreamWrapper
Definition: istreamwrapper.h:120
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:437
void Put(Ch)
Definition: istreamwrapper.h:77
Wrapper of std::basic_istream into RapidJSON's Stream concept.
Definition: istreamwrapper.h:49
Ch Peek() const
Definition: istreamwrapper.h:72
StreamType::char_type Ch
Definition: istreamwrapper.h:51
size_t PutEnd(Ch *)
Definition: istreamwrapper.h:80
BasicIStreamWrapper< std::istream > IStreamWrapper
Definition: istreamwrapper.h:119
BasicIStreamWrapper(StreamType &stream, char *buffer, size_t bufferSize)
Constructor.
Definition: istreamwrapper.h:67