Claw  1.7.3
Public Member Functions | List of all members
claw::buffered_istream< Stream > Class Template Reference

This class is made to help reading istreams with a buffer. More...

#include <buffered_istream.hpp>

Public Member Functions

 buffered_istream (stream_type &f)
 Constructor.
 ~buffered_istream ()
 Destructor.
unsigned int remaining () const
 Tell how many bytes are ready in the buffer.
bool read_more (unsigned int n)
 Increase the number of ready bytes to a given number.
const char * get_buffer () const
 Get the input buffer.
char get_next ()
 Get the next value in the buffer and move one byte forward.
bool read (char *buf, unsigned int n)
 Read a range of data.
void move (unsigned int n)
 Move some bytes forward.
void close ()
 Closes this buffer (not the stream).
 operator bool () const
 Tell if there is still datas in the buffer/stream.

Detailed Description

template<typename Stream>
class claw::buffered_istream< Stream >

This class is made to help reading istreams with a buffer.

Author
Julien Jorge

Definition at line 42 of file buffered_istream.hpp.

Constructor & Destructor Documentation

template<typename Stream >
claw::buffered_istream< Stream >::buffered_istream ( stream_type &  f)

Constructor.

Parameters
fThe file associated to the stream.

Definition at line 38 of file buffered_istream.tpp.

Member Function Documentation

template<typename Stream >
void claw::buffered_istream< Stream >::close ( )

Closes this buffer (not the stream).

The cursor of the stream is repositioned according to the remaining data, and the buffer is cleared.

Definition at line 183 of file buffered_istream.tpp.

template<typename Stream >
void claw::buffered_istream< Stream >::move ( unsigned int  n)

Move some bytes forward.

Parameters
nThe number of bytes to skip.

Definition at line 169 of file buffered_istream.tpp.

template<typename Stream >
bool claw::buffered_istream< Stream >::read ( char *  buf,
unsigned int  n 
)

Read a range of data.

Parameters
bufThe buffer in which we write the read data.
nThe number of bytes to read.

Definition at line 145 of file buffered_istream.tpp.

template<typename Stream >
bool claw::buffered_istream< Stream >::read_more ( unsigned int  n)

Increase the number of ready bytes to a given number.

Parameters
nThe number of bytes you need.
Remarks
This method reads n - remaining() bytes from the file.

Definition at line 77 of file buffered_istream.tpp.


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