foobar2000_io::stream_reader Class Reference

#include <filesystem.h>

Inheritance diagram for foobar2000_io::stream_reader:

foobar2000_io::file foobar2000_io::file_dynamicinfo

List of all members.

Public Member Functions

virtual t_size read (void *p_buffer, t_size p_bytes, abort_callback &p_abort)=0
virtual void read_object (void *p_buffer, t_size p_bytes, abort_callback &p_abort)
virtual t_filesize skip (t_filesize p_bytes, abort_callback &p_abort)
virtual void skip_object (t_filesize p_bytes, abort_callback &p_abort)
template<typename T>
void read_object_t (T &p_object, abort_callback &p_abort)
template<typename T>
void read_lendian_t (T &p_object, abort_callback &p_abort)
template<typename T>
void read_bendian_t (T &p_object, abort_callback &p_abort)
void read_string (pfc::string_base &p_out, abort_callback &p_abort)
 Helper function; reads a string (with a 32-bit header indicating length in bytes followed by UTF-8 encoded data without a null terminator).
void read_string_raw (pfc::string_base &p_out, abort_callback &p_abort)
 Helper function; alternate way of storing strings; assumes string takes space up to end of stream.
pfc::string read_string (abort_callback &p_abort)
 Helper function; reads a string (with a 32-bit header indicating length in bytes followed by UTF-8 encoded data without a null terminator).
void read_string_ex (pfc::string_base &p_out, t_size p_bytes, abort_callback &p_abort)
 Helper function; reads a string of specified length from the stream.
pfc::string read_string_ex (t_size p_len, abort_callback &p_abort)
 Helper function; reads a string of specified length from the stream.

Protected Member Functions

 stream_reader ()
 ~stream_reader ()


Detailed Description

Generic interface to read data from a nonseekable stream. Also see: stream_writer, file.
Error handling: all methods may throw exception_io or one of derivatives on failure; exception_aborted when abort_callback is signaled.

Constructor & Destructor Documentation

foobar2000_io::stream_reader::stream_reader (  )  [inline, protected]

foobar2000_io::stream_reader::~stream_reader (  )  [inline, protected]


Member Function Documentation

virtual t_size foobar2000_io::stream_reader::read ( void *  p_buffer,
t_size  p_bytes,
abort_callback p_abort 
) [pure virtual]

Attempts to reads specified number of bytes from the stream.

Parameters:
p_buffer Receives data being read. Must have at least p_bytes bytes of space allocated.
p_bytes Number of bytes to read.
p_abort abort_callback object signaling user aborting the operation.
Returns:
Number of bytes actually read. May be less than requested when EOF was reached.

virtual void foobar2000_io::stream_reader::read_object ( void *  p_buffer,
t_size  p_bytes,
abort_callback p_abort 
) [virtual]

Reads specified number of bytes from the stream. If requested amount of bytes can't be read (e.g. EOF), throws exception_io_data_truncation.

Parameters:
p_buffer Receives data being read. Must have at least p_bytes bytes of space allocated.
p_bytes Number of bytes to read.
p_abort abort_callback object signaling user aborting the operation.

virtual t_filesize foobar2000_io::stream_reader::skip ( t_filesize  p_bytes,
abort_callback p_abort 
) [virtual]

Attempts to skip specified number of bytes in the stream.

Parameters:
p_bytes Number of bytes to skip.
p_abort abort_callback object signaling user aborting the operation.
Returns:
Number of bytes actually skipped, May be less than requested when EOF was reached.

Reimplemented in foobar2000_io::file.

virtual void foobar2000_io::stream_reader::skip_object ( t_filesize  p_bytes,
abort_callback p_abort 
) [virtual]

Skips specified number of bytes in the stream. If requested amount of bytes can't be skipped (e.g. EOF), throws exception_io_data_truncation.

Parameters:
p_bytes Number of bytes to skip.
p_abort abort_callback object signaling user aborting the operation.

template<typename T>
void foobar2000_io::stream_reader::read_object_t ( T &  p_object,
abort_callback p_abort 
) [inline]

Helper template built around read_object. Reads single raw object from the stream.

Parameters:
p_object Receives object read from the stream on success.
p_abort abort_callback object signaling user aborting the operation.

template<typename T>
void foobar2000_io::stream_reader::read_lendian_t ( T &  p_object,
abort_callback p_abort 
) [inline]

Helper template built around read_object. Reads single raw object from the stream; corrects byte order assuming stream uses little endian order.

Parameters:
p_object Receives object read from the stream on success.
p_abort abort_callback object signaling user aborting the operation.

template<typename T>
void foobar2000_io::stream_reader::read_bendian_t ( T &  p_object,
abort_callback p_abort 
) [inline]

Helper template built around read_object. Reads single raw object from the stream; corrects byte order assuming stream uses big endian order.

Parameters:
p_object Receives object read from the stream on success.
p_abort abort_callback object signaling user aborting the operation.

void foobar2000_io::stream_reader::read_string ( pfc::string_base p_out,
abort_callback p_abort 
)

Helper function; reads a string (with a 32-bit header indicating length in bytes followed by UTF-8 encoded data without a null terminator).

void foobar2000_io::stream_reader::read_string_raw ( pfc::string_base p_out,
abort_callback p_abort 
)

Helper function; alternate way of storing strings; assumes string takes space up to end of stream.

pfc::string foobar2000_io::stream_reader::read_string ( abort_callback p_abort  ) 

Helper function; reads a string (with a 32-bit header indicating length in bytes followed by UTF-8 encoded data without a null terminator).

void foobar2000_io::stream_reader::read_string_ex ( pfc::string_base p_out,
t_size  p_bytes,
abort_callback p_abort 
)

Helper function; reads a string of specified length from the stream.

pfc::string foobar2000_io::stream_reader::read_string_ex ( t_size  p_len,
abort_callback p_abort 
)

Helper function; reads a string of specified length from the stream.


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

Generated on Fri Apr 25 18:49:55 2008 for foobar2000 SDK by  doxygen 1.5.5