Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
BasicIStreamWrapper< StreamType > Class Template Reference

Wrapper of std::basic_istream into RapidJSON's Stream concept. More...

#include <istreamwrapper.h>

Public Types

typedef StreamType::char_type Ch
 

Public Member Functions

 BasicIStreamWrapper (StreamType &stream)
 Constructor.
 
 BasicIStreamWrapper (StreamType &stream, char *buffer, size_t bufferSize)
 Constructor.
 
Ch Peek () const
 
Ch Take ()
 
size_t Tell () const
 
void Put (Ch)
 
void Flush ()
 
ChPutBegin ()
 
size_t PutEnd (Ch *)
 
const ChPeek4 () const
 

Detailed Description

template<typename StreamType>
class BasicIStreamWrapper< StreamType >

The classes can be wrapped including but not limited to:

  • std::istringstream
  • std::stringstream
  • std::wistringstream
  • std::wstringstream
  • std::ifstream
  • std::fstream
  • std::wifstream
  • std::wfstream
Template Parameters
StreamTypeClass derived from std::basic_istream.

Definition at line 49 of file istreamwrapper.h.

Member Typedef Documentation

◆ Ch

template<typename StreamType >
StreamType::char_type BasicIStreamWrapper< StreamType >::Ch

Definition at line 51 of file istreamwrapper.h.

Constructor & Destructor Documentation

◆ BasicIStreamWrapper() [1/2]

template<typename StreamType >
BasicIStreamWrapper< StreamType >::BasicIStreamWrapper ( StreamType & stream)
inline
Parameters
streamstream opened for read.

Definition at line 57 of file istreamwrapper.h.

57 : stream_(stream), buffer_(peekBuffer_), bufferSize_(4), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) {
58 Read();
59 }

◆ BasicIStreamWrapper() [2/2]

template<typename StreamType >
BasicIStreamWrapper< StreamType >::BasicIStreamWrapper ( StreamType & stream,
char * buffer,
size_t bufferSize )
inline
Parameters
streamstream opened for read.
bufferuser-supplied buffer.
bufferSizesize of buffer in bytes. Must >=4 bytes.

Definition at line 67 of file istreamwrapper.h.

67 : stream_(stream), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) {
68 RAPIDJSON_ASSERT(bufferSize >= 4);
69 Read();
70 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition rapidjson.h:406

Member Function Documentation

◆ Flush()

template<typename StreamType >
void BasicIStreamWrapper< StreamType >::Flush ( )
inline

Definition at line 78 of file istreamwrapper.h.

78{ RAPIDJSON_ASSERT(false); }

◆ Peek()

template<typename StreamType >
Ch BasicIStreamWrapper< StreamType >::Peek ( ) const
inline

Definition at line 72 of file istreamwrapper.h.

72{ return *current_; }

◆ Peek4()

template<typename StreamType >
const Ch * BasicIStreamWrapper< StreamType >::Peek4 ( ) const
inline

Definition at line 83 of file istreamwrapper.h.

83 {
84 return (current_ + 4 - !eof_ <= bufferLast_) ? current_ : 0;
85 }

◆ Put()

template<typename StreamType >
void BasicIStreamWrapper< StreamType >::Put ( Ch )
inline

Definition at line 77 of file istreamwrapper.h.

77{ RAPIDJSON_ASSERT(false); }

◆ PutBegin()

template<typename StreamType >
Ch * BasicIStreamWrapper< StreamType >::PutBegin ( )
inline

Definition at line 79 of file istreamwrapper.h.

79{ RAPIDJSON_ASSERT(false); return 0; }

◆ PutEnd()

template<typename StreamType >
size_t BasicIStreamWrapper< StreamType >::PutEnd ( Ch * )
inline

Definition at line 80 of file istreamwrapper.h.

80{ RAPIDJSON_ASSERT(false); return 0; }

◆ Take()

template<typename StreamType >
Ch BasicIStreamWrapper< StreamType >::Take ( )
inline

Definition at line 73 of file istreamwrapper.h.

73{ Ch c = *current_; Read(); return c; }
StreamType::char_type Ch

◆ Tell()

template<typename StreamType >
size_t BasicIStreamWrapper< StreamType >::Tell ( ) const
inline

Definition at line 74 of file istreamwrapper.h.

74{ return count_ + static_cast<size_t>(current_ - buffer_); }

The documentation for this class was generated from the following file: