diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-17 14:14:01 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-17 21:29:04 +0000 |
commit | 8f0bf890b4b15148a149bf9bbeead4eed6675e8a (patch) | |
tree | f6c98170aea417f2dd2190ec71f94af150949817 /core/fxcrt/cfx_widestring.h | |
parent | c329d59b16b89f3533f9d309ed297938af865ae0 (diff) | |
download | pdfium-8f0bf890b4b15148a149bf9bbeead4eed6675e8a.tar.xz |
Add iterators for Byte/WideStringCs.
Change-Id: I40ec07c0da54bcf36c83fa26ff457cd4b98a91cf
Reviewed-on: https://pdfium-review.googlesource.com/4261
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_widestring.h')
-rw-r--r-- | core/fxcrt/cfx_widestring.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_widestring.h b/core/fxcrt/cfx_widestring.h index 52cd65a2b7..fd3c92a15e 100644 --- a/core/fxcrt/cfx_widestring.h +++ b/core/fxcrt/cfx_widestring.h @@ -23,6 +23,7 @@ class CFX_ByteString; class CFX_WideString { public: using CharType = wchar_t; + using const_iterator = const CharType*; CFX_WideString(); CFX_WideString(const CFX_WideString& other); @@ -61,6 +62,12 @@ class CFX_WideString { return CFX_WideStringC(c_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; + } + void clear() { m_pData.Reset(); } FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } |