Skip to content
This repository
Browse code

Moving move() to __GXX_EXPERIMENTAL_CXX0X__ only, adding operator boo…

…l().
  • Loading branch information...
commit cc24d41b74124670441cc371dbd726be28fc0ef7 1 parent f5f2e09
David A. Mellis authored March 13, 2011
7  hardware/arduino/cores/arduino/WString.cpp
@@ -157,6 +157,7 @@ String & String::copy(const char *cstr, unsigned int length)
157 157
 	return *this;
158 158
 }
159 159
 
  160
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
160 161
 void String::move(String &rhs)
161 162
 {
162 163
 	if (buffer) {
@@ -176,6 +177,7 @@ void String::move(String &rhs)
176 177
 	rhs.capacity = 0;
177 178
 	rhs.len = 0;
178 179
 }
  180
+#endif
179 181
 
180 182
 String & String::operator = (const String &rhs)
181 183
 {
@@ -340,6 +342,11 @@ StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num)
340 342
 /*  Comparison                               */
341 343
 /*********************************************/
342 344
 
  345
+String::operator bool() const
  346
+{
  347
+	return !!buffer;
  348
+}
  349
+
343 350
 int String::compareTo(const String &s) const
344 351
 {
345 352
 	if (!buffer || !s.buffer) {
3  hardware/arduino/cores/arduino/WString.h
@@ -63,7 +63,9 @@ class String
63 63
 
64 64
 	// copy and move
65 65
 	String & copy(const char *cstr, unsigned int length);
  66
+	#ifdef __GXX_EXPERIMENTAL_CXX0X__
66 67
 	void move(String &rhs);
  68
+	#endif
67 69
 	String & operator = (const String &rhs);
68 70
 	String & operator = (const char *cstr);
69 71
 	#ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -101,6 +103,7 @@ class String
101 103
 	friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num);
102 104
 
103 105
 	// comparison
  106
+	operator bool() const;
104 107
 	int compareTo(const String &s) const;
105 108
 	unsigned char equals(const String &s) const;
106 109
 	unsigned char equals(const char *cstr) const;

0 notes on commit cc24d41

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