summaryrefslogtreecommitdiff
path: root/core/fxcrt/bytestring.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/bytestring.h')
-rw-r--r--core/fxcrt/bytestring.h65
1 files changed, 31 insertions, 34 deletions
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index eba9744402..2b01bc19aa 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -46,8 +46,8 @@ class ByteString {
// NOLINTNEXTLINE(runtime/explicit)
ByteString(wchar_t) = delete;
- ByteString(const char* ptr, FX_STRSIZE len);
- ByteString(const uint8_t* ptr, FX_STRSIZE len);
+ ByteString(const char* ptr, size_t len);
+ ByteString(const uint8_t* ptr, size_t len);
explicit ByteString(const ByteStringView& bstrc);
ByteString(const ByteStringView& bstrc1, const ByteStringView& bstrc2);
@@ -91,13 +91,13 @@ class ByteString {
return const_reverse_iterator(begin());
}
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- FX_STRSIZE GetStringLength() const {
+ size_t GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ size_t GetStringLength() const {
return m_pData ? FXSYS_strlen(m_pData->m_String) : 0;
}
bool IsEmpty() const { return !GetLength(); }
- bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
- bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+ bool IsValidIndex(size_t index) const { return index < GetLength(); }
+ bool IsValidLength(size_t length) const { return length <= GetLength(); }
int Compare(const ByteStringView& str) const;
bool EqualNoCase(const ByteStringView& str) const;
@@ -121,7 +121,7 @@ class ByteString {
const ByteString& operator+=(const ByteString& str);
const ByteString& operator+=(const ByteStringView& bstrc);
- CharType operator[](const FX_STRSIZE index) const {
+ CharType operator[](const size_t index) const {
ASSERT(IsValidIndex(index));
return m_pData ? m_pData->m_String[index] : 0;
}
@@ -129,34 +129,34 @@ class ByteString {
CharType First() const { return GetLength() ? (*this)[0] : 0; }
CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
- void SetAt(FX_STRSIZE index, char c);
+ void SetAt(size_t index, char c);
- FX_STRSIZE Insert(FX_STRSIZE index, char ch);
- FX_STRSIZE InsertAtFront(char ch) { return Insert(0, ch); }
- FX_STRSIZE InsertAtBack(char ch) { return Insert(GetLength(), ch); }
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+ size_t Insert(size_t index, char ch);
+ size_t InsertAtFront(char ch) { return Insert(0, ch); }
+ size_t InsertAtBack(char ch) { return Insert(GetLength(), ch); }
+ size_t Delete(size_t index, size_t count = 1);
void Format(const char* lpszFormat, ...);
void FormatV(const char* lpszFormat, va_list argList);
- void Reserve(FX_STRSIZE len);
- char* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len);
+ void Reserve(size_t len);
+ char* GetBuffer(size_t len);
+ void ReleaseBuffer(size_t len);
- ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- ByteString Left(FX_STRSIZE count) const;
- ByteString Right(FX_STRSIZE count) const;
+ ByteString Mid(size_t first, size_t count) const;
+ ByteString Left(size_t count) const;
+ ByteString Right(size_t count) const;
- pdfium::Optional<FX_STRSIZE> Find(const ByteStringView& lpszSub,
- FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> Find(char ch, FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> ReverseFind(char ch) const;
+ pdfium::Optional<size_t> Find(const ByteStringView& lpszSub,
+ size_t start = 0) const;
+ pdfium::Optional<size_t> Find(char ch, size_t start = 0) const;
+ pdfium::Optional<size_t> ReverseFind(char ch) const;
- bool Contains(const ByteStringView& lpszSub, FX_STRSIZE start = 0) const {
+ bool Contains(const ByteStringView& lpszSub, size_t start = 0) const {
return Find(lpszSub, start).has_value();
}
- bool Contains(char ch, FX_STRSIZE start = 0) const {
+ bool Contains(char ch, size_t start = 0) const {
return Find(ch, start).has_value();
}
@@ -171,10 +171,9 @@ class ByteString {
void TrimLeft(char chTarget);
void TrimLeft(const ByteStringView& lpszTargets);
- FX_STRSIZE Replace(const ByteStringView& lpszOld,
- const ByteStringView& lpszNew);
+ size_t Replace(const ByteStringView& lpszOld, const ByteStringView& lpszNew);
- FX_STRSIZE Remove(char ch);
+ size_t Remove(char ch);
WideString UTF8Decode() const;
@@ -186,13 +185,11 @@ class ByteString {
protected:
using StringData = StringDataTemplate<char>;
- void ReallocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocCopy(ByteString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
+ void ReallocBeforeWrite(size_t nNewLen);
+ void AllocBeforeWrite(size_t nNewLen);
+ void AllocCopy(ByteString& dest, size_t nCopyLen, size_t nCopyIndex) const;
+ void AssignCopy(const char* pSrcData, size_t nSrcLen);
+ void Concat(const char* lpszSrcData, size_t nSrcLen);
RetainPtr<StringData> m_pData;