[gnoduino: 25/237] Moving move() to __GXX_EXPERIMENTAL_CXX0X__ only, adding operator bool().
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino: 25/237] Moving move() to __GXX_EXPERIMENTAL_CXX0X__ only, adding operator bool().
- Date: Sat, 31 Mar 2012 20:16:55 +0000 (UTC)
commit d1bd5a2b6a25fa6d17628aa97951ac02e87978f1
Author: David A. Mellis <d mellis arduino cc>
Date: Sun Mar 13 16:46:06 2011 -0400
Moving move() to __GXX_EXPERIMENTAL_CXX0X__ only, adding operator bool().
arduino/cores/arduino/WString.cpp | 7 +++++++
arduino/cores/arduino/WString.h | 3 +++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/arduino/cores/arduino/WString.cpp b/arduino/cores/arduino/WString.cpp
index 5dcf585..41c80e8 100644
--- a/arduino/cores/arduino/WString.cpp
+++ b/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) {
diff --git a/arduino/cores/arduino/WString.h b/arduino/cores/arduino/WString.h
index f797861..5e78ee5 100644
--- a/arduino/cores/arduino/WString.h
+++ b/arduino/cores/arduino/WString.h
@@ -63,7 +63,9 @@ public:
// 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 @@ public:
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]