|
Blender
V2.93
|
#include <BLI_string_ref.hh>
Inherited by blender::StringRef, and blender::StringRefNull.
Public Member Functions | |
| constexpr int64_t | size () const |
| constexpr bool | is_empty () const |
| constexpr const char * | data () const |
| constexpr | operator Span< char > () const |
| operator std::string () const | |
| constexpr | operator std::string_view () const |
| constexpr const char * | begin () const |
| constexpr const char * | end () const |
| constexpr IndexRange | index_range () const |
| void | unsafe_copy (char *dst) const |
| void | copy (char *dst, const int64_t dst_size) const |
| template<size_t N> | |
| void | copy (char(&dst)[N]) const |
| constexpr bool | startswith (StringRef prefix) const |
| constexpr bool | endswith (StringRef suffix) const |
| constexpr StringRef | substr (int64_t start, const int64_t size) const |
| constexpr const char & | front () const |
| constexpr const char & | back () const |
| constexpr int64_t | find (char c, int64_t pos=0) const |
| constexpr int64_t | find (StringRef str, int64_t pos=0) const |
| constexpr int64_t | rfind (char c, int64_t pos=INT64_MAX) const |
| constexpr int64_t | rfind (StringRef str, int64_t pos=INT64_MAX) const |
| constexpr int64_t | find_first_of (StringRef chars, int64_t pos=0) const |
| constexpr int64_t | find_first_of (char c, int64_t pos=0) const |
| constexpr int64_t | find_last_of (StringRef chars, int64_t pos=INT64_MAX) const |
| constexpr int64_t | find_last_of (char c, int64_t pos=INT64_MAX) const |
| constexpr int64_t | find_first_not_of (StringRef chars, int64_t pos=0) const |
| constexpr int64_t | find_first_not_of (char c, int64_t pos=0) const |
| constexpr int64_t | find_last_not_of (StringRef chars, int64_t pos=INT64_MAX) const |
| constexpr int64_t | find_last_not_of (char c, int64_t pos=INT64_MAX) const |
Static Public Attributes | |
| static constexpr int64_t | not_found = -1 |
Protected Member Functions | |
| constexpr | StringRefBase (const char *data, const int64_t size) |
Protected Attributes | |
| const char * | data_ |
| int64_t | size_ |
A common base class for StringRef and StringRefNull. This should never be used in other files. It only exists to avoid some code duplication.
Definition at line 62 of file BLI_string_ref.hh.
|
inlineconstexprprotected |
Definition at line 67 of file BLI_string_ref.hh.
|
inlineconstexpr |
Get the last char in the string. This invokes undefined behavior when the string is empty.
Definition at line 189 of file BLI_string_ref.hh.
References BLI_assert, data_, and size_.
|
inlineconstexpr |
Definition at line 115 of file BLI_string_ref.hh.
References data_.
Referenced by blender::string_search::get_fuzzy_match_errors(), and blender::StringRef::StringRef().
|
inline |
Copy the string into a buffer. The copied string will be null-terminated. This invokes undefined behavior when dst_size is too small. (Should we define the behavior?)
Definition at line 145 of file BLI_string_ref.hh.
References BLI_assert, size_, and unsafe_copy().
Referenced by copy(), blender::tests::TEST(), and blender::bke::CustomDataAttributeProvider::try_create().
|
inline |
Copy the string into a char array. The copied string will be null-terminated. This invokes undefined behavior when dst is too small.
Definition at line 160 of file BLI_string_ref.hh.
|
inlineconstexpr |
Return a pointer to the start of the string.
Definition at line 91 of file BLI_string_ref.hh.
References data_.
Referenced by add_render_result_meta_data(), cryptomatte_determine_identifier(), blender::string_search::damerau_levenshtein_distance(), blender::string_search::extract_normalized_words(), get_column_width(), blender::string_search::match_word_initials(), node_error_message_log(), blender::operator<<(), blender::operator==(), blender::deg::RootPChanMap::print_debug(), and blender::tests::TEST().
|
inlineconstexpr |
Definition at line 120 of file BLI_string_ref.hh.
Referenced by blender::string_search::get_fuzzy_match_errors().
|
inlineconstexpr |
Returns true when the string ends with the given suffix. Otherwise false.
Return true when the string ends with the given suffix.
Definition at line 447 of file BLI_string_ref.hh.
Referenced by blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_manifest(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_names(), blender::gpu::match_renderer(), and blender::tests::TEST().
The behavior of those functions matches the standard library implementation of std::string_view.
Definition at line 483 of file BLI_string_ref.hh.
References BLI_assert, Freestyle::c, blender::index_or_npos_to_int64(), and pos.
Referenced by blender::string_search::get_fuzzy_match_errors(), and blender::gpu::match_renderer().
|
inlineconstexpr |
Definition at line 489 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), pos, and str.
|
inlineconstexpr |
Definition at line 526 of file BLI_string_ref.hh.
References Freestyle::c, find_first_not_of(), and pos.
|
inlineconstexpr |
Definition at line 519 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by find_first_not_of(), and blender::bke::cryptomatte::manifest::skip_whitespaces_().
|
inlineconstexpr |
Definition at line 502 of file BLI_string_ref.hh.
References Freestyle::c, find_first_of(), and pos.
|
inlineconstexpr |
Definition at line 495 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), and find_first_of().
|
inlineconstexpr |
Definition at line 538 of file BLI_string_ref.hh.
References Freestyle::c, find_last_not_of(), and pos.
|
inlineconstexpr |
Definition at line 531 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by find_last_not_of().
|
inlineconstexpr |
Definition at line 514 of file BLI_string_ref.hh.
References Freestyle::c, find_last_of(), and pos.
|
inlineconstexpr |
Definition at line 507 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), and find_last_of().
|
inlineconstexpr |
Get the first char in the string. This invokes undefined behavior when the string is empty.
Definition at line 180 of file BLI_string_ref.hh.
References BLI_assert, data_, and size_.
Referenced by blender::bke::cryptomatte::manifest::from_manifest().
|
inlineconstexpr |
Definition at line 125 of file BLI_string_ref.hh.
References size_.
|
inlineconstexpr |
Definition at line 83 of file BLI_string_ref.hh.
References size_.
Referenced by GeometryComponent::attribute_try_create(), BLI_string_search_query(), blender::nodes::distribute_points_poisson_disk(), blender::nodes::distribute_points_random(), blender::bke::cryptomatte::manifest::from_manifest(), and gpu_shader_get_name().
|
inlineconstexpr |
Definition at line 96 of file BLI_string_ref.hh.
|
inline |
Implicitly convert to std::string. This is convenient in most cases, but you have to be a bit careful not to convert to std::string accidentally.
Definition at line 105 of file BLI_string_ref.hh.
|
inlineconstexpr |
Definition at line 110 of file BLI_string_ref.hh.
|
constexpr |
|
inlineconstexpr |
Return the (byte-)length of the referenced string, without any null-terminator.
Definition at line 78 of file BLI_string_ref.hh.
References size_.
Referenced by blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(), cryptomatte_determine_identifier(), blender::StringRef::drop_known_prefix(), get_column_width(), blender::string_search::get_shortest_word_index_that_startswith(), blender::string_search::match_word_initials(), blender::dot::NodeWithSocketsRef::NodeWithSocketsRef(), blender::operator<<(), blender::operator==(), blender::bke::cryptomatte::manifest::quoted_string_len_(), blender::StringRefNull::StringRefNull(), and blender::tests::TEST().
|
inlineconstexpr |
Returns true when the string begins with the given prefix. Otherwise false.
Return true when the string starts with the given prefix.
Definition at line 431 of file BLI_string_ref.hh.
Referenced by blender::StringRef::drop_known_prefix(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_manifest(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_names(), blender::string_search::get_shortest_word_index_that_startswith(), blender::tests::TEST(), and blender::bke::cryptomatte::tests::validate_cryptomatte_session_from_stamp_data().
|
inlineconstexpr |
Return a new #StringRef containing only a sub-string of the original string. This invokes undefined if the start or max_size is negative.
Definition at line 465 of file BLI_string_ref.hh.
References BLI_assert, data_, min, and size_.
Referenced by blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), blender::string_search::extract_normalized_words(), blender::bke::cryptomatte::manifest::from_manifest(), and blender::tests::TEST().
|
inline |
Copy the string into a buffer. The buffer has to be one byte larger than the size of the string, because the copied string will be null-terminated. Only use this when you are absolutely sure that the buffer is large enough.
Definition at line 135 of file BLI_string_ref.hh.
Referenced by copy().
|
protected |
Definition at line 64 of file BLI_string_ref.hh.
Referenced by back(), begin(), blender::StringRefNull::c_str(), data(), blender::StringRef::drop_prefix(), blender::StringRef::drop_suffix(), end(), endswith(), front(), operator Span< char >(), operator std::string(), operator std::string_view(), blender::StringRefNull::operator[](), blender::StringRef::operator[](), startswith(), blender::StringRefNull::StringRefNull(), substr(), and unsafe_copy().
|
staticconstexpr |
Definition at line 73 of file BLI_string_ref.hh.
Referenced by blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), blender::string_search::get_fuzzy_match_errors(), blender::index_or_npos_to_int64(), blender::gpu::match_renderer(), and blender::bke::cryptomatte::manifest::skip_whitespaces_().
|
protected |
Definition at line 65 of file BLI_string_ref.hh.
Referenced by back(), copy(), blender::StringRef::drop_prefix(), blender::StringRef::drop_suffix(), end(), endswith(), front(), index_range(), is_empty(), operator Span< char >(), operator std::string(), operator std::string_view(), blender::StringRefNull::operator[](), blender::StringRef::operator[](), size(), startswith(), blender::StringRefNull::StringRefNull(), substr(), and unsafe_copy().