summaryrefslogtreecommitdiff
path: root/core/fxcrt/bytestring.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/bytestring.h')
-rw-r--r--core/fxcrt/bytestring.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index c68d2f6991..247238573d 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -84,6 +84,14 @@ class ByteString {
return ByteStringView(raw_str(), GetLength());
}
+ // Explicit conversion to span.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ pdfium::span<const char> AsSpan() const {
+ return m_pData ? pdfium::span<const char>(m_pData->m_String,
+ m_pData->m_nDataLength)
+ : pdfium::span<const char>();
+ }
+
// 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 {