diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2011-03-11 18:01:40 -0500 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2011-03-11 18:01:40 -0500 |
commit | 22786eaed2494bf6fcd9b934f857dec1202b3148 (patch) | |
tree | d1992959631ec8c6c1215e4e0bf6fe588ecbad78 | |
parent | 438bca3cb270b0d882b6b3b0bc42d57d72307c76 (diff) |
Removing F("string") syntax for now.
We should probably add something like this back in later, but I want to do one thing at a time. This removes the __FlashStringHelper class as well.
-rw-r--r-- | cores/arduino/WString.cpp | 51 | ||||
-rw-r--r-- | cores/arduino/WString.h | 17 |
2 files changed, 0 insertions, 68 deletions
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp index c980e24..b988acc 100644 --- a/cores/arduino/WString.cpp +++ b/cores/arduino/WString.cpp @@ -32,12 +32,6 @@ String::String(const char *cstr) if (cstr) copy(cstr, strlen(cstr)); } -String::String(const __FlashStringHelper *pgmstr) -{ - init(); - *this = pgmstr; -} - String::String(const String &value) { init(); @@ -163,22 +157,6 @@ String & String::copy(const char *cstr, unsigned int length) return *this; } -String & String::copy(const __FlashStringHelper *pgmstr) -{ - unsigned int length = strlen_P((const prog_char *)pgmstr); - if (!reserve(length)) { - if (buffer) { - free(buffer); - buffer = NULL; - } - len = capacity = 0; - return *this; - } - len = length; - strcpy_P(buffer, (const prog_char *)pgmstr); - return *this; -} - void String::move(String &rhs) { if (buffer) { @@ -229,12 +207,6 @@ String & String::operator = (const char *cstr) return *this; } -String & String::operator = (const __FlashStringHelper *pgmstr) -{ - copy(pgmstr); - return *this; -} - String & String::operator = (char c) { char buf[2]; @@ -267,16 +239,6 @@ String & String::append(const char *cstr) return *this; } -String & String::append(const __FlashStringHelper *pgmstr) -{ - unsigned int length = strlen_P((const prog_char *)pgmstr); - unsigned int newlen = len + length; - if (length == 0 || !reserve(newlen)) return *this; - strcpy_P(buffer + len, (const prog_char *)pgmstr); - len = newlen; - return *this; -} - String & String::append(char c) { char buf[2]; @@ -336,13 +298,6 @@ StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr) return a; } -StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *pgmstr) -{ - StringSumHelper &a = const_cast<StringSumHelper&>(lhs); - a.append(pgmstr); - return a; -} - StringSumHelper & operator + (const StringSumHelper &lhs, char c) { StringSumHelper &a = const_cast<StringSumHelper&>(lhs); @@ -411,12 +366,6 @@ unsigned char String::equals(const char *cstr) const return strcmp(buffer, cstr) == 0; } -unsigned char String::equals(const __FlashStringHelper *pgmstr) const -{ - if (len == 0) return pgm_read_byte(pgmstr) == 0; - return strcmp_P(buffer, (const prog_char *)pgmstr) == 0; -} - unsigned char String::operator<(const String &rhs) const { return compareTo(rhs) < 0; diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index 541a118..6111e20 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -34,13 +34,6 @@ // -felide-constructors // -std=c++0x -// Brian Cook's "no overhead" Flash String type (message on Dec 14, 2010) -// modified by Mikal Hart for his FlashString library -class __FlashStringHelper; -#ifndef F -#define F(string_literal) (reinterpret_cast<__FlashStringHelper *>(PSTR(string_literal))) -#endif - // An inherited class for holding the result of a concatenation. These // result objects are assumed to be writable by subsequent concatenations. class StringSumHelper; @@ -51,7 +44,6 @@ class String public: // constructors String(const char *cstr = NULL); - String(const __FlashStringHelper *pgmstr); String(const String &str); #ifdef __GXX_EXPERIMENTAL_CXX0X__ String(String &&rval); @@ -71,11 +63,9 @@ public: // copy and move String & copy(const char *cstr, unsigned int length); - String & copy(const __FlashStringHelper *pgmstr); void move(String &rhs); String & operator = (const String &rhs); String & operator = (const char *cstr); - String & operator = (const __FlashStringHelper *pgmstr); #ifdef __GXX_EXPERIMENTAL_CXX0X__ String & operator = (String &&rval); String & operator = (StringSumHelper &&rval); @@ -85,7 +75,6 @@ public: // append String & append(const String &str); String & append(const char *cstr); - String & append(const __FlashStringHelper *pgmstr); String & append(char c); String & append(unsigned char c) {return append((char)c);} String & append(int num); @@ -94,7 +83,6 @@ public: String & append(unsigned long num); String & operator += (const String &rhs) {return append(rhs);} String & operator += (const char *cstr) {return append(cstr);} - String & operator += (const __FlashStringHelper *pgmstr) {return append(pgmstr);} String & operator += (char c) {return append(c);} String & operator += (unsigned char c) {return append((char)c);} String & operator += (int num) {return append(num);} @@ -105,7 +93,6 @@ public: // concatenate friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs); friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr); - friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *pgmstr); friend StringSumHelper & operator + (const StringSumHelper &lhs, char c); friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned char c); friend StringSumHelper & operator + (const StringSumHelper &lhs, int num); @@ -117,13 +104,10 @@ public: int compareTo(const String &s) const; unsigned char equals(const String &s) const; unsigned char equals(const char *cstr) const; - unsigned char equals(const __FlashStringHelper *pgmstr) const; unsigned char operator == (const String &rhs) const {return equals(rhs);} unsigned char operator == (const char *cstr) const {return equals(cstr);} - unsigned char operator == (const __FlashStringHelper *pgmstr) const {return equals(pgmstr);} unsigned char operator != (const String &rhs) const {return !equals(rhs);} unsigned char operator != (const char *cstr) const {return !equals(cstr);} - unsigned char operator != (const __FlashStringHelper *pgmstr) const {return !equals(pgmstr);} unsigned char operator < (const String &rhs) const; unsigned char operator > (const String &rhs) const; unsigned char operator <= (const String &rhs) const; @@ -180,7 +164,6 @@ class StringSumHelper : public String public: StringSumHelper(const String &s) : String(s) {} StringSumHelper(const char *p) : String(p) {} - StringSumHelper(const __FlashStringHelper *pgmstr) : String(pgmstr) {} StringSumHelper(char c) : String(c) {} StringSumHelper(unsigned char c) : String(c) {} StringSumHelper(int num) : String(num, 10) {} |