Go to the SVN repository for this file.
20 #ifndef RAPIDJSON_ISTREAMASYNC_H_ 21 #define RAPIDJSON_ISTREAMASYNC_H_ 29RAPIDJSON_DIAG_OFF(padded)
34RAPIDJSON_DIAG_OFF(4351)
55 template<
typenameStreamType>
61: stream_(stream), count_(0), bufferSize_(bufferSize)
63 buffer[0] = std::make_unique< Ch[] >(bufferSize_);
64 buffer[1] = std::make_unique< Ch[] >(bufferSize_);
66bufferLast_ = current_ =
buffer[destbuffer].get();
68pos_ = stream_.tellg();
75stream_.seekg(pos_ + count_);
88 size_t Tell()
const{
returncount_; }
114std::future< size_t >
ft;
117ft = std::async( std::launch::async, [&]() {
118 return(
size_t)stream_.rdbuf()->sgetn(
buffer[destbuffer].get(), bufferSize_);
122 if(!eof_ && current_ == bufferLast_) {
123current_ =
buffer[destbuffer].get();
124bufferLast_ = current_ + ft.get();
125destbuffer = (destbuffer + 1)%2;
126 if(current_ != bufferLast_) {
132 if(current_ < bufferLast_) {
136 if(!eof_ && current_ == bufferLast_) {
138 if(current_ == bufferLast_) {
149 #if defined(__clang__) || defined(_MSC_VER)Wrapper of std::basic_istream into RapidJSON's Stream concept.
BasicIStreamAsyncWrapper(const BasicIStreamAsyncWrapper &)
BasicIStreamAsyncWrapper(StreamType &stream, size_t bufferSize=64 *1024)
size_t count_
Number of characters read. Note:
BasicIStreamAsyncWrapper & operator=(const BasicIStreamAsyncWrapper &)
~BasicIStreamAsyncWrapper()
void Read(CObjectIStream &in, TObjectPtr object, const CTypeRef &type)
#define RAPIDJSON_ASSERT(x)
Assertion.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
string_type::value_type char_type
The character type used by the parser.
BasicIStreamAsyncWrapper< std::istream > IStreamAsyncWrapper
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4