foobar2000 SDK  2015-01-14
Public Member Functions | Private Member Functions | Private Attributes
pfc::string_fixed_t< max_length >

#include <string_base.h>

+ Inheritance diagram for pfc::string_fixed_t< max_length >:

Public Member Functions

 string_fixed_t ()
 
 string_fixed_t (const string_fixed_t< max_length > &p_source)
 
 string_fixed_t (const char *p_source)
 
void add_string (const char *ptr, t_size len)
 
t_size get_length () const
 
const char * get_ptr () const
 
char * lock_buffer (t_size p_requested_length)
 
 operator const char * () const
 
const string_fixed_t< max_length > & operator= (const string_fixed_t< max_length > &p_source)
 
const string_fixed_t< max_length > & operator= (const char *p_source)
 
void truncate (t_size len)
 
void unlock_buffer ()
 
- Public Member Functions inherited from pfc::string_base
string_base_formatter () const
 
void add_filename (const char *fn)
 
void convert_to_lower_ascii (const char *src, char replace= '?')
 
void delimit (const char *c)
 
void end_with (char c)
 
void end_with_slash ()
 
bool ends_with (char c) const
 
t_size find_first (char p_char, t_size p_start=0) const
 
t_size find_first (const char *p_string, t_size p_start=0) const
 
t_size find_last (char p_char, t_size p_start=~0) const
 
t_size find_last (const char *p_string, t_size p_start=~0) const
 
void fix_dir_separator (char c= '\\')
 
bool fix_eol (const char *append=" (...)", t_size start=0)
 
bool has_prefix (const char *prefix) const
 
bool has_prefix_i (const char *prefix) const
 
bool has_suffix (const char *suffix) const
 
bool has_suffix_i (const char *suffix) const
 
bool is_empty () const
 
bool is_valid_utf8 () const
 
char last_char () const
 
t_size length () const
 
bool limit_length (t_size length_in_chars, const char *append=" (...)")
 
 operator const char * () const
 
bool operator!= (const string_base &p_other) const
 
const string_baseoperator+= (const char *src)
 
const string_baseoperator+= (const string_base &src)
 
bool operator< (const string_base &p_other) const
 
bool operator<= (const string_base &p_other) const
 
const string_baseoperator= (const char *src)
 
const string_baseoperator= (const string_base &src)
 
bool operator== (const string_base &p_other) const
 
bool operator> (const string_base &p_other) const
 
bool operator>= (const string_base &p_other) const
 
t_size replace_string (const char *replace, const char *replaceWith, t_size start=0)
 
void reset ()
 
t_size scan_filename () const
 
virtual void set_string (const char *p_string, t_size p_length=~0)
 
void set_string_ (const char *str)
 
void skip_trailing_char (unsigned c= ' ')
 
const char * toString () const
 
bool truncate_eol (t_size start=0)
 
void truncate_filename ()
 
void truncate_last_char ()
 
void truncate_number_suffix ()
 
void truncate_to_parent_path ()
 
- Public Member Functions inherited from pfc::string_receiver
void add_byte (char c)
 
void add_char (t_uint32 c)
 
void add_chars (t_uint32 p_char, t_size p_count)
 
void add_string_ (const char *str)
 

Private Member Functions

void init ()
 

Private Attributes

char m_data [max_length+1]
 
t_size m_length
 

Additional Inherited Members

- Protected Member Functions inherited from pfc::string_base
 string_base ()
 
 ~string_base ()
 
- Protected Member Functions inherited from pfc::string_receiver
 string_receiver ()
 
 ~string_receiver ()
 

Detailed Description

template<t_size max_length>
class pfc::string_fixed_t< max_length >

Definition at line 272 of file string_base.h.

Constructor & Destructor Documentation

template<t_size max_length>
pfc::string_fixed_t< max_length >::string_fixed_t ( )
inline

Definition at line 274 of file string_base.h.

274 {init();}
template<t_size max_length>
pfc::string_fixed_t< max_length >::string_fixed_t ( const string_fixed_t< max_length > &  p_source)
inline

Definition at line 275 of file string_base.h.

275 {init(); *this = p_source;}
template<t_size max_length>
pfc::string_fixed_t< max_length >::string_fixed_t ( const char *  p_source)
inline

