#include <Pt/TextStream.h>
Converts character sequences using a codec. More...
Inherits BasicIStream< CharT >.
Public Types | |
| typedef ByteT | extern_type |
| External character type. | |
| typedef CharT | intern_type |
| Internal character type. | |
| typedef CharT | char_type |
| Internal character type. | |
| typedef std::char_traits< CharT > | traits_type |
| Internal character traits. | |
| typedef traits_type::int_type | int_type |
| Integer type. | |
| typedef traits_type::pos_type | pos_type |
| Stream position type. | |
| typedef traits_type::off_type | off_type |
| Stream offset type. | |
| typedef std::basic_istream< extern_type > | StreamType |
| External stream type. | |
| typedef TextCodec< char_type, extern_type > | CodecType |
| Codec type. | |
Public Member Functions | |
| BasicTextIStream (StreamType &is, CodecType *codec) | |
| Construct with input stream and codec. More... | |
| BasicTextIStream (CodecType *codec) | |
| Construct with codec. More... | |
| ~BasicTextIStream () | |
| Destructor. | |
| CodecType * | codec () |
| Returns the used code or a nullptr. | |
| void | setCodec (CodecType *codec) |
| Sets the text codec. More... | |
| void | attach (StreamType &is) |
| Attach to external target. | |
| void | detach () |
| Detach from external target. | |
| void | discard () |
| Discards the buffer. | |
| void | reset () |
| Resets the buffer and target. More... | |
| void | reset (StreamType &is) |
| Resets the buffer and target. More... | |
| BasicTextBuffer< intern_type, extern_type > & | textBuffer () |
| Returns the stream buffer. | |
| std::streamsize | peeksome (CharT *buffer, std::streamsize n) |
| Peeks bytes in the stream buffer. More... | |
| BasicStreamBuffer< CharT > * | buffer () |
| Returns the buffer. | |
| void | setBuffer (BasicStreamBuffer< CharT > *sb) |
| Sets the buffer. | |
This stream decodes an external character sequence using a codec. Reading from the stream will convert from the the encoding of external characters.
| BasicTextIStream | ( | StreamType & | is, |
| CodecType * | codec | ||
| ) |
The input stream is is used to read a character sequence and convert it using the codec codec. The codec object which is passed as pointer will be managed by this class and deleted if its reference count reaches 0.
|
explicit |
The codec object which is passed as pointer will be managed by this class and deleted if its reference count reaches 0.
| void setCodec | ( | CodecType * | codec | ) |
The codec object which is passed as pointer will be managed by this class and deleted if its reference count reaches 0.
| void reset | ( | ) |
The target is detached and the buffer content is discarded. The codec is kept, if one was set previously.
| void reset | ( | StreamType & | is | ) |
Attaches to the new target and discards the buffer. The codec is kept, if one was set previously.
|
inherited |
The number of bytes that can be peeked depends on the current stream buffer get area and maybe less than requested, similar to istream::readsome().