| Index: core/fxcrt/include/fx_string.h
|
| diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h
|
| index 142f9372d0835e4f552dd03ced272d6acb65c2eb..e19a972118d4b93f8c9926ca65b553329af6b4db 100644
|
| --- a/core/fxcrt/include/fx_string.h
|
| +++ b/core/fxcrt/include/fx_string.h
|
| @@ -34,14 +34,13 @@ class CFX_ByteString {
|
| public:
|
| using CharType = FX_CHAR;
|
|
|
| - CFX_ByteString() {}
|
| - CFX_ByteString(const CFX_ByteString& other) : m_pData(other.m_pData) {}
|
| - CFX_ByteString(CFX_ByteString&& other) { m_pData.Swap(other.m_pData); }
|
| + CFX_ByteString();
|
| + CFX_ByteString(const CFX_ByteString& other);
|
| + CFX_ByteString(CFX_ByteString&& other);
|
|
|
| // Deliberately implicit to avoid calling on every string literal.
|
| CFX_ByteString(char ch);
|
| - CFX_ByteString(const FX_CHAR* ptr)
|
| - : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
|
| + CFX_ByteString(const FX_CHAR* ptr);
|
|
|
| CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len);
|
| CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
|
| @@ -51,30 +50,25 @@ class CFX_ByteString {
|
|
|
| ~CFX_ByteString();
|
|
|
| - void clear() { m_pData.Reset(); }
|
| + void clear();
|
|
|
| static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1);
|
| static CFX_ByteString FromUnicode(const CFX_WideString& str);
|
|
|
| // Explicit conversion to C-style string.
|
| // Note: Any subsequent modification of |this| will invalidate the result.
|
| - const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; }
|
| + const FX_CHAR* c_str() const;
|
|
|
| // Explicit conversion to uint8_t*.
|
| // Note: Any subsequent modification of |this| will invalidate the result.
|
| - const uint8_t* raw_str() const {
|
| - return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
|
| - : nullptr;
|
| - }
|
| + const uint8_t* raw_str() const;
|
|
|
| // Explicit conversion to CFX_ByteStringC.
|
| // Note: Any subsequent modification of |this| will invalidate the result.
|
| - CFX_ByteStringC AsStringC() const {
|
| - return CFX_ByteStringC(raw_str(), GetLength());
|
| - }
|
| + CFX_ByteStringC AsStringC() const;
|
|
|
| - FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
|
| - bool IsEmpty() const { return !GetLength(); }
|
| + FX_STRSIZE GetLength() const;
|
| + bool IsEmpty() const;
|
|
|
| int Compare(const CFX_ByteStringC& str) const;
|
| bool EqualNoCase(const CFX_ByteStringC& str) const;
|
| @@ -83,17 +77,11 @@ class CFX_ByteString {
|
| bool operator==(const CFX_ByteStringC& str) const;
|
| bool operator==(const CFX_ByteString& other) const;
|
|
|
| - bool operator!=(const char* ptr) const { return !(*this == ptr); }
|
| - bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); }
|
| - bool operator!=(const CFX_ByteString& other) const {
|
| - return !(*this == other);
|
| - }
|
| + bool operator!=(const char* ptr) const;
|
| + bool operator!=(const CFX_ByteStringC& str) const;
|
| + bool operator!=(const CFX_ByteString& other) const;
|
|
|
| - bool operator<(const CFX_ByteString& str) const {
|
| - int result = FXSYS_memcmp(c_str(), str.c_str(),
|
| - std::min(GetLength(), str.GetLength()));
|
| - return result < 0 || (result == 0 && GetLength() < str.GetLength());
|
| - }
|
| + bool operator<(const CFX_ByteString& str) const;
|
|
|
| const CFX_ByteString& operator=(const FX_CHAR* str);
|
| const CFX_ByteString& operator=(const CFX_ByteStringC& bstrc);
|
| @@ -104,13 +92,9 @@ class CFX_ByteString {
|
| const CFX_ByteString& operator+=(const CFX_ByteString& str);
|
| const CFX_ByteString& operator+=(const CFX_ByteStringC& bstrc);
|
|
|
| - uint8_t GetAt(FX_STRSIZE nIndex) const {
|
| - return m_pData ? m_pData->m_String[nIndex] : 0;
|
| - }
|
| + uint8_t GetAt(FX_STRSIZE nIndex) const;
|
|
|
| - uint8_t operator[](FX_STRSIZE nIndex) const {
|
| - return m_pData ? m_pData->m_String[nIndex] : 0;
|
| - }
|
| + uint8_t operator[](FX_STRSIZE nIndex) const;
|
|
|
| void SetAt(FX_STRSIZE nIndex, FX_CHAR ch);
|
| FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch);
|
| @@ -238,14 +222,13 @@ class CFX_WideString {
|
| public:
|
| using CharType = FX_WCHAR;
|
|
|
| - CFX_WideString() {}
|
| - CFX_WideString(const CFX_WideString& other) : m_pData(other.m_pData) {}
|
| - CFX_WideString(CFX_WideString&& other) { m_pData.Swap(other.m_pData); }
|
| + CFX_WideString();
|
| + CFX_WideString(const CFX_WideString& other);
|
| + CFX_WideString(CFX_WideString&& other);
|
|
|
| // Deliberately implicit to avoid calling on every string literal.
|
| CFX_WideString(FX_WCHAR ch);
|
| - CFX_WideString(const FX_WCHAR* ptr)
|
| - : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
|
| + CFX_WideString(const FX_WCHAR* ptr);
|
|
|
| CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len);
|
|
|
| @@ -265,18 +248,16 @@ class CFX_WideString {
|
|
|
| // Explicit conversion to C-style wide string.
|
| // Note: Any subsequent modification of |this| will invalidate the result.
|
| - const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; }
|
| + const FX_WCHAR* c_str() const;
|
|
|
| // Explicit conversion to CFX_WideStringC.
|
| // Note: Any subsequent modification of |this| will invalidate the result.
|
| - CFX_WideStringC AsStringC() const {
|
| - return CFX_WideStringC(c_str(), GetLength());
|
| - }
|
| + CFX_WideStringC AsStringC() const;
|
|
|
| - void clear() { m_pData.Reset(); }
|
| + void clear();
|
|
|
| - FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
|
| - bool IsEmpty() const { return !GetLength(); }
|
| + FX_STRSIZE GetLength() const;
|
| + bool IsEmpty() const;
|
|
|
| const CFX_WideString& operator=(const FX_WCHAR* str);
|
| const CFX_WideString& operator=(const CFX_WideString& stringSrc);
|
| @@ -291,25 +272,15 @@ class CFX_WideString {
|
| bool operator==(const CFX_WideStringC& str) const;
|
| bool operator==(const CFX_WideString& other) const;
|
|
|
| - bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
|
| - bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); }
|
| - bool operator!=(const CFX_WideString& other) const {
|
| - return !(*this == other);
|
| - }
|
| -
|
| - bool operator<(const CFX_WideString& str) const {
|
| - int result =
|
| - wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
|
| - return result < 0 || (result == 0 && GetLength() < str.GetLength());
|
| - }
|
| -
|
| - FX_WCHAR GetAt(FX_STRSIZE nIndex) const {
|
| - return m_pData ? m_pData->m_String[nIndex] : 0;
|
| - }
|
| -
|
| - FX_WCHAR operator[](FX_STRSIZE nIndex) const {
|
| - return m_pData ? m_pData->m_String[nIndex] : 0;
|
| - }
|
| + bool operator!=(const wchar_t* ptr) const;
|
| + bool operator!=(const CFX_WideStringC& str) const;
|
| + bool operator!=(const CFX_WideString& other) const;
|
| +
|
| + bool operator<(const CFX_WideString& str) const;
|
| +
|
| + FX_WCHAR GetAt(FX_STRSIZE nIndex) const;
|
| +
|
| + FX_WCHAR operator[](FX_STRSIZE nIndex) const;
|
|
|
| void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch);
|
|
|
|
|