The Micro C++ Library
|
A Reader class defines methods to read from a Stream. More...
#include <micxx/traits/Reader.hxx>
Public Types | |
typedef CharType | char_type |
typedef OffType | off_type |
Public Member Functions | |
virtual | ~Reader () |
The Reader destructor. | |
virtual void | ignore (off_type size=1, int delim=EOF)=0 |
The stream is positioned either size bytes forward or until delim is read (if this occurs before size bytes could be read). | |
virtual bool | read (Buffer &buffer) |
Try to read size bytes into buffer. | |
virtual off_type | read (void *buffer, off_type size)=0 |
Read size Reader::char_type into buffer. |
A Reader class defines methods to read from a Stream.
typedef CharType micxx::traits::Reader< CharType, OffType >::char_type |
Reimplemented in micxx::File.
typedef OffType micxx::traits::Reader< CharType, OffType >::off_type |
Reimplemented in micxx::File.
virtual micxx::traits::Reader< CharType, OffType >::~Reader | ( | ) | [inline, virtual] |
The Reader destructor.
{}
virtual void micxx::traits::Reader< CharType, OffType >::ignore | ( | off_type | size = 1 , |
int | delim = EOF |
||
) | [pure virtual] |
The stream is positioned either size bytes forward or until delim is read (if this occurs before size bytes could be read).
Implemented in micxx::File, and micxx::StreamReader.
virtual off_type micxx::traits::Reader< CharType, OffType >::read | ( | void * | buffer, |
off_type | size | ||
) | [pure virtual] |
Read size Reader::char_type into buffer.
If buffer is 0
, the stream is positioned size bytes forward.
Implemented in micxx::File, and micxx::StreamReader.
virtual bool micxx::traits::Reader< CharType, OffType >::read | ( | Buffer & | buffer | ) | [inline, virtual] |
Try to read size bytes into buffer.
true
, if all buffer.getSize()
bytes were successfully read,false
, otherwise. The buffer's size is set to the number of actually read bytes in that case. { __MICXXTRY__ off_type bytesRead = read(buffer.getAddress(), buffer.getSize()); if (bytesRead == buffer.getSize()) { return true; } buffer.setSize(bytesRead); return false; __MICXXEND__ }