foobar2000 SDK  2015-01-14
Public Member Functions | Protected Member Functions | Protected Attributes
reader_bigmem

#include <filesystem_helper.h>

+ Inheritance diagram for reader_bigmem:

Public Member Functions

 reader_bigmem ()
 
bool can_seek ()
 
bool get_content_type (pfc::string_base &p_out)
 
t_filesize get_position (abort_callback &p_abort)
 
t_filesize get_size (abort_callback &p_abort)
 
t_filetimestamp get_timestamp (abort_callback &p_abort)
 
bool is_in_memory ()
 
bool is_remote ()
 
t_size read (void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 
void read_object (void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 
void reopen (abort_callback &p_abort)
 
void seek (t_filesize p_position, abort_callback &p_abort)
 
t_filesize skip (t_filesize p_bytes, abort_callback &p_abort)
 
void skip_object (t_filesize p_bytes, abort_callback &p_abort)
 

Protected Member Functions

size_t remaining () const
 
void resize (size_t newSize)
 

Protected Attributes

pfc::bigmem m_mem
 
size_t m_offset
 

Detailed Description

Definition at line 739 of file filesystem_helper.h.

Constructor & Destructor Documentation

reader_bigmem::reader_bigmem ( )
inline

Definition at line 741 of file filesystem_helper.h.

741 : m_offset() {}

Member Function Documentation

bool reader_bigmem::can_seek ( )
inline

Definition at line 769 of file filesystem_helper.h.

769 {return true;}
bool reader_bigmem::get_content_type ( pfc::string_base p_out)
inline

Definition at line 774 of file filesystem_helper.h.

774 {return false;}
t_filesize reader_bigmem::get_position ( abort_callback p_abort)
inline

Definition at line 764 of file filesystem_helper.h.

764 {p_abort.check(); return m_offset;}
t_filesize reader_bigmem::get_size ( abort_callback p_abort)
inline

Definition at line 763 of file filesystem_helper.h.

763 {p_abort.check(); return m_mem.size();}
pfc::bigmem m_mem
size_t size() const
Definition: other.h:267
t_filetimestamp reader_bigmem::get_timestamp ( abort_callback p_abort)
inline

Definition at line 775 of file filesystem_helper.h.

775 {return filetimestamp_invalid;}
const t_filetimestamp filetimestamp_invalid
Invalid/unknown file timestamp constant. Also see: t_filetimestamp.
Definition: filesystem.h:14
bool reader_bigmem::is_in_memory ( )
inline

Definition at line 770 of file filesystem_helper.h.

770 {return true;}
bool reader_bigmem::is_remote ( )
inline

Definition at line 776 of file filesystem_helper.h.

776 {return false;}
t_size reader_bigmem::read ( void *  p_buffer,
t_size  p_bytes,
abort_callback p_abort 
)
inline

Definition at line 742 of file filesystem_helper.h.

742  {
743  pfc::min_acc( p_bytes, remaining() );
744  m_mem.read( p_buffer, p_bytes, m_offset );
745  m_offset += p_bytes;
746  return p_bytes;
747  }
size_t remaining() const
pfc::bigmem m_mem
void read(void *ptrOut, size_t bytes, size_t offset)
Definition: other.h:273
void min_acc(t_val &p_acc, const t_val &p_val)
Definition: primitives.h:829
void reader_bigmem::read_object ( void *  p_buffer,
t_size  p_bytes,
abort_callback p_abort 
)
inline

Definition at line 748 of file filesystem_helper.h.

748  {
749  if (p_bytes > remaining()) throw exception_io_data_truncation();
750  m_mem.read( p_buffer, p_bytes, m_offset );
751  m_offset += p_bytes;
752  }
size_t remaining() const
pfc::bigmem m_mem
void read(void *ptrOut, size_t bytes, size_t offset)
Definition: other.h:273
size_t reader_bigmem::remaining ( ) const
inlineprotected

Definition at line 782 of file filesystem_helper.h.

782 {return m_mem.size() - m_offset;}
pfc::bigmem m_mem
size_t size() const
Definition: other.h:267
void reader_bigmem::reopen ( abort_callback p_abort)
inline

Definition at line 771 of file filesystem_helper.h.

771 {seek(0, p_abort);}
void seek(t_filesize p_position, abort_callback &p_abort)
void reader_bigmem::resize ( size_t  newSize)
inlineprotected

Definition at line 778 of file filesystem_helper.h.

778  {
779  m_offset = 0;
780  m_mem.resize( newSize );
781  }
pfc::bigmem m_mem
void resize(size_t newSize)
Definition: other.h:251
void reader_bigmem::seek ( t_filesize  p_position,
abort_callback p_abort 
)
inline

Definition at line 765 of file filesystem_helper.h.

765  {
766  if (p_position > m_mem.size()) throw exception_io_seek_out_of_range();
767  m_offset = (size_t) p_position;
768  }
pfc::bigmem m_mem
size_t size() const
Definition: other.h:267
t_filesize reader_bigmem::skip ( t_filesize  p_bytes,
abort_callback p_abort 
)
inline

Definition at line 753 of file filesystem_helper.h.

753  {
754  pfc::min_acc( p_bytes, (t_filesize) remaining() );
755  m_offset += (size_t) p_bytes;
756  return p_bytes;
757  }
size_t remaining() const
t_uint64 t_filesize
Type used for file size related variables.
Definition: filesystem.h:8
void min_acc(t_val &p_acc, const t_val &p_val)
Definition: primitives.h:829
void reader_bigmem::skip_object ( t_filesize  p_bytes,
abort_callback p_abort 
)
inline

Definition at line 758 of file filesystem_helper.h.

758  {
759  if (p_bytes > remaining()) throw exception_io_data_truncation();
760  m_offset += (size_t) p_bytes;
761  }
size_t remaining() const

Field Documentation

pfc::bigmem reader_bigmem::m_mem
protected

Definition at line 783 of file filesystem_helper.h.

size_t reader_bigmem::m_offset
protected

Definition at line 784 of file filesystem_helper.h.


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