foobar2000 SDK  2015-08-03
Public Member Functions | Private Attributes
pfc::format_pad_left< t_stringbuffer >

#include <string_base.h>

Public Member Functions

 format_pad_left (t_size p_chars, t_uint32 p_padding, const char *p_string, t_size p_string_length=~0)
 
const char * get_ptr () const
 
 operator const char * () const
 
const char * toString () const
 

Private Attributes

t_stringbuffer m_buffer
 

Detailed Description

template<typename t_stringbuffer = pfc::string8_fastalloc>
class pfc::format_pad_left< t_stringbuffer >

Definition at line 665 of file string_base.h.

Constructor & Destructor Documentation

template<typename t_stringbuffer = pfc::string8_fastalloc>
pfc::format_pad_left< t_stringbuffer >::format_pad_left ( t_size  p_chars,
t_uint32  p_padding,
const char *  p_string,
t_size  p_string_length = ~0 
)
inline

Definition at line 667 of file string_base.h.

667  {
668  t_size source_len = 0, source_walk = 0;
669 
670  while(source_walk < p_string_length && source_len < p_chars) {
671  unsigned dummy;
672  t_size delta = pfc::utf8_decode_char(p_string + source_walk, dummy, p_string_length - source_walk);
673  if (delta == 0) break;
674  source_len++;
675  source_walk += delta;
676  }
677 
678  m_buffer.add_string(p_string,source_walk);
679  m_buffer.add_chars(p_padding,p_chars - source_len);
680  }
t_stringbuffer m_buffer
Definition: string_base.h:685
size_t t_size
Definition: int_types.h:48
t_size utf8_decode_char(const char *src, unsigned &out, t_size src_bytes)
Definition: utf8.cpp:64

Member Function Documentation

template<typename t_stringbuffer = pfc::string8_fastalloc>
const char* pfc::format_pad_left< t_stringbuffer >::get_ptr ( ) const
inline

Definition at line 681 of file string_base.h.

681 {return m_buffer;}
t_stringbuffer m_buffer
Definition: string_base.h:685
template<typename t_stringbuffer = pfc::string8_fastalloc>
pfc::format_pad_left< t_stringbuffer >::operator const char * ( ) const
inline

Definition at line 682 of file string_base.h.

682 {return m_buffer;}
t_stringbuffer m_buffer
Definition: string_base.h:685
template<typename t_stringbuffer = pfc::string8_fastalloc>
const char* pfc::format_pad_left< t_stringbuffer >::toString ( ) const
inline

Definition at line 683 of file string_base.h.

683 {return m_buffer;}
t_stringbuffer m_buffer
Definition: string_base.h:685

Field Documentation

template<typename t_stringbuffer = pfc::string8_fastalloc>
t_stringbuffer pfc::format_pad_left< t_stringbuffer >::m_buffer
private

Definition at line 685 of file string_base.h.


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