Electroneum
AutoUTFInputStream< CharType, InputByteStream > Class Template Reference

Input stream wrapper with dynamically bound encoding and automatic encoding detection. More...

#include <encodedstream.h>

Public Types

typedef CharType Ch
 

Public Member Functions

 AutoUTFInputStream (InputByteStream &is, UTFType type=kUTF8)
 Constructor. More...
 
UTFType GetType () const
 
bool HasBOM () const
 
Ch Peek () const
 
Ch Take ()
 
size_t Tell () const
 
void Put (Ch)
 
void Flush ()
 
ChPutBegin ()
 
size_t PutEnd (Ch *)
 

Detailed Description

template<typename CharType, typename InputByteStream>
class AutoUTFInputStream< CharType, InputByteStream >

Input stream wrapper with dynamically bound encoding and automatic encoding detection.

Template Parameters
CharTypeType of character for reading.
InputByteStreamtype of input byte stream to be wrapped.

Definition at line 135 of file encodedstream.h.

Member Typedef Documentation

◆ Ch

template<typename CharType, typename InputByteStream>
typedef CharType AutoUTFInputStream< CharType, InputByteStream >::Ch

Definition at line 138 of file encodedstream.h.

Constructor & Destructor Documentation

◆ AutoUTFInputStream()

template<typename CharType, typename InputByteStream>
AutoUTFInputStream< CharType, InputByteStream >::AutoUTFInputStream ( InputByteStream &  is,
UTFType  type = kUTF8 
)
inline

Constructor.

Parameters
isinput stream to be wrapped.
typeUTF encoding type if it is not detected from the stream.

Definition at line 145 of file encodedstream.h.

145  : is_(&is), type_(type), hasBOM_(false) {
146  RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);
147  DetectType();
148  static const TakeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Take) };
149  takeFunc_ = f[type_];
150  current_ = takeFunc_(*is_);
151  }
#define RAPIDJSON_ENCODINGS_FUNC(x)
UTF-32 big endian.
Definition: encodings.h:608
UTF-8.
Definition: encodings.h:604
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:411
Here is the call graph for this function:

Member Function Documentation

◆ Flush()

template<typename CharType, typename InputByteStream>
void AutoUTFInputStream< CharType, InputByteStream >::Flush ( )
inline

Definition at line 162 of file encodedstream.h.

162 { RAPIDJSON_ASSERT(false); }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:411

◆ GetType()

template<typename CharType, typename InputByteStream>
UTFType AutoUTFInputStream< CharType, InputByteStream >::GetType ( ) const
inline

Definition at line 153 of file encodedstream.h.

153 { return type_; }
Here is the caller graph for this function:

◆ HasBOM()

template<typename CharType, typename InputByteStream>
bool AutoUTFInputStream< CharType, InputByteStream >::HasBOM ( ) const
inline

Definition at line 154 of file encodedstream.h.

154 { return hasBOM_; }
Here is the caller graph for this function:

◆ Peek()

template<typename CharType, typename InputByteStream>
Ch AutoUTFInputStream< CharType, InputByteStream >::Peek ( ) const
inline

Definition at line 156 of file encodedstream.h.

156 { return current_; }

◆ Put()

template<typename CharType, typename InputByteStream>
void AutoUTFInputStream< CharType, InputByteStream >::Put ( Ch  )
inline

Definition at line 161 of file encodedstream.h.

161 { RAPIDJSON_ASSERT(false); }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:411

◆ PutBegin()

template<typename CharType, typename InputByteStream>
Ch* AutoUTFInputStream< CharType, InputByteStream >::PutBegin ( )
inline

Definition at line 163 of file encodedstream.h.

163 { RAPIDJSON_ASSERT(false); return 0; }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:411

◆ PutEnd()

template<typename CharType, typename InputByteStream>
size_t AutoUTFInputStream< CharType, InputByteStream >::PutEnd ( Ch )
inline

Definition at line 164 of file encodedstream.h.

164 { RAPIDJSON_ASSERT(false); return 0; }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:411

◆ Take()

template<typename CharType, typename InputByteStream>
Ch AutoUTFInputStream< CharType, InputByteStream >::Take ( )
inline

Definition at line 157 of file encodedstream.h.

157 { Ch c = current_; current_ = takeFunc_(*is_); return c; }
Here is the caller graph for this function:

◆ Tell()

template<typename CharType, typename InputByteStream>
size_t AutoUTFInputStream< CharType, InputByteStream >::Tell ( ) const
inline

Definition at line 158 of file encodedstream.h.

158 { return is_->Tell(); }

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