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_string_c_template.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_string_c_template.h')
-rw-r--r-- | core/fxcrt/cfx_string_c_template.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_string_c_template.h b/core/fxcrt/cfx_string_c_template.h index 4aba2cd4b9..75c2be0efc 100644 --- a/core/fxcrt/cfx_string_c_template.h +++ b/core/fxcrt/cfx_string_c_template.h @@ -22,6 +22,7 @@ class CFX_StringCTemplate { public: using CharType = T; using UnsignedType = typename std::make_unsigned<CharType>::type; + using const_iterator = const CharType*; CFX_StringCTemplate() : m_Ptr(nullptr), m_Length(0) {} @@ -73,6 +74,14 @@ class CFX_StringCTemplate { return *this; } + const_iterator begin() const { + return reinterpret_cast<const CharType*>(m_Ptr); + } + const_iterator end() const { + return m_Ptr ? reinterpret_cast<const CharType*>(m_Ptr) + m_Length + : nullptr; + } + bool operator==(const CharType* ptr) const { return FXSYS_len(ptr) == m_Length && FXSYS_cmp(ptr, reinterpret_cast<const CharType*>(m_Ptr), m_Length) == |