Definition at line 276 of file string_base.h.

276 {init(); set_string(p_source);}
virtual void set_string(const char *p_string, t_size p_length=~0)
Definition: string_base.h:197

Member Function Documentation

template<t_size max_length>
void pfc::string_fixed_t< max_length >::add_string ( const char *  ptr,
t_size  len 
)
inlinevirtual

Implements pfc::string_base.

Definition at line 294 of file string_base.h.

294  {
295  len = strlen_max(ptr,len);
296  if (m_length + len < m_length || m_length + len > max_length) throw pfc::exception_overflow();
297  for(t_size n=0;n<len;n++) {
298  m_data[m_length++] = ptr[n];
299  }
300  m_data[m_length] = 0;
301  }
t_size strlen_max(const char *ptr, t_size max)
Definition: string_base.h:91
size_t t_size
Definition: int_types.h:48
char m_data[max_length+1]
Definition: string_base.h:316
template<t_size max_length>
t_size pfc::string_fixed_t< max_length >::get_length ( ) const
inlinevirtual

Reimplemented from pfc::string_base.

Definition at line 309 of file string_base.h.

309 {return m_length;}
template<t_size max_length>
const char* pfc::string_fixed_t< max_length >::get_ptr ( ) const
inlinevirtual

Implements pfc::string_base.

Definition at line 292 of file string_base.h.

292 {return m_data;}
char m_data[max_length+1]
Definition: string_base.h:316
template<t_size max_length>
void pfc::string_fixed_t< max_length >::init ( )
inlineprivate

Definition at line 311 of file string_base.h.

311  {
312  PFC_STATIC_ASSERT(max_length>1);
313  m_length = 0; m_data[0] = 0;
314  }
char m_data[max_length+1]
Definition: string_base.h:316
template<t_size max_length>
char* pfc::string_fixed_t< max_length >::lock_buffer ( t_size  p_requested_length)
inlinevirtual

Implements pfc::string_base.

Definition at line 281 of file string_base.h.

281  {
282  if (p_requested_length >= max_length) return NULL;
283  memset(m_data,0,sizeof(m_data));
284  return m_data;
285  }
char m_data[max_length+1]
Definition: string_base.h:316
template<t_size max_length>
pfc::string_fixed_t< max_length >::operator const char * ( ) const
inline

Definition at line 290 of file string_base.h.

290 {return m_data;}
char m_data[max_length+1]
Definition: string_base.h:316
template<t_size max_length>
const string_fixed_t<max_length>& pfc::string_fixed_t< max_length >::operator= ( const string_fixed_t< max_length > &  p_source)
inline

Definition at line 278 of file string_base.h.

278 {set_string(p_source);return *this;}
virtual void set_string(const char *p_string, t_size p_length=~0)
Definition: string_base.h:197
template<t_size max_length>
const string_fixed_t<max_length>& pfc::string_fixed_t< max_length >::operator= ( const char *  p_source)
inline

Definition at line 279 of file string_base.h.

279 {set_string(p_source);return *this;}
virtual void set_string(const char *p_string, t_size p_length=~0)
Definition: string_base.h:197
template<t_size max_length>
void pfc::string_fixed_t< max_length >::truncate ( t_size  len)
inlinevirtual

Implements pfc::string_base.

Definition at line 302 of file string_base.h.

302  {
303  if (len > max_length) len = max_length;
304  if (m_length > len) {
305  m_length = len;
306  m_data[len] = 0;
307  }
308  }
char m_data[max_length+1]
Definition: string_base.h:316
template<t_size max_length>
void pfc::string_fixed_t< max_length >::unlock_buffer ( )
inlinevirtual

Implements pfc::string_base.

Definition at line 286 of file string_base.h.

286  {
287  m_length = strlen(m_data);
288  }
char m_data[max_length+1]
Definition: string_base.h:316

Field Documentation

template<t_size max_length>
char pfc::string_fixed_t< max_length >::m_data[max_length+1]
private

Definition at line 316 of file string_base.h.

template<t_size max_length>
t_size pfc::string_fixed_t< max_length >::m_length
private

Definition at line 315 of file string_base.h.


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