| Index: mojo/public/cpp/bindings/string.h
|
| diff --git a/mojo/public/cpp/bindings/string.h b/mojo/public/cpp/bindings/string.h
|
| index 3c1520a679e465de6335c5f35408862294b1c120..ba0d8fa81cef0e843829f3f3a2e499908cb5d48d 100644
|
| --- a/mojo/public/cpp/bindings/string.h
|
| +++ b/mojo/public/cpp/bindings/string.h
|
| @@ -25,6 +25,9 @@ class String {
|
| }
|
| String(const char* chars, size_t num_chars)
|
| : value_(chars, num_chars), is_null_(false) {}
|
| + String(const mojo::String& str)
|
| + : value_(str.value_), is_null_(str.is_null_) {}
|
| +
|
| template <size_t N>
|
| String(const char chars[N])
|
| : value_(chars, N - 1), is_null_(false) {}
|
| @@ -39,6 +42,11 @@ class String {
|
| return TypeConverter<U, String>::Convert(*this);
|
| }
|
|
|
| + String& operator=(const mojo::String& str) {
|
| + value_ = str.value_;
|
| + is_null_ = str.is_null_;
|
| + return *this;
|
| + }
|
| String& operator=(const std::string& str) {
|
| value_ = str;
|
| is_null_ = false;
|
| @@ -115,6 +123,15 @@ inline std::ostream& operator<<(std::ostream& out, const String& s) {
|
| return out << s.get();
|
| }
|
|
|
| +inline bool operator<(const String& a, const String& b) {
|
| + if (a.is_null())
|
| + return !b.is_null();
|
| + if (b.is_null())
|
| + return false;
|
| +
|
| + return a.get() < b.get();
|
| +}
|
| +
|
| // TODO(darin): Add similar variants of operator<,<=,>,>=
|
|
|
| template <>
|
|
|