foobar2000 SDK  2015-08-03
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)
 
const char * c_str () const
 
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 273 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 275 of file string_base.h.

275 {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 276 of file string_base.h.

276 {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 277 of file string_base.h.

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

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 295 of file string_base.h.

295  {
296  len = strlen_max(ptr,len);
297  if (m_length + len < m_length || m_length + len > max_length) throw pfc::exception_overflow();
298  for(t_size n=0;n<len;n++) {
299  m_data[m_length++] = ptr[n];
300  }
301  m_data[m_length] = 0;
302  }
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:317
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 310 of file string_base.h.

310 {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 293 of file string_base.h.

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

Definition at line 312 of file string_base.h.

312  {
313  PFC_STATIC_ASSERT(max_length>1);
314  m_length = 0; m_data[0] = 0;
315  }
char m_data[max_length+1]
Definition: string_base.h:317
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 282 of file string_base.h.

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

Definition at line 291 of file string_base.h.

291 {return m_data;}
char m_data[max_length+1]
Definition: string_base.h:317
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 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:198
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 280 of file string_base.h.

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

Implements pfc::string_base.

Definition at line 303 of file string_base.h.

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

Implements pfc::string_base.

Definition at line 287 of file string_base.h.

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

Field Documentation

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

Definition at line 317 of file string_base.h.

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

Definition at line 316 of file string_base.h.


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