diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-02-11 16:57:41 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-02-11 16:57:41 +0300 |
commit | 30f65b54a78edc2a974ba93fefa86534fe2b7ff4 (patch) | |
tree | 030cf43b7c2cbd649a2e8758bf319a5b76a29aef /source/blender/blenlib/BLI_string_ref.h | |
parent | 9052c6fafa87654c9a45ce0d5b9ecee073ec1a5b (diff) | |
parent | 3657bb514130ce2d28c407432d6f10202a68c92a (diff) |
Merge branch 'master' into draw-colormanagementdraw-colormanagement
Diffstat (limited to 'source/blender/blenlib/BLI_string_ref.h')
-rw-r--r-- | source/blender/blenlib/BLI_string_ref.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string_ref.h b/source/blender/blenlib/BLI_string_ref.h index 76163a2754c..54c2f0e7209 100644 --- a/source/blender/blenlib/BLI_string_ref.h +++ b/source/blender/blenlib/BLI_string_ref.h @@ -109,6 +109,8 @@ class StringRefBase { * Returns true when the string ends with the given suffix. Otherwise false. */ bool endswith(StringRef suffix) const; + + StringRef substr(uint start, uint size) const; }; /** @@ -242,6 +244,12 @@ inline bool StringRefBase::endswith(StringRef suffix) const return true; } +inline StringRef StringRefBase::substr(uint start, uint size) const +{ + BLI_assert(start + size <= m_size); + return StringRef(m_data + start, size); +} + } // namespace BLI #endif /* __BLI_STRING_REF_H__ */ |