foobar2000 SDK  2015-01-14
Public Member Functions | Private Attributes
reader_bigmem_mirror

#include <filesystem_helper.h>

+ Inheritance diagram for reader_bigmem_mirror:

Public Member Functions

 reader_bigmem_mirror ()
 
bool get_content_type (pfc::string_base &p_out)
 
t_filetimestamp get_timestamp (abort_callback &p_abort)
 
void init (file::ptr source, abort_callback &abort)
 
bool is_remote ()
 
- Public Member Functions inherited from reader_bigmem
 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)
 

Private Attributes

pfc::string8 m_contentType
 
bool m_isRemote
 
t_filetimestamp m_ts
 

Additional Inherited Members

- Protected Member Functions inherited from reader_bigmem
size_t remaining () const
 
void resize (size_t newSize)
 
- Protected Attributes inherited from reader_bigmem
pfc::bigmem m_mem
 
size_t m_offset
 

Detailed Description

Definition at line 787 of file filesystem_helper.h.

Constructor & Destructor Documentation

reader_bigmem_mirror::reader_bigmem_mirror ( )
inline

Definition at line 789 of file filesystem_helper.h.

789 {}

Member Function Documentation

bool reader_bigmem_mirror::get_content_type ( pfc::string_base p_out)
inline

Definition at line 808 of file filesystem_helper.h.

808  {
809  if (m_contentType.is_empty()) return false;
810  p_out = m_contentType; return true;
811  }
bool is_empty() const
Definition: string_base.h:212
t_filetimestamp reader_bigmem_mirror::get_timestamp ( abort_callback p_abort)
inline

Definition at line 812 of file filesystem_helper.h.

812 {return m_ts;}
void reader_bigmem_mirror::init ( file::ptr  source,
abort_callback abort 
)
inline

Definition at line 791 of file filesystem_helper.h.

791  {
792  source->reopen(abort);
793  t_filesize fs = source->get_size(abort);
794  if (fs > 1024*1024*1024) { // reject > 1GB
795  throw std::bad_alloc();
796  }
797  size_t s = (size_t) fs;
798  resize(s);
799  for(size_t walk = 0; walk < m_mem._sliceCount(); ++walk) {
800  source->read( m_mem._slicePtr(walk), m_mem._sliceSize(walk), abort );
801  }
802 
803  if (!source->get_content_type( m_contentType ) ) m_contentType.reset();
804  m_isRemote = source->is_remote();
805  m_ts = source->get_timestamp( abort );
806  }
pfc::bigmem m_mem
size_t _sliceCount()
Definition: other.h:298
size_t _sliceSize(size_t which)
Definition: other.h:299
uint8_t * _slicePtr(size_t which)
Definition: other.h:297
void resize(size_t newSize)
t_uint64 t_filesize
Type used for file size related variables.
Definition: filesystem.h:8
bool reader_bigmem_mirror::is_remote ( )
inline

Definition at line 813 of file filesystem_helper.h.

813 {return m_isRemote;}

Field Documentation

pfc::string8 reader_bigmem_mirror::m_contentType
private

Definition at line 816 of file filesystem_helper.h.

bool reader_bigmem_mirror::m_isRemote
private

Definition at line 817 of file filesystem_helper.h.

t_filetimestamp reader_bigmem_mirror::m_ts
private

Definition at line 815 of file filesystem_helper.h.


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