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 <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 CFX_ByteStringC& operator = (const CFX_ByteStringC& src) | 84 CFX_ByteStringC& operator = (const CFX_ByteStringC& src) |
85 { | 85 { |
86 m_Ptr = src.m_Ptr; | 86 m_Ptr = src.m_Ptr; |
87 m_Length = src.m_Length; | 87 m_Length = src.m_Length; |
88 return *this; | 88 return *this; |
89 } | 89 } |
90 | 90 |
91 CFX_ByteStringC& operator = (const CFX_ByteString& src); | 91 CFX_ByteStringC& operator = (const CFX_ByteString& src); |
92 | 92 |
93 bool operator== (const char* ptr) const { | 93 bool operator== (const char* ptr) const { |
94 return strlen(ptr) == m_Length && | 94 return (FX_STRSIZE)FXSYS_strlen(ptr) == m_Length && |
95 FXSYS_memcmp32(ptr, m_Ptr, m_Length) == 0; | 95 FXSYS_memcmp32(ptr, m_Ptr, m_Length) == 0; |
96 } | 96 } |
97 bool operator== (const CFX_ByteStringC& other) const { | 97 bool operator== (const CFX_ByteStringC& other) const { |
98 return other.m_Length == m_Length && | 98 return other.m_Length == m_Length && |
99 FXSYS_memcmp32(other.m_Ptr, m_Ptr, m_Length) == 0; | 99 FXSYS_memcmp32(other.m_Ptr, m_Ptr, m_Length) == 0; |
100 } | 100 } |
101 bool operator!= (const char* ptr) const { return !(*this == ptr); } | 101 bool operator!= (const char* ptr) const { return !(*this == ptr); } |
102 bool operator!= (const CFX_ByteStringC& other) const { | 102 bool operator!= (const CFX_ByteStringC& other) const { |
103 return !(*this == other); | 103 return !(*this == other); |
104 } | 104 } |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 CFX_WideStringC& operator = (const CFX_WideStringC& src) | 503 CFX_WideStringC& operator = (const CFX_WideStringC& src) |
504 { | 504 { |
505 m_Ptr = src.m_Ptr; | 505 m_Ptr = src.m_Ptr; |
506 m_Length = src.m_Length; | 506 m_Length = src.m_Length; |
507 return *this; | 507 return *this; |
508 } | 508 } |
509 | 509 |
510 CFX_WideStringC& operator = (const CFX_WideString& src); | 510 CFX_WideStringC& operator = (const CFX_WideString& src); |
511 | 511 |
512 bool operator== (const wchar_t* ptr) const { | 512 bool operator== (const wchar_t* ptr) const { |
513 return FXSYS_wcslen(ptr) == m_Length && | 513 return (FX_STRSIZE)FXSYS_wcslen(ptr) == m_Length && |
514 wmemcmp(ptr, m_Ptr, m_Length) == 0; | 514 wmemcmp(ptr, m_Ptr, m_Length) == 0; |
515 } | 515 } |
516 bool operator== (const CFX_WideStringC& str) const { | 516 bool operator== (const CFX_WideStringC& str) const { |
517 return str.m_Length == m_Length && | 517 return str.m_Length == m_Length && |
518 wmemcmp(str.m_Ptr, m_Ptr, m_Length) == 0; | 518 wmemcmp(str.m_Ptr, m_Ptr, m_Length) == 0; |
519 } | 519 } |
520 bool operator!= (const wchar_t* ptr) const { return !(*this == ptr); } | 520 bool operator!= (const wchar_t* ptr) const { return !(*this == ptr); } |
521 bool operator!= (const CFX_WideStringC& str) const { | 521 bool operator!= (const CFX_WideStringC& str) const { |
522 return !(*this == str); | 522 return !(*this == str); |
523 } | 523 } |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); | 872 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); |
873 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 873 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
874 { | 874 { |
875 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 875 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
876 } | 876 } |
877 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 877 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
878 { | 878 { |
879 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 879 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
880 } | 880 } |
881 #endif | 881 #endif |
OLD | NEW |