OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FX_STRING_H_ | 7 #ifndef _FX_STRING_H_ |
8 #define _FX_STRING_H_ | 8 #define _FX_STRING_H_ |
9 | 9 |
| 10 #include <algorithm> |
| 11 |
10 #include "fx_memory.h" | 12 #include "fx_memory.h" |
11 | 13 |
12 class CFX_ByteStringC; | 14 class CFX_ByteStringC; |
13 class CFX_ByteString; | 15 class CFX_ByteString; |
14 class CFX_WideStringC; | 16 class CFX_WideStringC; |
15 class CFX_WideString; | 17 class CFX_WideString; |
16 struct CFX_CharMap; | 18 struct CFX_CharMap; |
17 class CFX_BinaryBuf; | 19 class CFX_BinaryBuf; |
18 typedef int FX_STRSIZE; | 20 typedef int FX_STRSIZE; |
19 class CFX_ByteStringL; | 21 class CFX_ByteStringL; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 const CFX_WideString& operator =(const CFX_WideStringC& stringSrc); | 697 const CFX_WideString& operator =(const CFX_WideStringC& stringSrc); |
696 | 698 |
697 const CFX_WideString& operator += (FX_LPCWSTR str); | 699 const CFX_WideString& operator += (FX_LPCWSTR str); |
698 | 700 |
699 const CFX_WideString& operator += (FX_WCHAR ch); | 701 const CFX_WideString& operator += (FX_WCHAR ch); |
700 | 702 |
701 const CFX_WideString& operator += (const CFX_WideString& str); | 703 const CFX_WideString& operator += (const CFX_WideString& str); |
702 | 704 |
703 const CFX_WideString& operator += (const CFX_WideStringC& str); | 705 const CFX_WideString& operator += (const CFX_WideStringC& str); |
704 | 706 |
| 707 bool operator< (const CFX_WideString& str) const { |
| 708 int result = wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.Get
Length())); |
| 709 return result < 0 || (result == 0 && GetLength() < str.GetLength()); |
| 710 } |
| 711 |
705 FX_WCHAR GetAt(FX_STRSIZE nIndex) const | 712 FX_WCHAR GetAt(FX_STRSIZE nIndex) const |
706 { | 713 { |
707 return m_pData ? m_pData->m_String[nIndex] : 0; | 714 return m_pData ? m_pData->m_String[nIndex] : 0; |
708 } | 715 } |
709 | 716 |
710 FX_WCHAR operator[](FX_STRSIZE nIndex) const | 717 FX_WCHAR operator[](FX_STRSIZE nIndex) const |
711 { | 718 { |
712 return m_pData ? m_pData->m_String[nIndex] : 0; | 719 return m_pData ? m_pData->m_String[nIndex] : 0; |
713 } | 720 } |
714 | 721 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); | 874 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); |
868 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 875 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
869 { | 876 { |
870 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 877 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
871 } | 878 } |
872 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 879 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
873 { | 880 { |
874 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 881 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
875 } | 882 } |
876 #endif | 883 #endif |
OLD | NEW |