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

#include <filesystem_helper.h>

+ Inheritance diagram for reader_membuffer_mirror:

Public Member Functions

bool get_content_type (pfc::string_base &out)
 
t_filetimestamp get_timestamp (abort_callback &p_abort)
 
bool is_remote ()
 
- Public Member Functions inherited from reader_membuffer_base
 reader_membuffer_base ()
 
bool can_seek ()
 
t_filesize get_position (abort_callback &p_abort)
 
t_filesize get_size (abort_callback &p_abort)
 
bool is_in_memory ()
 
t_size read (void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 
void reopen (abort_callback &p_abort)
 
void seek (t_filesize position, abort_callback &p_abort)
 
void write (const void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 

Static Public Member Functions

static bool g_create (service_ptr_t< file > &p_out, const service_ptr_t< file > &p_src, abort_callback &p_abort)
 

Private Member Functions

const void * get_buffer ()
 
t_size get_buffer_size ()
 
bool init (const service_ptr_t< file > &p_src, abort_callback &p_abort)
 

Private Attributes

pfc::array_t< char > m_buffer
 
pfc::string8 m_contentType
 
bool m_remote
 
t_filetimestamp m_timestamp
 

Additional Inherited Members

- Protected Member Functions inherited from reader_membuffer_base
void seek_internal (t_size p_offset)
 

Detailed Description

Definition at line 73 of file filesystem_helper.h.

Member Function Documentation

static bool reader_membuffer_mirror::g_create ( service_ptr_t< file > &  p_out,
const service_ptr_t< file > &  p_src,
abort_callback p_abort 
)
inlinestatic

Returns false when the object could not be mirrored (too big) or did not need mirroring.

Definition at line 80 of file filesystem_helper.h.

80  {
82  if (!ptr->init(p_src,p_abort)) return false;
83  p_out = ptr.get_ptr();
84  return true;
85  }
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
Definition: service_impl.h:4
T * get_ptr() const
Definition: service.h:117
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
const void* reader_membuffer_mirror::get_buffer ( )
inlineprivatevirtual

Implements reader_membuffer_base.

Definition at line 91 of file filesystem_helper.h.

91 {return m_buffer.get_ptr();}
const t_item * get_ptr() const
Definition: array.h:213
pfc::array_t< char > m_buffer
t_size reader_membuffer_mirror::get_buffer_size ( )
inlineprivatevirtual

Implements reader_membuffer_base.

Definition at line 92 of file filesystem_helper.h.

92 {return m_buffer.get_size();}
pfc::array_t< char > m_buffer
t_size get_size() const
Definition: array.h:130
bool reader_membuffer_mirror::get_content_type ( pfc::string_base out)
inlinevirtual

Reimplemented from reader_membuffer_base.

Definition at line 86 of file filesystem_helper.h.

86  {
87  if (m_contentType.is_empty()) return false;
88  out = m_contentType; return true;
89  }
bool is_empty() const
Definition: string_base.h:213
t_filetimestamp reader_membuffer_mirror::get_timestamp ( abort_callback p_abort)
inlinevirtual

Implements reader_membuffer_base.

Definition at line 76 of file filesystem_helper.h.

76 {return m_timestamp;}
bool reader_membuffer_mirror::init ( const service_ptr_t< file > &  p_src,
abort_callback p_abort 
)
inlineprivate

Definition at line 94 of file filesystem_helper.h.

94  {
95  if (p_src->is_in_memory()) return false;//already buffered
96  if (!p_src->get_content_type(m_contentType)) m_contentType.reset();
97  m_remote = p_src->is_remote();
98 
99  t_size size = pfc::downcast_guarded<t_size>(p_src->get_size(p_abort));
100 
101  m_buffer.set_size(size);
102 
103  p_src->reopen(p_abort);
104 
105  p_src->read_object(m_buffer.get_ptr(),size,p_abort);
106 
107  m_timestamp = p_src->get_timestamp(p_abort);
108 
109  return true;
110  }
const t_item * get_ptr() const
Definition: array.h:213
size_t t_size
Definition: int_types.h:48
void set_size(t_size p_size)
Definition: array.h:104
pfc::array_t< char > m_buffer
bool reader_membuffer_mirror::is_remote ( )
inline

Definition at line 77 of file filesystem_helper.h.

Field Documentation

pfc::array_t<char> reader_membuffer_mirror::m_buffer
private

Definition at line 114 of file filesystem_helper.h.

pfc::string8 reader_membuffer_mirror::m_contentType
private

Definition at line 116 of file filesystem_helper.h.

bool reader_membuffer_mirror::m_remote
private

Definition at line 115 of file filesystem_helper.h.

t_filetimestamp reader_membuffer_mirror::m_timestamp
private

Definition at line 113 of file filesystem_helper.h.


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