15 #ifndef RAPIDJSON_MEMORYSTREAM_H_
16 #define RAPIDJSON_MEMORYSTREAM_H_
20 RAPIDJSON_NAMESPACE_BEGIN
37 MemoryStream(
const Ch *src,
size_t size) : src_(src), begin_(src), end_(src + size), size_(size) {}
39 Ch Peek()
const {
return (src_ == end_) ?
'\0' : *src_; }
40 Ch Take() {
return (src_ == end_) ?
'\0' : *src_++; }
41 size_t Tell()
const {
return static_cast<size_t>(src_ - begin_); }
49 const Ch* Peek4()
const {
50 return Tell() + 4 <= size_ ? src_ : 0;
59 RAPIDJSON_NAMESPACE_END
61 #endif // RAPIDJSON_MEMORYBUFFER_H_
Represents an in-memory input byte stream.
Definition: memorystream.h:34
size_t size_
Size of the stream.
Definition: memorystream.h:56
const Ch * end_
End of stream.
Definition: memorystream.h:55
const Ch * begin_
Original head of the string.
Definition: memorystream.h:54
const Ch * src_
Current read position.
Definition: memorystream.h:53
common definitions and configuration
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344