foobar2000 SDK  2015-08-03
Public Member Functions | Data Fields
stream_writer_formatter< isBigEndian >

#include <filesystem_helper.h>

+ Inheritance diagram for stream_writer_formatter< isBigEndian >:

Public Member Functions

 stream_writer_formatter (stream_writer &p_stream, abort_callback &p_abort)
 
template<typename TArray >
void write_array (const TArray &data)
 
template<typename TArray >
void write_byte_block (const TArray &data)
 
template<typename t_int >
void write_int (t_int p_int)
 
void write_raw (const void *p_buffer, t_size p_bytes)
 
template<typename TArray >
void write_raw (const TArray &data)
 
void write_string (const char *str)
 
void write_string (const char *str, t_size len_)
 
void write_string_nullterm (const char *str)
 

Data Fields

abort_callbackm_abort
 
stream_writerm_stream
 

Detailed Description

template<bool isBigEndian = false>
class stream_writer_formatter< isBigEndian >

Definition at line 431 of file filesystem_helper.h.

Constructor & Destructor Documentation

template<bool isBigEndian = false>
stream_writer_formatter< isBigEndian >::stream_writer_formatter ( stream_writer p_stream,
abort_callback p_abort 
)
inline

Definition at line 433 of file filesystem_helper.h.

433 : m_stream(p_stream), m_abort(p_abort) {}

Member Function Documentation

template<bool isBigEndian = false>
template<typename TArray >
void stream_writer_formatter< isBigEndian >::write_array ( const TArray &  data)
inline

Definition at line 453 of file filesystem_helper.h.

453  {
454  const t_uint32 size = pfc::downcast_guarded<t_uint32>(data.get_size());
455  *this << size;
456  for(t_uint32 walk = 0; walk < size; ++walk) *this << data[walk];
457  }
uint32_t t_uint32
Definition: int_types.h:5
template<bool isBigEndian = false>
template<typename TArray >
void stream_writer_formatter< isBigEndian >::write_byte_block ( const TArray &  data)
inline

Definition at line 448 of file filesystem_helper.h.

448  {
450  write_int( pfc::downcast_guarded<t_uint32>(data.get_size()) );
451  write_raw( data );
452  }
void write_int(t_int p_int)
void write_raw(const void *p_buffer, t_size p_bytes)
template<bool isBigEndian = false>
template<typename t_int >
void stream_writer_formatter< isBigEndian >::write_int ( t_int  p_int)
inline

Definition at line 435 of file filesystem_helper.h.

435  {
436  if (isBigEndian) m_stream.write_bendian_t(p_int,m_abort);
437  else m_stream.write_lendian_t(p_int,m_abort);
438  }
template<bool isBigEndian = false>
void stream_writer_formatter< isBigEndian >::write_raw ( const void *  p_buffer,
t_size  p_bytes 
)
inline

Definition at line 440 of file filesystem_helper.h.

440  {
441  m_stream.write_object(p_buffer,p_bytes,m_abort);
442  }
template<bool isBigEndian = false>
template<typename TArray >
void stream_writer_formatter< isBigEndian >::write_raw ( const TArray &  data)
inline

Definition at line 443 of file filesystem_helper.h.

443  {
445  write_raw(data.get_ptr(),data.get_size());
446  }
void write_raw(const void *p_buffer, t_size p_bytes)
template<bool isBigEndian = false>
void stream_writer_formatter< isBigEndian >::write_string ( const char *  str)
inline

Definition at line 459 of file filesystem_helper.h.

459  {
460  const t_size len = strlen(str);
461  *this << pfc::downcast_guarded<t_uint32>(len);
462  write_raw(str, len);
463  }
size_t t_size
Definition: int_types.h:48
void write_raw(const void *p_buffer, t_size p_bytes)
template<bool isBigEndian = false>
void stream_writer_formatter< isBigEndian >::write_string ( const char *  str,
t_size  len_ 
)
inline

Definition at line 464 of file filesystem_helper.h.

464  {
465  const t_size len = pfc::strlen_max(str, len_);
466  *this << pfc::downcast_guarded<t_uint32>(len);
467  write_raw(str, len);
468  }
t_size strlen_max(const char *ptr, t_size max)
Definition: string_base.h:91
size_t t_size
Definition: int_types.h:48
void write_raw(const void *p_buffer, t_size p_bytes)
template<bool isBigEndian = false>
void stream_writer_formatter< isBigEndian >::write_string_nullterm ( const char *  str)
inline

Definition at line 469 of file filesystem_helper.h.

469  {
470  this->write_raw( str, strlen(str)+1 );
471  }
void write_raw(const void *p_buffer, t_size p_bytes)

Field Documentation

template<bool isBigEndian = false>
abort_callback& stream_writer_formatter< isBigEndian >::m_abort

Definition at line 474 of file filesystem_helper.h.

template<bool isBigEndian = false>
stream_writer& stream_writer_formatter< isBigEndian >::m_stream

Definition at line 473 of file filesystem_helper.h.


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