foobar2000 SDK  2015-08-03
Public Member Functions | Private Types | Private Attributes
pfc::string_simple_t< t_char >

#include <string_base.h>

Public Member Functions

 string_simple_t ()
 
 string_simple_t (const t_char *p_source)
 
 string_simple_t (const t_char *p_source, t_size p_length)
 
void add_string (const t_char *p_source, t_size p_length)
 
void add_string (const t_char *p_source)
 
void add_string_nc (const t_char *p_source, t_size p_length)
 
const t_char * c_str () const
 
const t_char * get_ptr () const
 
bool is_empty () const
 
t_size length () const
 
 operator const t_char * () const
 
const t_selfoperator= (const t_char *p_source)
 
void set_string (const t_char *p_source)
 
void set_string (const t_char *p_source, t_size p_length)
 
void set_string_nc (const t_char *p_source, t_size p_length)
 

Private Types

typedef string_simple_t< t_char > t_self
 

Private Attributes

pfc::array_t< t_char > m_buffer
 

Detailed Description

template<typename t_char>
class pfc::string_simple_t< t_char >

Definition at line 776 of file string_base.h.

Member Typedef Documentation

template<typename t_char >
typedef string_simple_t<t_char> pfc::string_simple_t< t_char >::t_self
private

Definition at line 778 of file string_base.h.

Constructor & Destructor Documentation

template<typename t_char >
pfc::string_simple_t< t_char >::string_simple_t ( )
inline

Definition at line 815 of file string_base.h.

815 {}
template<typename t_char >
pfc::string_simple_t< t_char >::string_simple_t ( const t_char *  p_source)
inline

Definition at line 816 of file string_base.h.

816 {set_string(p_source);}
void set_string(const t_char *p_source)
Definition: string_base.h:795
template<typename t_char >
pfc::string_simple_t< t_char >::string_simple_t ( const t_char *  p_source,
t_size  p_length 
)
inline

Definition at line 817 of file string_base.h.

817 {set_string(p_source, p_length);}
void set_string(const t_char *p_source)
Definition: string_base.h:795

Member Function Documentation

template<typename t_char >
void pfc::string_simple_t< t_char >::add_string ( const t_char *  p_source,
t_size  p_length 
)
inline

Definition at line 801 of file string_base.h.

801  {
802  add_string_nc(p_source, strlen_max_t(p_source, p_length));
803  }
t_size strlen_max_t(const t_char *ptr, t_size max)
Definition: string_base.h:84
void add_string_nc(const t_char *p_source, t_size p_length)
Definition: string_base.h:807
template<typename t_char >
void pfc::string_simple_t< t_char >::add_string ( const t_char *  p_source)
inline

Definition at line 804 of file string_base.h.

804  {
805  add_string_nc(p_source, strlen_t(p_source));
806  }
t_size strlen_t(const t_char *p_string, t_size p_length=~0)
Definition: primitives.h:771
void add_string_nc(const t_char *p_source, t_size p_length)
Definition: string_base.h:807
template<typename t_char >
void pfc::string_simple_t< t_char >::add_string_nc ( const t_char *  p_source,
t_size  p_length 
)
inline

Definition at line 807 of file string_base.h.

807  {
808  if (p_length > 0) {
809  t_size base = length();
810  m_buffer.set_size( base + p_length + 1 );
811  memcpy_t(m_buffer.get_ptr() + base, p_source, p_length);
812  m_buffer[base + p_length] = 0;
813  }
814  }
const t_item * get_ptr() const
Definition: array.h:213
pfc::array_t< t_char > m_buffer
Definition: string_base.h:823
size_t t_size
Definition: int_types.h:48
void set_size(t_size p_size)
Definition: array.h:104
t_size length() const
Definition: string_base.h:780
void memcpy_t(t_dst *p_dst, const t_src *p_src, t_size p_count)
Definition: primitives.h:611
template<typename t_char >
const t_char* pfc::string_simple_t< t_char >::c_str ( ) const
inline

Definition at line 821 of file string_base.h.

821 { return get_ptr(); }
const t_char * get_ptr() const
Definition: string_base.h:820
template<typename t_char >
const t_char* pfc::string_simple_t< t_char >::get_ptr ( ) const
inline

Definition at line 820 of file string_base.h.

820 {return m_buffer.get_size() > 0 ? m_buffer.get_ptr() : pfc::empty_string_t<t_char>();}
const t_item * get_ptr() const
Definition: array.h:213
pfc::array_t< t_char > m_buffer
Definition: string_base.h:823
t_size get_size() const
Definition: array.h:130
template<typename t_char >
bool pfc::string_simple_t< t_char >::is_empty ( ) const
inline

Definition at line 784 of file string_base.h.

784 {return m_buffer.get_size() == 0;}
pfc::array_t< t_char > m_buffer
Definition: string_base.h:823
t_size get_size() const
Definition: array.h:130
template<typename t_char >
t_size pfc::string_simple_t< t_char >::length ( ) const
inline

Definition at line 780 of file string_base.h.

780  {
781  t_size s = m_buffer.get_size();
782  if (s == 0) return 0; else return s-1;
783  }
pfc::array_t< t_char > m_buffer
Definition: string_base.h:823
size_t t_size
Definition: int_types.h:48
t_size get_size() const
Definition: array.h:130
template<typename t_char >
pfc::string_simple_t< t_char >::operator const t_char * ( ) const
inline

Definition at line 819 of file string_base.h.

819 {return get_ptr();}
const t_char * get_ptr() const
Definition: string_base.h:820
template<typename t_char >
const t_self& pfc::string_simple_t< t_char >::operator= ( const t_char *  p_source)
inline

Definition at line 818 of file string_base.h.

818 {set_string(p_source);return *this;}
void set_string(const t_char *p_source)
Definition: string_base.h:795
template<typename t_char >
void pfc::string_simple_t< t_char >::set_string ( const t_char *  p_source)
inline

Definition at line 795 of file string_base.h.

795  {
796  set_string_nc(p_source, pfc::strlen_t(p_source));
797  }
void set_string_nc(const t_char *p_source, t_size p_length)
Definition: string_base.h:786
t_size strlen_t(const t_char *p_string, t_size p_length=~0)
Definition: primitives.h:771
template<typename t_char >
void pfc::string_simple_t< t_char >::set_string ( const t_char *  p_source,
t_size  p_length 
)
inline

Definition at line 798 of file string_base.h.

798  {
799  set_string_nc(p_source, strlen_max_t(p_source, p_length));
800  }
void set_string_nc(const t_char *p_source, t_size p_length)
Definition: string_base.h:786
t_size strlen_max_t(const t_char *ptr, t_size max)
Definition: string_base.h:84
template<typename t_char >
void pfc::string_simple_t< t_char >::set_string_nc ( const t_char *  p_source,
t_size  p_length 
)
inline

Definition at line 786 of file string_base.h.

786  {
787  if (p_length == 0) {
788  m_buffer.set_size(0);
789  } else {
790  m_buffer.set_size(p_length + 1);
791  pfc::memcpy_t(m_buffer.get_ptr(),p_source,p_length);
792  m_buffer[p_length] = 0;
793  }
794  }
const t_item * get_ptr() const
Definition: array.h:213
pfc::array_t< t_char > m_buffer
Definition: string_base.h:823
void set_size(t_size p_size)
Definition: array.h:104
void memcpy_t(t_dst *p_dst, const t_src *p_src, t_size p_count)
Definition: primitives.h:611

Field Documentation

template<typename t_char >
pfc::array_t<t_char> pfc::string_simple_t< t_char >::m_buffer
private

Definition at line 823 of file string_base.h.


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