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

#include <filesystem_helper.h>

+ Inheritance diagram for stream_writer_chunk:

Public Member Functions

 stream_writer_chunk (stream_writer *p_writer)
 
void flush (abort_callback &p_abort)
 
void write (const void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 

Private Attributes

unsigned char m_buffer [255]
 
unsigned m_buffer_state
 
stream_writerm_writer
 

Detailed Description

Definition at line 344 of file filesystem_helper.h.

Constructor & Destructor Documentation

stream_writer_chunk::stream_writer_chunk ( stream_writer p_writer)
inline

Definition at line 347 of file filesystem_helper.h.

347 : m_writer(p_writer), m_buffer_state(0) {}
stream_writer * m_writer

Member Function Documentation

void stream_writer_chunk::flush ( abort_callback p_abort)

Definition at line 20 of file filesystem_helper.cpp.

21 {
22  m_writer->write_lendian_t((t_uint8)m_buffer_state,p_abort);
23  if (m_buffer_state > 0) {
24  m_writer->write_object(m_buffer,m_buffer_state,p_abort);
25  m_buffer_state = 0;
26  }
27 }
uint8_t t_uint8
Definition: int_types.h:9
unsigned char m_buffer[255]
stream_writer * m_writer
void stream_writer_chunk::write ( const void *  p_buffer,
t_size  p_bytes,
abort_callback p_abort 
)

Definition at line 3 of file filesystem_helper.cpp.

3  {
4  t_size remaining = p_bytes, written = 0;
5  while(remaining > 0) {
6  t_size delta = sizeof(m_buffer) - m_buffer_state;
7  if (delta > remaining) delta = remaining;
8  memcpy(m_buffer,(const t_uint8*)p_buffer + written,delta);
9  written += delta;
10  remaining -= delta;
11 
12  if (m_buffer_state == sizeof(m_buffer)) {
13  m_writer->write_lendian_t((t_uint8)m_buffer_state,p_abort);
14  m_writer->write_object(m_buffer,m_buffer_state,p_abort);
15  m_buffer_state = 0;
16  }
17  }
18 }
uint8_t t_uint8
Definition: int_types.h:9
unsigned char m_buffer[255]
size_t t_size
Definition: int_types.h:48
stream_writer * m_writer

Field Documentation

unsigned char stream_writer_chunk::m_buffer[255]
private

Definition at line 356 of file filesystem_helper.h.

unsigned stream_writer_chunk::m_buffer_state
private

Definition at line 355 of file filesystem_helper.h.

stream_writer* stream_writer_chunk::m_writer
private

Definition at line 354 of file filesystem_helper.h.


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