28 static const size_t npos = -1;
124 void append(
const char* str,
size_t count);
153 void insert(
size_t pos,
char c,
size_t count);
172 void insert(
size_t pos,
const char* str);
180 void erase(
size_t pos,
size_t count);
199 if (count <= mLength)
200 erase(mLength - count, count);
235 operator const char*()
const
257 return mCapacity - 1;
288 return mString[mLength - 1];
305 return !(*
this == rhs);
326 return !(*
this <= rhs);
335 return !(*
this >= rhs);
360 size_t find(
char c,
size_t pos = 0);
DsString is a class representing a character string.
Definition ds_string.h:26
DsString & operator+=(const char *rhs)
Addition operator - appends a string to the current DsString object.
DsString(const DsString &src)
Copy constructor.
void erase_last(size_t count)
Erases characters from the end of the string.
Definition ds_string.h:197
bool operator==(const char *rhs) const
Comparison operator.
DsString & operator=(DsString &&rhs)
Move operator.
bool operator!=(const char *rhs) const
Comparison operator.
Definition ds_string.h:303
void append(char c, size_t count)
Appends a character a number of times to the current DsString object.
size_t format(const char *format, va_list args)
Initializes the string using vprintf() style.
void append(const char *str)
Appends a C string to the current DsString object.
void erase_first(size_t count)
Erases characters from the beginning of the string.
Definition ds_string.h:187
static const size_t npos
Constant representing an invalid position/size value.
Definition ds_string.h:28
size_t format(const char *format,...)
Initializes the string using printf() style.
void append(const char *str, size_t count)
Appends a C string a number of times.
bool operator<(const char *rhs) const
Comparison operator.
Definition ds_string.h:333
const char * c_str(void) const
Returns the pointer to the underlaying C string.
Definition ds_string.h:225
size_t length(void) const
Returns the length of the string.
Definition ds_string.h:245
char back(void)
Returns the last character of the string.
Definition ds_string.h:285
void erase(size_t pos, size_t count)
Erases characters from the specified position.
DsString(DsString &&src)
Move constructor.
DsString & operator=(const char *rhs)
Assignment operator from a C string.
DsString operator+(const DsString &rhs)
Addition operator - appends a DsString to the current DsString object.
DsString & operator=(const DsString &rhs)
Assignment operator from another DsString.
void append(char c)
Appends a single character to the current DsString object.
Definition ds_string.h:131
void insert(size_t pos, char c, size_t count)
Inserts a character a number of times at a specified position in the current DsString object.
bool operator>(const char *rhs) const
Comparison operator.
Definition ds_string.h:324
DsString(const char *str, size_t max_length=DsString::npos)
Creates a DsString object with space for storing the specified string or a specified length....
void substr(char *substr, size_t pos, size_t count) const
Extracts a substring of the current string.
void clear(void)
Clears the entire string.
bool operator>=(const char *rhs) const
Comparison operator.
bool operator<=(const char *rhs) const
Comparison operator.
void insert(size_t pos, char c)
Inserts a single character at a specified position in the current DsString object.
Definition ds_string.h:161
void insert(size_t pos, const char *str)
Inserts a C string at a specified position in the current DsString object.
size_t maxLength(void) const
Returns the maximum string length this DsString can hold.
Definition ds_string.h:255
DsString(size_t max_length=31)
Creates a DsString object with space for storing a string of specified length.
bool empty(void) const
Is the string empty?
Definition ds_string.h:265
char front(void)
Returns the first character of the string.
Definition ds_string.h:275
size_t find(char c, size_t pos=0)
Searches for a character starting at a specific position.
size_t find(const char *substr, size_t pos=0)
Searches for a substring starting at a specific position.
void append(const DsString &str)
Appends a DsString object to the current DsString object.
Definition ds_string.h:141