Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonis Ryakiotakis <kalast@gmail.com>2022-02-07 21:37:15 +0300
committerAntonis Ryakiotakis <kalast@gmail.com>2022-02-07 21:37:15 +0300
commitd8c05502272990173381bfd2590884bbc95aa5f5 (patch)
tree8bd65efacbe6484b838d4550597d0f4a54ddddd9 /source/blender/blenlib/BLI_string_ref.hh
parentb64d551f3b2fa409b4eeefb641fc581eb6cd0bd6 (diff)
parentfe1816f67fbc6aaf383ec77847d668367335d093 (diff)
Merge branch 'master' into KTX_supportKTX_support
Diffstat (limited to 'source/blender/blenlib/BLI_string_ref.hh')
-rw-r--r--source/blender/blenlib/BLI_string_ref.hh27
1 files changed, 23 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh
index 3769e711a50..32a03213dc1 100644
--- a/source/blender/blenlib/BLI_string_ref.hh
+++ b/source/blender/blenlib/BLI_string_ref.hh
@@ -337,6 +337,18 @@ constexpr int64_t StringRefBase::find(StringRef str, int64_t pos) const
return index_or_npos_to_int64(std::string_view(*this).find(str, static_cast<size_t>(pos)));
}
+constexpr int64_t StringRefBase::rfind(char c, int64_t pos) const
+{
+ BLI_assert(pos >= 0);
+ return index_or_npos_to_int64(std::string_view(*this).rfind(c, static_cast<size_t>(pos)));
+}
+
+constexpr int64_t StringRefBase::rfind(StringRef str, int64_t pos) const
+{
+ BLI_assert(pos >= 0);
+ return index_or_npos_to_int64(std::string_view(*this).rfind(str, static_cast<size_t>(pos)));
+}
+
constexpr int64_t StringRefBase::find_first_of(StringRef chars, int64_t pos) const
{
BLI_assert(pos >= 0);
@@ -346,7 +358,9 @@ constexpr int64_t StringRefBase::find_first_of(StringRef chars, int64_t pos) con
constexpr int64_t StringRefBase::find_first_of(char c, int64_t pos) const
{
- return this->find_first_of(StringRef(&c, 1), pos);
+ BLI_assert(pos >= 0);
+ return index_or_npos_to_int64(
+ std::string_view(*this).find_first_of(c, static_cast<size_t>(pos)));
}
constexpr int64_t StringRefBase::find_last_of(StringRef chars, int64_t pos) const
@@ -358,7 +372,8 @@ constexpr int64_t StringRefBase::find_last_of(StringRef chars, int64_t pos) cons
constexpr int64_t StringRefBase::find_last_of(char c, int64_t pos) const
{
- return this->find_last_of(StringRef(&c, 1), pos);
+ BLI_assert(pos >= 0);
+ return index_or_npos_to_int64(std::string_view(*this).find_last_of(c, static_cast<size_t>(pos)));
}
constexpr int64_t StringRefBase::find_first_not_of(StringRef chars, int64_t pos) const
@@ -370,7 +385,9 @@ constexpr int64_t StringRefBase::find_first_not_of(StringRef chars, int64_t pos)
constexpr int64_t StringRefBase::find_first_not_of(char c, int64_t pos) const
{
- return this->find_first_not_of(StringRef(&c, 1), pos);
+ BLI_assert(pos >= 0);
+ return index_or_npos_to_int64(
+ std::string_view(*this).find_first_not_of(c, static_cast<size_t>(pos)));
}
constexpr int64_t StringRefBase::find_last_not_of(StringRef chars, int64_t pos) const
@@ -382,7 +399,9 @@ constexpr int64_t StringRefBase::find_last_not_of(StringRef chars, int64_t pos)
constexpr int64_t StringRefBase::find_last_not_of(char c, int64_t pos) const
{
- return this->find_last_not_of(StringRef(&c, 1), pos);
+ BLI_assert(pos >= 0);
+ return index_or_npos_to_int64(
+ std::string_view(*this).find_last_not_of(c, static_cast<size_t>(pos)));
}
constexpr StringRef StringRefBase::trim() const