diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-06-06 15:41:23 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-06-06 16:33:20 +0200 |
commit | db286ac0c1305f9f6338acc37da7c24ebdc9243b (patch) | |
tree | 932ca169a6a9b4a58639f76088c0b5331a8256d6 /cores/arduino/WString.h | |
parent | 2719777a48418210563bf58199331eefe24969af (diff) |
Added support for Flash string on String class.
Diffstat (limited to 'cores/arduino/WString.h')
-rw-r--r-- | cores/arduino/WString.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index 8938bf9..c07e1a9 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -58,6 +58,7 @@ public: // be false). String(const char *cstr = ""); String(const String &str); + String(const __FlashStringHelper *str); #ifdef __GXX_EXPERIMENTAL_CXX0X__ String(String &&rval); String(StringSumHelper &&rval); @@ -82,6 +83,7 @@ public: // marked as invalid ("if (s)" will be false). String & operator = (const String &rhs); String & operator = (const char *cstr); + String & operator = (const __FlashStringHelper *str); #ifdef __GXX_EXPERIMENTAL_CXX0X__ String & operator = (String &&rval); String & operator = (StringSumHelper &&rval); @@ -100,17 +102,19 @@ public: unsigned char concat(unsigned int num); unsigned char concat(long num); unsigned char concat(unsigned long num); + unsigned char concat(const __FlashStringHelper * str); // if there's not enough memory for the concatenated value, the string // will be left unchanged (but this isn't signalled in any way) String & operator += (const String &rhs) {concat(rhs); return (*this);} String & operator += (const char *cstr) {concat(cstr); return (*this);} String & operator += (char c) {concat(c); return (*this);} - String & operator += (unsigned char num) {concat(num); return (*this);} + String & operator += (unsigned char num) {concat(num); return (*this);} String & operator += (int num) {concat(num); return (*this);} String & operator += (unsigned int num) {concat(num); return (*this);} String & operator += (long num) {concat(num); return (*this);} String & operator += (unsigned long num) {concat(num); return (*this);} + String & operator += (const __FlashStringHelper *str){concat(str); return (*this);} friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs); friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr); @@ -120,6 +124,7 @@ public: friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num); friend StringSumHelper & operator + (const StringSumHelper &lhs, long num); friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num); + friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *rhs); // comparison (only works w/ Strings and "strings") operator StringIfHelperType() const { return buffer ? &String::StringIfHelper : 0; } @@ -184,6 +189,7 @@ protected: // copy and move String & copy(const char *cstr, unsigned int length); + String & copy(const __FlashStringHelper *pstr, unsigned int length); #ifdef __GXX_EXPERIMENTAL_CXX0X__ void move(String &rhs); #endif |