Skip to content
Browse files

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.
  • Loading branch information...
1 parent 1d9bbc0 commit 9139094c36f4a355a6bd92505f2210ccd994f92c @damellis damellis committed Mar 11, 2011
Showing with 0 additions and 68 deletions.
  1. +0 −51 hardware/arduino/cores/arduino/WString.cpp
  2. +0 −17 hardware/arduino/cores/arduino/WString.h
View
51 hardware/arduino/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;
View
17 hardware/arduino/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 @@ class String
// 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 @@ class String
// 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 @@ class String
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 @@ class String
// 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 @@ class String
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) {}

0 comments on commit 9139094

Please sign in to comment.
Something went wrong with that request. Please try again.