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_FXCRT_INCLUDE_FX_STRING_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_STRING_H_ |
8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_ |
9 | 9 |
10 #include <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 const uint8_t* raw_str() const { return m_Ptr; } | 93 const uint8_t* raw_str() const { return m_Ptr; } |
94 const FX_CHAR* c_str() const { | 94 const FX_CHAR* c_str() const { |
95 return reinterpret_cast<const FX_CHAR*>(m_Ptr); | 95 return reinterpret_cast<const FX_CHAR*>(m_Ptr); |
96 } | 96 } |
97 | 97 |
98 FX_STRSIZE GetLength() const { return m_Length; } | 98 FX_STRSIZE GetLength() const { return m_Length; } |
99 bool IsEmpty() const { return m_Length == 0; } | 99 bool IsEmpty() const { return m_Length == 0; } |
100 | 100 |
101 uint8_t GetAt(FX_STRSIZE index) const { return m_Ptr[index]; } | 101 uint8_t GetAt(FX_STRSIZE index) const { return m_Ptr[index]; } |
| 102 FX_CHAR CharAt(FX_STRSIZE index) const { |
| 103 return static_cast<FX_CHAR>(m_Ptr[index]); |
| 104 } |
102 | 105 |
103 FX_STRSIZE Find(FX_CHAR ch) const { | 106 FX_STRSIZE Find(FX_CHAR ch) const { |
104 const uint8_t* found = | 107 const uint8_t* found = |
105 static_cast<const uint8_t*>(memchr(m_Ptr, ch, m_Length)); | 108 static_cast<const uint8_t*>(memchr(m_Ptr, ch, m_Length)); |
106 return found ? found - m_Ptr : -1; | 109 return found ? found - m_Ptr : -1; |
107 } | 110 } |
108 | 111 |
109 CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const { | 112 CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const { |
110 if (index < 0) { | 113 if (index < 0) { |
111 index = 0; | 114 index = 0; |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 683 } |
681 | 684 |
682 FX_FLOAT FX_atof(const CFX_ByteStringC& str); | 685 FX_FLOAT FX_atof(const CFX_ByteStringC& str); |
683 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { | 686 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { |
684 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); | 687 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); |
685 } | 688 } |
686 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); | 689 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); |
687 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 690 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); |
688 | 691 |
689 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ | 692 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ |
OLD | NEW |