Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…l().
  • Loading branch information...
commit cc24d41b74124670441cc371dbd726be28fc0ef7 1 parent f5f2e09
@damellis damellis authored
View
7 hardware/arduino/cores/arduino/WString.cpp
@@ -157,6 +157,7 @@ String & String::copy(const char *cstr, unsigned int length)
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
void String::move(String &rhs)
{
if (buffer) {
@@ -176,6 +177,7 @@ void String::move(String &rhs)
rhs.capacity = 0;
rhs.len = 0;
}
+#endif
String & String::operator = (const String &rhs)
{
@@ -340,6 +342,11 @@ StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num)
/* Comparison */
/*********************************************/
+String::operator bool() const
+{
+ return !!buffer;
+}
+
int String::compareTo(const String &s) const
{
if (!buffer || !s.buffer) {
View
3  hardware/arduino/cores/arduino/WString.h
@@ -63,7 +63,9 @@ class String
// copy and move
String & copy(const char *cstr, unsigned int length);
+ #ifdef __GXX_EXPERIMENTAL_CXX0X__
void move(String &rhs);
+ #endif
String & operator = (const String &rhs);
String & operator = (const char *cstr);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -101,6 +103,7 @@ class String
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num);
// comparison
+ operator bool() const;
int compareTo(const String &s) const;
unsigned char equals(const String &s) const;
unsigned char equals(const char *cstr) const;

0 comments on commit cc24d41

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