diff options
author | Lei Zhang <thestig@chromium.org> | 2017-11-06 19:00:21 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-06 19:00:21 +0000 |
commit | d7a3f981fdc6bf9aef306854505638db7b4b51c7 (patch) | |
tree | bb83ad096cf3618b864e93f4cbb07632a9510368 /core/fxcrt/widestring.h | |
parent | ac7ce6ec217ba7b4753f4cf2ed80c921d8ea6898 (diff) | |
download | pdfium-d7a3f981fdc6bf9aef306854505638db7b4b51c7.tar.xz |
Improve ByteString{View}::operator<().
Make it possible to compare:
1) const char* < ByteStringView
2) ByteString < const char*
3) ByteString < ByteStringView
4) const char* < ByteString
Do the same for WideString{View}. With new unit test cases.
Change-Id: I31da526b1ab78b8d51ec1c99bf29046fe13754d5
Reviewed-on: https://pdfium-review.googlesource.com/17872
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring.h')
-rw-r--r-- | core/fxcrt/widestring.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h index 745fa5b2ab..01c4eedaf1 100644 --- a/core/fxcrt/widestring.h +++ b/core/fxcrt/widestring.h @@ -114,7 +114,9 @@ class WideString { bool operator!=(const WideStringView& str) const { return !(*this == str); } bool operator!=(const WideString& other) const { return !(*this == other); } - bool operator<(const WideString& str) const; + bool operator<(const wchar_t* ptr) const; + bool operator<(const WideStringView& str) const; + bool operator<(const WideString& other) const; CharType operator[](const size_t index) const { ASSERT(IsValidIndex(index)); @@ -247,6 +249,9 @@ inline bool operator!=(const wchar_t* lhs, const WideString& rhs) { inline bool operator!=(const WideStringView& lhs, const WideString& rhs) { return rhs != lhs; } +inline bool operator<(const wchar_t* lhs, const WideString& rhs) { + return rhs.Compare(lhs) > 0; +} std::wostream& operator<<(std::wostream& os, const WideString& str); std::ostream& operator<<(std::ostream& os, const WideString& str); |