mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
Moving move() to __GXX_EXPERIMENTAL_CXX0X__ only, adding operator bool().
This commit is contained in:
parent
f5f2e09636
commit
cc24d41b74
@ -157,6 +157,7 @@ String & String::copy(const char *cstr, unsigned int length)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
void String::move(String &rhs)
|
void String::move(String &rhs)
|
||||||
{
|
{
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
@ -176,6 +177,7 @@ void String::move(String &rhs)
|
|||||||
rhs.capacity = 0;
|
rhs.capacity = 0;
|
||||||
rhs.len = 0;
|
rhs.len = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
String & String::operator = (const String &rhs)
|
String & String::operator = (const String &rhs)
|
||||||
{
|
{
|
||||||
@ -340,6 +342,11 @@ StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num)
|
|||||||
/* Comparison */
|
/* Comparison */
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
|
||||||
|
String::operator bool() const
|
||||||
|
{
|
||||||
|
return !!buffer;
|
||||||
|
}
|
||||||
|
|
||||||
int String::compareTo(const String &s) const
|
int String::compareTo(const String &s) const
|
||||||
{
|
{
|
||||||
if (!buffer || !s.buffer) {
|
if (!buffer || !s.buffer) {
|
||||||
|
@ -63,7 +63,9 @@ public:
|
|||||||
|
|
||||||
// copy and move
|
// copy and move
|
||||||
String & copy(const char *cstr, unsigned int length);
|
String & copy(const char *cstr, unsigned int length);
|
||||||
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
void move(String &rhs);
|
void move(String &rhs);
|
||||||
|
#endif
|
||||||
String & operator = (const String &rhs);
|
String & operator = (const String &rhs);
|
||||||
String & operator = (const char *cstr);
|
String & operator = (const char *cstr);
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
@ -101,6 +103,7 @@ public:
|
|||||||
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num);
|
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num);
|
||||||
|
|
||||||
// comparison
|
// comparison
|
||||||
|
operator bool() const;
|
||||||
int compareTo(const String &s) const;
|
int compareTo(const String &s) const;
|
||||||
unsigned char equals(const String &s) const;
|
unsigned char equals(const String &s) const;
|
||||||
unsigned char equals(const char *cstr) const;
|
unsigned char equals(const char *cstr) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user