foobar2000 SDK  2015-08-03
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 747 of file filesystem_helper.h.

Constructor & Destructor Documentation

reader_bigmem::reader_bigmem ( )
inline

Definition at line 749 of file filesystem_helper.h.

749 : m_offset() {}

Member Function Documentation

bool reader_bigmem::can_seek ( )
inline

Definition at line 777 of file filesystem_helper.h.

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

Definition at line 782 of file filesystem_helper.h.

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

Definition at line 772 of file filesystem_helper.h.

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

Definition at line 771 of file filesystem_helper.h.

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

Definition at line 783 of file filesystem_helper.h.

783 {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 778 of file filesystem_helper.h.

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

Definition at line 784 of file filesystem_helper.h.

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

Definition at line 750 of file filesystem_helper.h.

750  {
751  pfc::min_acc( p_bytes, remaining() );
752  m_mem.read( p_buffer, p_bytes, m_offset );
753  m_offset += p_bytes;
754  return p_bytes;
755  }
size_t remaining() const
pfc::bigmem m_mem
void read(void *ptrOut, size_t bytes, size_t offset)
Definition: other.h:281
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 756 of file filesystem_helper.h.

756  {
757  if (p_bytes > remaining()) throw exception_io_data_truncation();
758  m_mem.read( p_buffer, p_bytes, m_offset );
759  m_offset += p_bytes;
760  }
size_t remaining() const
pfc::bigmem m_mem
void read(void *ptrOut, size_t bytes, size_t offset)
Definition: other.h:281
size_t reader_bigmem::remaining ( ) const
inlineprotected

Definition at line 790 of file filesystem_helper.h.

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

Definition at line 779 of file filesystem_helper.h.

779 {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 786 of file filesystem_helper.h.

786  {
787  m_offset = 0;
788  m_mem.resize( newSize );
789  }
pfc::bigmem m_mem
void resize(size_t newSize)
Definition: other.h:259
void reader_bigmem::seek ( t_filesize  p_position,
abort_callback p_abort 
)
inline

Definition at line 773 of file filesystem_helper.h.

773  {
774  if (p_position > m_mem.size()) throw exception_io_seek_out_of_range();
775  m_offset = (size_t) p_position;
776  }
pfc::bigmem m_mem
size_t size() const
Definition: other.h:275
t_filesize reader_bigmem::skip ( t_filesize  p_bytes,
abort_callback p_abort 
)
inline

Definition at line 761 of file filesystem_helper.h.

761  {
762  pfc::min_acc( p_bytes, (t_filesize) remaining() );
763  m_offset += (size_t) p_bytes;
764  return p_bytes;
765  }
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 766 of file filesystem_helper.h.

766  {
767  if (p_bytes > remaining()) throw exception_io_data_truncation();
768  m_offset += (size_t) p_bytes;
769  }
size_t remaining() const

Field Documentation

pfc::bigmem reader_bigmem::m_mem
protected

Definition at line 791 of file filesystem_helper.h.

size_t reader_bigmem::m_offset
protected

Definition at line 792 of file filesystem_helper.h.


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