| 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 CORE_INCLUDE_FXCRT_FX_STRING_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_STRING_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_STRING_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_STRING_H_ |
| 9 | 9 |
| 10 #include <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 FX_STRSIZE GetLength() const | 114 FX_STRSIZE GetLength() const |
| 115 { | 115 { |
| 116 return m_Length; | 116 return m_Length; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool IsEmpty() const | 119 bool IsEmpty() const |
| 120 { | 120 { |
| 121 return m_Length == 0; | 121 return m_Length == 0; |
| 122 } | 122 } |
| 123 | 123 |
| 124 FX_BYTE» » » GetAt(FX_STRSIZE index) const | 124 uint8_t» » » GetAt(FX_STRSIZE index) const |
| 125 { | 125 { |
| 126 return m_Ptr[index]; | 126 return m_Ptr[index]; |
| 127 } | 127 } |
| 128 | 128 |
| 129 CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const | 129 CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const |
| 130 { | 130 { |
| 131 if (index < 0) { | 131 if (index < 0) { |
| 132 index = 0; | 132 index = 0; |
| 133 } | 133 } |
| 134 if (index > m_Length) { | 134 if (index > m_Length) { |
| 135 return CFX_ByteStringC(); | 135 return CFX_ByteStringC(); |
| 136 } | 136 } |
| 137 if (count < 0 || count > m_Length - index) { | 137 if (count < 0 || count > m_Length - index) { |
| 138 count = m_Length - index; | 138 count = m_Length - index; |
| 139 } | 139 } |
| 140 return CFX_ByteStringC(m_Ptr + index, count); | 140 return CFX_ByteStringC(m_Ptr + index, count); |
| 141 } | 141 } |
| 142 | 142 |
| 143 const FX_BYTE& operator[] (size_t index) const | 143 const uint8_t& operator[] (size_t index) const |
| 144 { | 144 { |
| 145 return m_Ptr[index]; | 145 return m_Ptr[index]; |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool operator< (const CFX_ByteStringC& that) const | 148 bool operator< (const CFX_ByteStringC& that) const |
| 149 { | 149 { |
| 150 int result = memcmp(m_Ptr, that.m_Ptr, std::min(m_Length, that.m_Length)
); | 150 int result = memcmp(m_Ptr, that.m_Ptr, std::min(m_Length, that.m_Length)
); |
| 151 return result < 0 || (result == 0 && m_Length < that.m_Length); | 151 return result < 0 || (result == 0 && m_Length < that.m_Length); |
| 152 } | 152 } |
| 153 | 153 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 void Load(FX_LPCBYTE str, FX_STRSIZE
len); | 272 void Load(FX_LPCBYTE str, FX_STRSIZE
len); |
| 273 | 273 |
| 274 const CFX_ByteString& operator += (FX_CHAR ch); | 274 const CFX_ByteString& operator += (FX_CHAR ch); |
| 275 | 275 |
| 276 const CFX_ByteString& operator += (FX_LPCSTR str); | 276 const CFX_ByteString& operator += (FX_LPCSTR str); |
| 277 | 277 |
| 278 const CFX_ByteString& operator += (const CFX_ByteString& str); | 278 const CFX_ByteString& operator += (const CFX_ByteString& str); |
| 279 | 279 |
| 280 const CFX_ByteString& operator += (FX_BSTR bstrc); | 280 const CFX_ByteString& operator += (FX_BSTR bstrc); |
| 281 | 281 |
| 282 FX_BYTE» » » » » GetAt(FX_STRSIZE nIndex) const | 282 uint8_t» » » » » GetAt(FX_STRSIZE nIndex) const |
| 283 { | 283 { |
| 284 return m_pData ? m_pData->m_String[nIndex] : 0; | 284 return m_pData ? m_pData->m_String[nIndex] : 0; |
| 285 } | 285 } |
| 286 | 286 |
| 287 FX_BYTE» » » » » operator[](FX_STRSIZE nIndex) co
nst | 287 uint8_t» » » » » operator[](FX_STRSIZE nIndex) co
nst |
| 288 { | 288 { |
| 289 return m_pData ? m_pData->m_String[nIndex] : 0; | 289 return m_pData ? m_pData->m_String[nIndex] : 0; |
| 290 } | 290 } |
| 291 | 291 |
| 292 void SetAt(FX_STRSIZE nIndex, FX_CHAR
ch); | 292 void SetAt(FX_STRSIZE nIndex, FX_CHAR
ch); |
| 293 | 293 |
| 294 FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch); | 294 FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch); |
| 295 | 295 |
| 296 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE coun
t = 1); | 296 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE coun
t = 1); |
| 297 | 297 |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 903 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
| 904 { | 904 { |
| 905 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 905 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
| 906 } | 906 } |
| 907 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 907 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
| 908 { | 908 { |
| 909 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 909 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
| 910 } | 910 } |
| 911 | 911 |
| 912 #endif // CORE_INCLUDE_FXCRT_FX_STRING_H_ | 912 #endif // CORE_INCLUDE_FXCRT_FX_STRING_H_ |
| OLD | NEW |