21 #ifndef __EDELIB_STRING_H__
22 #define __EDELIB_STRING_H__
24 #include "edelib-global.h"
85 typedef unsigned int size_type;
96 static StringData null_data;
99 void init(size_type len, size_type cap);
144 String& assign(
const char* str, size_type len);
152 String& assign(
const char* str);
169 String& append(
const char* str, size_type len);
177 String& append(
const char* str);
195 String& append(size_type num,
const char& ch);
202 void reserve(size_type len);
219 String substr(size_type index, size_type num = npos)
const;
228 size_type find(
const char* str, size_type offset)
const;
238 size_type find(
char ch, size_type offset)
const;
243 size_type find(
const char* str)
const;
253 void printf(
const char* fmt, ...);
258 void trim_left(
void);
263 void trim_right(
void);
279 const char*
c_str(
void) {
return sdata->chars; }
282 const char*
c_str(
void)
const {
return sdata->chars; }
289 const char*
data(
void)
const {
return sdata->chars; }
292 size_type
length(
void)
const {
return sdata->length; }
295 size_type
capacity(
void)
const {
return sdata->capacity; }
298 bool empty(
void)
const {
return length() == 0; }
307 String& replace(
char c1,
char c2);
310 char& operator[](size_type index);
313 char operator[](size_type index)
const;
316 String& operator=(
const char* str);
322 String& operator+=(
const char* str);
328 String& operator+=(
const char& ch);
335 EDELIB_API String
operator+(
const String& s1,
const String& s2);
341 EDELIB_API String
operator+(
const char* s1,
const String& s2);
347 EDELIB_API String
operator+(
const String& s1,
const char* s2);
bool empty(void) const
Definition: String.h:298
bool operator<=(const String &str1, const String &str2)
Definition: String.h:456
bool operator>(const String &str1, const String &str2)
Definition: String.h:438
bool operator>=(const char *str1, const String &str2)
Definition: String.h:407
const char * c_str(void) const
Definition: String.h:282
bool operator>(const String &str1, const char *str2)
Definition: String.h:365
bool operator==(const char *str1, const String &str2)
Definition: String.h:389
bool operator==(const String &str1, const char *str2)
Definition: String.h:353
const char * c_str(void)
Definition: String.h:279
String operator+(const String &s1, const String &s2)
bool operator==(const String &str1, const String &str2)
Definition: String.h:425
bool operator>(const char *str1, const String &str2)
Definition: String.h:401
bool operator<=(const char *str1, const String &str2)
Definition: String.h:419
bool operator<(const char *str1, const String &str2)
Definition: String.h:413
bool operator<=(const String &str1, const char *str2)
Definition: String.h:383
bool operator>=(const String &str1, const String &str2)
Definition: String.h:444
size_type length(void) const
Definition: String.h:292
A (relatively simple) string implementation.
Definition: String.h:82
const char * data(void) const
Definition: String.h:289
bool operator!=(const String &str1, const String &str2)
Definition: String.h:432
static const size_type npos
Definition: String.h:111
bool operator!=(const String &str1, const char *str2)
Definition: String.h:359
bool operator<(const String &str1, const String &str2)
Definition: String.h:450
size_type capacity(void) const
Definition: String.h:295
bool operator<(const String &str1, const char *str2)
Definition: String.h:377
bool operator>=(const String &str1, const char *str2)
Definition: String.h:371
bool operator!=(const char *str1, const String &str2)
Definition: String.h:395