@@ -34,7 +34,8 @@ class StringSumHelper;
3434
3535// an abstract class used as a means to proide a unique pointer type
3636// but really has no body
37- // class __FlashStringHelper;
37+ class __FlashStringHelper ;
38+ #define F (string_literal ) (reinterpret_cast <const __FlashStringHelper *>(PSTR(string_literal)))
3839
3940// The string class
4041class String
@@ -55,7 +56,7 @@ class String
5556 // be false).
5657 String (const char *cstr = " " );
5758 String (const String &str);
58- // String(const __FlashStringHelper *str);
59+ String (const __FlashStringHelper *str) : String( reinterpret_cast < const char *>(str)) {} ;
5960#ifdef __GXX_EXPERIMENTAL_CXX0X__
6061 String (String &&rval);
6162 String (StringSumHelper &&rval);
@@ -89,7 +90,7 @@ class String
8990 // marked as invalid ("if (s)" will be false).
9091 String & operator =(const String &rhs);
9192 String & operator =(const char *cstr);
92- // String & operator = (const __FlashStringHelper *str);
93+ String & operator = (const __FlashStringHelper *str);
9394#ifdef __GXX_EXPERIMENTAL_CXX0X__
9495 String & operator =(String &&rval);
9596 String & operator =(StringSumHelper &&rval);
@@ -110,7 +111,7 @@ class String
110111 unsigned char concat (unsigned long num);
111112 unsigned char concat (float num);
112113 unsigned char concat (double num);
113- // unsigned char concat(const __FlashStringHelper * str);
114+ unsigned char concat (const __FlashStringHelper * str);
114115
115116 // if there's not enough memory for the concatenated value, the string
116117 // will be left unchanged (but this isn't signalled in any way)
@@ -164,10 +165,11 @@ class String
164165 concat (num);
165166 return (*this );
166167 }
167- // String & operator += (const __FlashStringHelper *str){
168- // concat(str);
169- // return (*this);
170- // }
168+ String & operator += (const __FlashStringHelper *str)
169+ {
170+ concat (str);
171+ return (*this );
172+ }
171173
172174 friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
173175 friend StringSumHelper & operator +(const StringSumHelper &lhs, const char *cstr);
@@ -179,7 +181,7 @@ class String
179181 friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long num);
180182 friend StringSumHelper & operator +(const StringSumHelper &lhs, float num);
181183 friend StringSumHelper & operator +(const StringSumHelper &lhs, double num);
182- // friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
184+ friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
183185
184186 // comparison (only works w/ Strings and "strings")
185187 operator StringIfHelperType () const
@@ -270,7 +272,7 @@ class String
270272
271273 // copy and move
272274 String & copy (const char *cstr, unsigned int length);
273- // String & copy(const __FlashStringHelper *pstr, unsigned int length);
275+ String & copy (const __FlashStringHelper *pstr, unsigned int length);
274276#ifdef __GXX_EXPERIMENTAL_CXX0X__
275277 void move (String &rhs);
276278#endif
0 commit comments