COSA
An Object-Oriented Platform for Arduino Programming
|
#include <String.hh>
Public Member Functions | |
String (const char *cstr="") | |
String (const String &str) | |
String (str_P str) | |
String (char c) | |
String (unsigned char, unsigned char base=10) | |
String (int, unsigned char base=10) | |
String (unsigned int, unsigned char base=10) | |
String (long, unsigned char base=10) | |
String (unsigned long, unsigned char base=10) | |
String (float, unsigned char decimalPlaces=2) | |
String (double, unsigned char decimalPlaces=2) | |
~String (void) | |
unsigned char | reserve (unsigned int size) |
unsigned int | length (void) const |
String & | operator= (const String &rhs) |
String & | operator= (const char *cstr) |
String & | operator= (str_P str) |
unsigned char | concat (const String &str) |
unsigned char | concat (const char *cstr) |
unsigned char | concat (char c) |
unsigned char | concat (unsigned char c) |
unsigned char | concat (int num) |
unsigned char | concat (unsigned int num) |
unsigned char | concat (long num) |
unsigned char | concat (unsigned long num) |
unsigned char | concat (float num) |
unsigned char | concat (double num) |
unsigned char | concat (str_P str) |
String & | operator+= (const String &rhs) |
String & | operator+= (const char *cstr) |
String & | operator+= (char c) |
String & | operator+= (unsigned char num) |
String & | operator+= (int num) |
String & | operator+= (unsigned int num) |
String & | operator+= (long num) |
String & | operator+= (unsigned long num) |
String & | operator+= (float num) |
String & | operator+= (double num) |
String & | operator+= (str_P str) |
operator StringIfHelperType () const | |
int | compareTo (const String &s) const |
unsigned char | equals (const String &s) const |
unsigned char | equals (const char *cstr) const |
unsigned char | operator== (const String &rhs) const |
unsigned char | operator== (const char *cstr) const |
unsigned char | operator!= (const String &rhs) const |
unsigned char | operator!= (const char *cstr) const |
unsigned char | operator< (const String &rhs) const |
unsigned char | operator> (const String &rhs) const |
unsigned char | operator<= (const String &rhs) const |
unsigned char | operator>= (const String &rhs) const |
unsigned char | equalsIgnoreCase (const String &s) const |
unsigned char | startsWith (const String &prefix) const |
unsigned char | startsWith (const String &prefix, unsigned int offset) const |
unsigned char | endsWith (const String &suffix) const |
char | charAt (unsigned int index) const |
void | setCharAt (unsigned int index, char c) |
char | operator[] (unsigned int index) const |
char & | operator[] (unsigned int index) |
void | getBytes (unsigned char *buf, unsigned int bufsize, unsigned int index=0) const |
void | toCharArray (char *buf, unsigned int bufsize, unsigned int index=0) const |
const char * | c_str () const |
int | indexOf (char ch) const |
int | indexOf (char ch, unsigned int fromIndex) const |
int | indexOf (const String &str) const |
int | indexOf (const String &str, unsigned int fromIndex) const |
int | lastIndexOf (char ch) const |
int | lastIndexOf (char ch, unsigned int fromIndex) const |
int | lastIndexOf (const String &str) const |
int | lastIndexOf (const String &str, unsigned int fromIndex) const |
String | substring (unsigned int beginIndex, unsigned int endIndex) const |
String | substring (unsigned int beginIndex) const |
void | replace (char find, char replace) |
void | replace (const String &find, const String &replace) |
void | remove (unsigned int index) |
void | remove (unsigned int index, unsigned int count) |
void | toLowerCase (void) |
void | toUpperCase (void) |
void | trim (void) |
long | toInt (void) const |
float | toFloat (void) const |
Protected Member Functions | |
void | init (void) |
void | invalidate (void) |
unsigned char | changeBuffer (unsigned int maxStrLen) |
unsigned char | concat (const char *cstr, unsigned int length) |
String & | copy (const char *cstr, unsigned int length) |
String & | copy (str_P pstr, unsigned int length) |
void | move (String &rhs) |
Protected Attributes | |
char * | m_buffer |
the actual char array More... | |
unsigned int | m_capacity |
the array length minus one (for the '\0') More... | |
unsigned int | m_length |
the String length (not counting the '\0') More... | |
Friends | |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, const String &rhs) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, const char *cstr) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, char c) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, unsigned char num) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, int num) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, unsigned int num) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, long num) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, unsigned long num) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, float num) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, double num) |
__StringSumHelper & | operator+ (const __StringSumHelper &lhs, str_P rhs) |
String::String | ( | const char * | cstr = "" | ) |
Creates a copy of the initial value. If the initial value is null or invalid, or if memory allocation fails, the string will be marked as invalid (i.e. "if (s)" will be false).
Definition at line 26 of file String.cpp.
String::String | ( | const String & | str | ) |
Definition at line 32 of file String.cpp.
String::String | ( | str_P | str | ) |
Definition at line 38 of file String.cpp.
|
explicit |
Definition at line 58 of file String.cpp.
|
explicit |
Definition at line 67 of file String.cpp.
|
explicit |
Definition at line 75 of file String.cpp.
|
explicit |
Definition at line 83 of file String.cpp.
|
explicit |
Definition at line 91 of file String.cpp.
|
explicit |
Definition at line 99 of file String.cpp.
|
explicit |
Definition at line 107 of file String.cpp.
|
explicit |
Definition at line 114 of file String.cpp.
String::~String | ( | void | ) |
Definition at line 121 of file String.cpp.
|
protected |
Definition at line 153 of file String.cpp.
char String::charAt | ( | unsigned int | index | ) | const |
Character acccess.
Definition at line 535 of file String.cpp.
int String::compareTo | ( | const String & | s | ) | const |
Definition at line 443 of file String.cpp.
unsigned char String::concat | ( | const String & | str | ) |
Concatenate value. Returns true on success, false on failure (in which case, the string is left unchanged). If the argument is null or invalid, the concatenation is considered unsucessful.
Definition at line 252 of file String.cpp.
unsigned char String::concat | ( | const char * | cstr | ) |
Definition at line 270 of file String.cpp.
unsigned char String::concat | ( | char | c | ) |
Definition at line 277 of file String.cpp.
unsigned char String::concat | ( | unsigned char | c | ) |
Definition at line 286 of file String.cpp.
unsigned char String::concat | ( | int | num | ) |
Definition at line 294 of file String.cpp.
unsigned char String::concat | ( | unsigned int | num | ) |
Definition at line 302 of file String.cpp.
unsigned char String::concat | ( | long | num | ) |
Definition at line 310 of file String.cpp.
unsigned char String::concat | ( | unsigned long | num | ) |
Definition at line 318 of file String.cpp.
unsigned char String::concat | ( | float | num | ) |
Definition at line 326 of file String.cpp.
unsigned char String::concat | ( | double | num | ) |
Definition at line 334 of file String.cpp.
unsigned char String::concat | ( | str_P | str | ) |
Definition at line 342 of file String.cpp.
|
protected |
Definition at line 258 of file String.cpp.
|
protected |
Copy and move.
Definition at line 163 of file String.cpp.
Definition at line 176 of file String.cpp.
unsigned char String::endsWith | ( | const String & | suffix | ) | const |
Definition at line 526 of file String.cpp.
unsigned char String::equals | ( | const String & | s | ) | const |
Definition at line 456 of file String.cpp.
unsigned char String::equals | ( | const char * | cstr | ) | const |
Definition at line 462 of file String.cpp.
unsigned char String::equalsIgnoreCase | ( | const String & | s | ) | const |
Definition at line 496 of file String.cpp.
void String::getBytes | ( | unsigned char * | buf, |
unsigned int | bufsize, | ||
unsigned int | index = 0 |
||
) | const |
Definition at line 565 of file String.cpp.
int String::indexOf | ( | char | ch | ) | const |
Search.
Definition at line 579 of file String.cpp.
int String::indexOf | ( | char | ch, |
unsigned int | fromIndex | ||
) | const |
Definition at line 585 of file String.cpp.
int String::indexOf | ( | const String & | str | ) | const |
Definition at line 594 of file String.cpp.
int String::indexOf | ( | const String & | str, |
unsigned int | fromIndex | ||
) | const |
Definition at line 600 of file String.cpp.
|
inlineprotected |
Definition at line 127 of file String.cpp.
|
protected |
Definition at line 135 of file String.cpp.
int String::lastIndexOf | ( | char | ch | ) | const |
Definition at line 609 of file String.cpp.
int String::lastIndexOf | ( | char | ch, |
unsigned int | fromIndex | ||
) | const |
Definition at line 615 of file String.cpp.
int String::lastIndexOf | ( | const String & | str | ) | const |
Definition at line 627 of file String.cpp.
int String::lastIndexOf | ( | const String & | str, |
unsigned int | fromIndex | ||
) | const |
Definition at line 633 of file String.cpp.
|
inline |
|
protected |
Definition at line 188 of file String.cpp.
|
inline |
|
inline |
|
inline |
unsigned char String::operator< | ( | const String & | rhs | ) | const |
Definition at line 472 of file String.cpp.
unsigned char String::operator<= | ( | const String & | rhs | ) | const |
Definition at line 484 of file String.cpp.
Creates a copy of the assigned value. if the value is null or invalid, or if the memory allocation fails, the string will be marked as invalid ("if (s)" will be false).
Definition at line 209 of file String.cpp.
String & String::operator= | ( | const char * | cstr | ) |
Definition at line 236 of file String.cpp.
Definition at line 244 of file String.cpp.
|
inline |
|
inline |
unsigned char String::operator> | ( | const String & | rhs | ) | const |
Definition at line 478 of file String.cpp.
unsigned char String::operator>= | ( | const String & | rhs | ) | const |
Definition at line 490 of file String.cpp.
char String::operator[] | ( | unsigned int | index | ) | const |
Definition at line 558 of file String.cpp.
char & String::operator[] | ( | unsigned int | index | ) |
Definition at line 547 of file String.cpp.
void String::remove | ( | unsigned int | index | ) |
Definition at line 720 of file String.cpp.
void String::remove | ( | unsigned int | index, |
unsigned int | count | ||
) |
Definition at line 727 of file String.cpp.
void String::replace | ( | char | find, |
char | replace | ||
) |
Modification.
Definition at line 667 of file String.cpp.
Definition at line 676 of file String.cpp.
unsigned char String::reserve | ( | unsigned int | size | ) |
Memory Management: Return true on success, false on failure (in which case, the string is left unchanged). reserve(0), if successful, will validate an invalid string (i.e., "if (s)" will be true afterwards)
Definition at line 144 of file String.cpp.
void String::setCharAt | ( | unsigned int | index, |
char | c | ||
) |
Definition at line 541 of file String.cpp.
unsigned char String::startsWith | ( | const String & | prefix | ) | const |
Definition at line 510 of file String.cpp.
unsigned char String::startsWith | ( | const String & | prefix, |
unsigned int | offset | ||
) | const |
Definition at line 517 of file String.cpp.
String String::substring | ( | unsigned int | beginIndex, |
unsigned int | endIndex | ||
) | const |
Sub-string.
Definition at line 649 of file String.cpp.
|
inline |
|
inline |
float String::toFloat | ( | void | ) | const |
Definition at line 777 of file String.cpp.
long String::toInt | ( | void | ) | const |
Parsing/Conversion.
Definition at line 770 of file String.cpp.
void String::toLowerCase | ( | void | ) |
Definition at line 739 of file String.cpp.
void String::toUpperCase | ( | void | ) |
Definition at line 748 of file String.cpp.
void String::trim | ( | void | ) |
Definition at line 757 of file String.cpp.
|
friend |
Definition at line 355 of file String.cpp.
|
friend |
Definition at line 363 of file String.cpp.
|
friend |
Definition at line 371 of file String.cpp.
|
friend |
Definition at line 379 of file String.cpp.
|
friend |
Definition at line 387 of file String.cpp.
|
friend |
Definition at line 395 of file String.cpp.
|
friend |
Definition at line 403 of file String.cpp.
|
friend |
Definition at line 411 of file String.cpp.
|
friend |
Definition at line 419 of file String.cpp.
|
friend |
Definition at line 427 of file String.cpp.
|
friend |
Definition at line 435 of file String.cpp.
|
protected |
|
protected |