1 #if !defined(__STR_H__)
24 Str(
const char* str = NULL,
size_t length = NO_POS );
28 Str(
const Str& str,
const size_t offset = 0,
size_t count = NO_POS );
32 Str(
const bool var );
36 Str(
const double var,
unsigned int precision = 6 )
45 Str(
const int var,
unsigned int radix = 10,
unsigned int radixOffset = 0 )
54 Str(
const size_t var,
unsigned int radix = 16 )
69 Str&
set(
const char* str = NULL,
size_t length = NO_POS );
79 Str substr(
const size_t offset,
size_t count = NO_POS )
const;
84 return *
this += (
Str ) str;
88 return *
this +=
Str( (
const char* ) & str, (
size_t )1 );
92 return *
this += (
Str ) str;
96 return *
this += (
Str ) str;
100 return *
this += (
Str ) str;
104 return *
this += (
Str ) str;
109 return *
this += (
Str ) str;
113 return *
this +=
Str( str, length );
117 return *
this += str;
122 return *
this += str;
126 return *
this += str;
130 return *
this += str;
134 return *
this += str;
138 return *
this += str;
142 return *
this += str;
146 return *
this += str;
162 int compare(
const char* str )
const;
205 size_t findLastOf(
const unsigned char str )
const;
209 size_t find(
const unsigned char str,
size_t offset = 0 )
const;
211 size_t find(
const char* str,
size_t offset = 0 )
const;
213 size_t find(
const Str& str,
size_t offset = 0 )
const;
215 static size_t FindLastOf(
const char* str,
const unsigned char theChar,
size_t length = NO_POS );
217 static size_t Find(
const char* str,
const unsigned char theChar,
size_t length = NO_POS );
231 bool setChar(
size_t index,
const unsigned char theChar );
233 void replaceChar(
const char replace,
const char replaceWith );
235 Str*
split(
int& num,
const char* splitSpec,
size_t length = NO_POS )
const;
247 static unsigned int IntToAscii(
int value,
char* str,
unsigned int base,
unsigned int bufSize,
unsigned int baseOffset = 0 );
252 virtual void intoString(
const double var,
unsigned int precision = 10 );
253 virtual void intoString(
int var,
unsigned int radix,
unsigned int radixOffset = 0 );
Str & operator<<(const bool str)
Definition: Str.h:120
Str(const int var, unsigned int radix=10, unsigned int radixOffset=0)
int constructor Unit tests in Str_Test.testIntConstructor
Definition: Str.h:45
Str(const double var, unsigned int precision=6)
double constructor Unit tests in Str_Test.testDoubleConstructor
Definition: Str.h:36
Str & append(const Str &str)
Definition: Str.h:107
static char NoChars_[1]
Definition: Str.h:20
static const size_t MAX_LEN
Definition: Str.h:18
size_t size() const
Definition: Str.h:200
bool startsWith(const char *str, size_t length=NO_POS) const
Definition: Str.cpp:352
Str asHex() const
Return a new Str, with a hex representation of each character of this string.
Definition: Str.cpp:467
bool endsWith(const Str &str) const
Definition: Str.h:226
bool operator==(const Str &str) const
Definition: Str.h:164
char * chars_
Definition: Str.h:257
static size_t FindLastOf(const char *str, const unsigned char theChar, size_t length=NO_POS)
Definition: Str.cpp:320
bool setChar(size_t index, const unsigned char theChar)
Definition: Str.cpp:361
size_t length() const
Definition: Str.h:196
bool operator<(const Str &str) const
Definition: Str.h:174
Str & operator+=(const bool str)
Definition: Str.h:82
Str(const size_t var, unsigned int radix=16)
size_t constructor Unit tests in Str_Test.testUnsignedIntConstructor
Definition: Str.h:54
size_t find(const unsigned char str, size_t offset=0) const
Definition: Str.cpp:280
static const size_t NO_POS
static constants
Definition: Str.h:17
Str & operator=(const char *str)
Definition: Str.cpp:217
Str * split(int &num, const Str str) const
Definition: Str.h:237
bool operator!=(const Str &str) const
Definition: Str.h:151
Str(const char *str=NULL, size_t length=NO_POS)
char* constructor Unit tests in Str_Test.testConstructorCharStar
Definition: Str.cpp:21
Replacement for standard template class string.
Definition: Str.h:12
size_t findLastOf(const unsigned char str) const
returns the position of the specified character in the string, looking from the end of the string tow...
Definition: Str.cpp:247
const char * data() const
Definition: Str.h:192
bool startsWith(const Str &str) const
Definition: Str.h:221
static size_t Find(const char *str, const unsigned char theChar, size_t length=NO_POS)
Definition: Str.cpp:336
int compare(const Str &str) const
Definition: Str.cpp:141
Str substr(const size_t offset, size_t count=NO_POS) const
Definition: Str.cpp:74
const char * cStr() const
Definition: Str.h:188
virtual void intoString(const double var, unsigned int precision=10)
Definition: Str.cpp:478
static const Str EMPTY_STR
Definition: Str.h:19
friend Str operator+(const char *var, const Str &str)
Definition: Str.cpp:100
Str & pushBack(const unsigned char str)
Definition: Str.h:115
Str * split(int &num, const char *splitSpec, size_t length=NO_POS) const
Definition: Str.cpp:429
void replaceChar(const char replace, const char replaceWith)
Definition: Str.cpp:421
char operator[](const size_t index) const
Definition: Str.cpp:91
size_t length_
Definition: Str.h:256
virtual ~Str()
destructor
Definition: Str.cpp:64
static unsigned int IntToAscii(int value, char *str, unsigned int base, unsigned int bufSize, unsigned int baseOffset=0)
convert an integer to a string, returns the length of the string Unit tests in Str_Test.testIntToAscii
Definition: Str.cpp:371
Str & append(const char *str, size_t length)
Definition: Str.h:111
Str & set(const char *str=NULL, size_t length=NO_POS)
Definition: Str.cpp:165