summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_bytestring.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-17 14:14:01 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-17 21:29:04 +0000
commit8f0bf890b4b15148a149bf9bbeead4eed6675e8a (patch)
treef6c98170aea417f2dd2190ec71f94af150949817 /core/fxcrt/cfx_bytestring.h
parentc329d59b16b89f3533f9d309ed297938af865ae0 (diff)
downloadpdfium-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_bytestring.h')
-rw-r--r--core/fxcrt/cfx_bytestring.h7
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(); }