foobar2000 SDK  2015-01-14
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 65 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 72 of file filesystem_helper.h.

72  {
74  if (!ptr->init(p_src,p_abort)) return false;
75  p_out = ptr.get_ptr();
76  return true;
77  }
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 83 of file filesystem_helper.h.

83 {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 84 of file filesystem_helper.h.

84 {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 78 of file filesystem_helper.h.

78  {
79  if (m_contentType.is_empty()) return false;
80  out = m_contentType; return true;
81  }
bool is_empty() const
Definition: string_base.h:212
t_filetimestamp reader_membuffer_mirror::get_timestamp ( abort_callback p_abort)
inlinevirtual

Implements reader_membuffer_base.

Definition at line 68 of file filesystem_helper.h.

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

Definition at line 86 of file filesystem_helper.h.

86  {
87  if (p_src->is_in_memory()) return false;//already buffered
88  if (!p_src->get_content_type(m_contentType)) m_contentType.reset();
89  m_remote = p_src->is_remote();
90 
91  t_size size = pfc::downcast_guarded<t_size>(p_src->get_size(p_abort));
92 
93  m_buffer.set_size(size);
94 
95  p_src->reopen(p_abort);
96 
97  p_src->read_object(m_buffer.get_ptr(),size,p_abort);
98 
99  m_timestamp = p_src->get_timestamp(p_abort);
100 
101  return true;
102  }
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 69 of file filesystem_helper.h.

Field Documentation

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

Definition at line 106 of file filesystem_helper.h.

pfc::string8 reader_membuffer_mirror::m_contentType
private

Definition at line 108 of file filesystem_helper.h.

bool reader_membuffer_mirror::m_remote
private

Definition at line 107 of file filesystem_helper.h.

t_filetimestamp reader_membuffer_mirror::m_timestamp
private

Definition at line 105 of file filesystem_helper.h.


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