updates
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal-eddystone by
Revision 52:3db7b4d64316, committed 2016-07-13
- Comitter:
- LancasterUniversity
- Date:
- Wed Jul 13 12:18:31 2016 +0100
- Parent:
- 51:9198e7bb83dc
- Child:
- 53:ee44932401cb
- Commit message:
- Synchronized with git rev 8468823e
Changed in this revision
inc/types/ManagedString.h | Show annotated file Show diff for this revision Revisions of this file |
source/types/ManagedString.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/inc/types/ManagedString.h Wed Jul 13 12:18:30 2016 +0100 +++ b/inc/types/ManagedString.h Wed Jul 13 12:18:31 2016 +0100 @@ -300,9 +300,10 @@ ManagedString substring(int16_t start, int16_t length); /** - * Concatenates this string with the one provided. + * Concatenates two strings. * - * @param s The ManagedString to concatenate. + * @param lhs The first ManagedString to concatenate. + * @param rhs The second ManagedString to concatenate. * * @return a new ManagedString representing the joined strings. * @@ -314,7 +315,7 @@ * display.scroll(s + p) // scrolls "abcdefgh" * @endcode */ - ManagedString operator+ (const ManagedString& s); + friend ManagedString operator+ (const ManagedString& lhs, const ManagedString& rhs); /** * Provides a character value at a given position in the string, indexed from zero.
--- a/source/types/ManagedString.cpp Wed Jul 13 12:18:30 2016 +0100 +++ b/source/types/ManagedString.cpp Wed Jul 13 12:18:31 2016 +0100 @@ -437,9 +437,10 @@ } /** - * Concatenates this string with the one provided. + * Concatenates two strings. * - * @param s The ManagedString to concatenate. + * @param lhs The first ManagedString to concatenate. + * @param rhs The second ManagedString to concatenate. * * @return a new ManagedString representing the joined strings. * @@ -451,16 +452,17 @@ * display.scroll(s + p) // scrolls "abcdefgh" * @endcode */ -ManagedString ManagedString::operator+ (const ManagedString& s) +ManagedString operator+ (const ManagedString& lhs, const ManagedString& rhs) { - // If the other string is empty, nothing to do! - if(s.length() == 0) - return *this; + + // If the either string is empty, nothing to do! + if (rhs.length() == 0) + return lhs; - if (length() == 0) - return s; + if (lhs.length() == 0) + return rhs; - return ManagedString(*this, s); + return ManagedString(lhs, rhs); }