diff options
Diffstat (limited to 'core/fxcrt/cfx_bytestring.h')
-rw-r--r-- | core/fxcrt/cfx_bytestring.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_bytestring.h b/core/fxcrt/cfx_bytestring.h index b9ebd8a83c..0ffe92936a 100644 --- a/core/fxcrt/cfx_bytestring.h +++ b/core/fxcrt/cfx_bytestring.h @@ -23,6 +23,7 @@ class CFX_WideString; class CFX_ByteString { public: using CharType = char; + using const_iterator = const CharType*; CFX_ByteString(); CFX_ByteString(const CFX_ByteString& other); @@ -65,6 +66,12 @@ class CFX_ByteString { return CFX_ByteStringC(raw_str(), GetLength()); } + // Note: Any subsequent modification of |this| will invalidate iterators. + const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; } + const_iterator end() const { + return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr; + } + FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } bool IsEmpty() const { return !GetLength(); } |