foobar2000 SDK  2015-08-03
Public Member Functions | Private Attributes
stream_reader_limited_ref

#include <filesystem_helper.h>

+ Inheritance diagram for stream_reader_limited_ref:

Public Member Functions

 stream_reader_limited_ref (stream_reader *p_reader, t_filesize p_limit)
 
void flush_remaining (abort_callback &p_abort)
 
t_filesize get_remaining () const
 
t_size read (void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 
t_filesize skip (t_filesize p_bytes, abort_callback &p_abort)
 

Private Attributes

stream_readerm_reader
 
t_filesize m_remaining
 

Detailed Description

Definition at line 284 of file filesystem_helper.h.

Constructor & Destructor Documentation

stream_reader_limited_ref::stream_reader_limited_ref ( stream_reader p_reader,
t_filesize  p_limit 
)
inline

Definition at line 286 of file filesystem_helper.h.

286 : m_reader(p_reader), m_remaining(p_limit) {}

Member Function Documentation

void stream_reader_limited_ref::flush_remaining ( abort_callback p_abort)
inline

Definition at line 305 of file filesystem_helper.h.

305  {
306  if (m_remaining > 0) skip_object(m_remaining,p_abort);
307  }
t_filesize stream_reader_limited_ref::get_remaining ( ) const
inline

Definition at line 296 of file filesystem_helper.h.

296 {return m_remaining;}
t_size stream_reader_limited_ref::read ( void *  p_buffer,
t_size  p_bytes,
abort_callback p_abort 
)
inline

Definition at line 288 of file filesystem_helper.h.

288  {
289  if (p_bytes > m_remaining) p_bytes = (t_size)m_remaining;
290 
291  t_size done = m_reader->read(p_buffer,p_bytes,p_abort);
292  m_remaining -= done;
293  return done;
294  }
size_t t_size
Definition: int_types.h:48
t_filesize stream_reader_limited_ref::skip ( t_filesize  p_bytes,
abort_callback p_abort 
)
inline

Definition at line 298 of file filesystem_helper.h.

298  {
299  if (p_bytes > m_remaining) p_bytes = m_remaining;
300  t_filesize done = m_reader->skip(p_bytes,p_abort);
301  m_remaining -= done;
302  return done;
303  }
t_uint64 t_filesize
Type used for file size related variables.
Definition: filesystem.h:8

Field Documentation

stream_reader* stream_reader_limited_ref::m_reader
private

Definition at line 310 of file filesystem_helper.h.

t_filesize stream_reader_limited_ref::m_remaining
private

Definition at line 311 of file filesystem_helper.h.


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