Blender
V3.3
|
#include <BLI_string_ref.hh>
Static Public Attributes | |
static constexpr int64_t | not_found = -1 |
Protected Attributes | |
const char * | data_ |
int64_t | size_ |
#StringRefBase Inline Methods | |
constexpr | StringRefBase (const char *data, int64_t size) |
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, 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, 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 |
constexpr StringRef | trim () const |
constexpr StringRef | trim (StringRef characters_to_remove) const |
constexpr StringRef | trim (char character_to_remove) const |
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 48 of file BLI_string_ref.hh.
|
constexprprotected |
Definition at line 144 of file BLI_string_ref.hh.
|
constexpr |
Get the last char in the string. This invokes undefined behavior when the string is empty.
Definition at line 299 of file BLI_string_ref.hh.
References BLI_assert, data_, and size_.
|
constexpr |
Definition at line 189 of file BLI_string_ref.hh.
References data_.
Referenced by blender::io::obj::drop_whitespace(), blender::string_search::get_fuzzy_match_errors(), blender::io::obj::OBJParser::parse(), blender::io::obj::MTLParser::parse_and_store(), blender::io::obj::parse_float(), blender::io::obj::parse_int(), blender::gpu::GPUSource::print_error(), and blender::StringRef::StringRef().
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 221 of file BLI_string_ref.hh.
References BLI_assert, size_, and unsafe_copy().
Referenced by blender::bke::add_generic_custom_data_layer(), BKE_asset_metadata_catalog_id_set(), copy(), blender::gpu::GPUSource::material_functions_parse(), and blender::tests::TEST().
|
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 236 of file BLI_string_ref.hh.
|
constexpr |
Return a pointer to the start of the string.
Definition at line 165 of file BLI_string_ref.hh.
References data_.
Referenced by add_render_result_meta_data(), blender::bke::asset_definition_default_file_path_from_dir(), cryptomatte_determine_identifier(), ED_assetlist_library_path(), blender::string_search::extract_normalized_words(), blender::ed::spreadsheet::GeometryDataSource::foreach_default_column_ids(), get_column_width(), blender::string_search::match_word_initials(), blender::io::obj::MTLParser::MTLParser(), blender::ed::space_node::node_socket_get_tooltip(), blender::operator<<(), blender::io::obj::parse_keyword(), blender::deg::RootPChanMap::print_debug(), blender::io::obj::set_property_of_socket(), blender::tests::TEST(), and blender::io::obj::OBJWriter::write_mtllib_name().
|
constexpr |
Definition at line 194 of file BLI_string_ref.hh.
Referenced by blender::io::obj::drop_whitespace(), blender::string_search::get_fuzzy_match_errors(), blender::io::obj::OBJParser::parse(), blender::io::obj::MTLParser::parse_and_store(), blender::io::obj::parse_float(), blender::io::obj::parse_int(), and blender::gpu::GPUSource::print_error().
Return true when the string ends with the given suffix.
Definition at line 260 of file BLI_string_ref.hh.
References data_, offset, and size_.
Referenced by blender::gpu::GPUSource::enum_preprocess(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_manifest(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_names(), blender::gpu::GPUSource::GPUSource(), blender::gpu::GPUSource::is_from_material_library(), blender::gpu::match_renderer(), blender::gpu::Shader::print_log(), and blender::tests::TEST().
The behavior of those functions matches the standard library implementation of std::string_view.
Definition at line 314 of file BLI_string_ref.hh.
References BLI_assert, Freestyle::c, blender::index_or_npos_to_int64(), and pos.
Referenced by blender::gpu::GPULogParser::at_any(), blender::gpu::GPUSource::check_no_quotes(), blender::io::obj::geom_update_group(), blender::string_search::get_fuzzy_match_errors(), blender::gpu::GPUSource::GPUSource(), blender::gpu::GPUSource::init_dependencies(), blender::gpu::match_renderer(), blender::gpu::GPUSource::material_functions_parse(), and blender::gpu::shader::ShaderCreateInfo::push_constant().
Definition at line 320 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), pos, and str.
|
constexpr |
Definition at line 372 of file BLI_string_ref.hh.
References BLI_assert, Freestyle::c, blender::index_or_npos_to_int64(), and pos.
|
constexpr |
Definition at line 365 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by blender::bke::cryptomatte::manifest::skip_whitespaces_(), and trim().
Definition at line 345 of file BLI_string_ref.hh.
References BLI_assert, Freestyle::c, blender::index_or_npos_to_int64(), and pos.
|
constexpr |
Definition at line 338 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(), blender::bke::AssetCatalogDefinitionFile::parse_catalog_line(), and blender::gpu::GPUSource::quote_preprocess().
|
constexpr |
Definition at line 386 of file BLI_string_ref.hh.
References BLI_assert, Freestyle::c, blender::index_or_npos_to_int64(), and pos.
|
constexpr |
Definition at line 379 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by trim().
|
constexpr |
Definition at line 359 of file BLI_string_ref.hh.
References BLI_assert, Freestyle::c, blender::index_or_npos_to_int64(), and pos.
|
constexpr |
Definition at line 352 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().
|
constexpr |
Get the first char in the string. This invokes undefined behavior when the string is empty.
Definition at line 290 of file BLI_string_ref.hh.
References BLI_assert, data_, and size_.
Referenced by blender::bke::cryptomatte::manifest::from_manifest().
|
constexpr |
Definition at line 199 of file BLI_string_ref.hh.
References size_.
|
constexpr |
Definition at line 157 of file BLI_string_ref.hh.
References size_.
Referenced by blender::ui::BasicTreeViewItem::add_label(), BLI_string_search_query(), blender::gpu::shader::ShaderCreateInfo::check_error(), blender::io::obj::create_geometry(), blender::gpu::shader::ShaderCreateInfo::finalize(), find_output_attributes_to_store(), blender::gpu::GLShader::fragment_interface_declare(), blender::bke::cryptomatte::manifest::from_manifest(), blender::bke::AssetLibraryService::get_asset_library_on_disk(), gpu_pass_shader_validate(), GPU_shader_create_from_info(), blender::gpu::shader::gpu_shader_dependency_get_builtins(), blender::nodes::node_shader_math_cc::gpu_shader_get_name(), blender::compositor::DebugInfo::graphviz(), blender::bke::AttributeIDRef::is_named(), blender::nodes::NodeRef::label_or_name(), blender::ed::space_node::node_socket_get_tooltip(), blender::ed::space_node::node_socket_has_tooltip(), outliner_draw_get_warning_tree_element(), outliner_draw_get_warning_tree_element_subtree(), outliner_draw_warning_column(), blender::bke::AssetCatalogDefinitionFile::parse_catalog_file(), print_interface(), blender::gpu::Shader::print_log(), blender::io::obj::TEST(), ui_block_view_find_matching_in_old_block_impl(), blender::fn::MFProcedureDotExport::variable_to_string(), and version_node_socket_id_delim().
|
constexpr |
Definition at line 170 of file BLI_string_ref.hh.
References data_.
|
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 179 of file BLI_string_ref.hh.
References data_.
|
constexpr |
Definition at line 184 of file BLI_string_ref.hh.
References data_.
Definition at line 326 of file BLI_string_ref.hh.
References BLI_assert, Freestyle::c, blender::index_or_npos_to_int64(), and pos.
|
constexpr |
Definition at line 332 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), pos, and str.
|
constexpr |
Return the (byte-)length of the referenced string, without any null-terminator.
Definition at line 152 of file BLI_string_ref.hh.
References size_.
Referenced by blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(), blender::gpu::ShaderInterface::copy_input_name(), blender::bke::idprop::create(), cryptomatte_determine_identifier(), blender::StringRef::drop_known_prefix(), get_column_width(), blender::string_search::get_shortest_word_index_that_startswith(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::shader::ShaderCreateInfo::image(), blender::string_search::match_word_initials(), blender::dot::NodeWithSocketsRef::NodeWithSocketsRef(), blender::operator<<(), blender::io::obj::parse_keyword(), blender::gpu::shader::ShaderCreateInfo::push_constant(), blender::bke::cryptomatte::manifest::quoted_string_len_(), blender::gpu::shader::ShaderCreateInfo::sampler(), blender::gpu::shader::ShaderCreateInfo::storage_buf(), blender::StringRefNull::StringRefNull(), blender::tests::TEST(), blender::gpu::shader::ShaderCreateInfo::uniform_buf(), version_node_socket_id_delim(), and blender::gpu::shader::ShaderCreateInfo::vertex_in().
Return true when the string starts with the given prefix.
Definition at line 244 of file BLI_string_ref.hh.
Referenced by blender::bke::allow_procedural_attribute_access(), blender::deg::DepsgraphRelationBuilder::build_driver_variables(), 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::io::obj::geom_update_smooth_group(), blender::string_search::get_shortest_word_index_that_startswith(), blender::bke::AssetCatalogPath::is_contained_in(), blender::gpu::GPUSource::is_from_material_library(), blender::io::obj::parse_texture_map(), blender::io::obj::parse_texture_option(), blender::bke::AssetCatalogDefinitionFile::parse_version_line(), blender::tests::TEST(), blender::bke::cryptomatte::tests::validate_cryptomatte_session_from_stamp_data(), and version_node_socket_id_delim().
|
constexpr |
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 278 of file BLI_string_ref.hh.
References BLI_assert, data_, min, and size_.
Referenced by BKE_asset_metadata_catalog_id_set(), blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(), createGPUShader(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), blender::string_search::extract_normalized_words(), blender::bke::cryptomatte::manifest::from_manifest(), blender::ed::asset::index::AssetEntryReader::get_name(), blender::gpu::GPUSource::init_dependencies(), blender::gpu::GPUSource::material_functions_parse(), blender::bke::AssetCatalogDefinitionFile::parse_catalog_line(), blender::bke::AssetCatalogDefinitionFile::parse_version_line(), blender::gpu::Shader::print_log(), blender::bke::AssetCatalogPath::rebase(), blender::bke::tests::TEST(), blender::tests::TEST(), and trim().
|
constexpr |
Definition at line 393 of file BLI_string_ref.hh.
Referenced by BKE_asset_metadata_catalog_id_set(), blender::io::obj::OBJParser::parse(), blender::io::obj::MTLParser::parse_and_store(), blender::bke::AssetCatalogDefinitionFile::parse_catalog_file(), blender::bke::AssetCatalogDefinitionFile::parse_catalog_line(), blender::io::obj::parse_texture_map(), blender::tests::TEST(), and trim().
|
constexpr |
Return a new StringRef that does not contain leading and trailing white-space.
Definition at line 401 of file BLI_string_ref.hh.
References trim().
Return a new StringRef that removes all the leading and trailing characters that occur in characters_to_remove
.
Definition at line 410 of file BLI_string_ref.hh.
References BLI_assert_msg, find_first_not_of(), find_last_not_of(), not_found, and substr().
|
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 209 of file BLI_string_ref.hh.
Referenced by copy().
|
protected |
Definition at line 50 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(), blender::StringRefNull::operator[](), blender::StringRef::operator[](), startswith(), blender::StringRefNull::StringRefNull(), substr(), and unsafe_copy().
|
staticconstexpr |
Definition at line 57 of file BLI_string_ref.hh.
Referenced by blender::gpu::GPULogParser::at_any(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), blender::string_search::get_fuzzy_match_errors(), blender::index_or_npos_to_int64(), blender::gpu::match_renderer(), blender::bke::AssetCatalogDefinitionFile::parse_catalog_line(), blender::bke::cryptomatte::manifest::skip_whitespaces_(), and trim().
|
protected |
Definition at line 51 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(), blender::StringRefNull::operator[](), blender::StringRef::operator[](), size(), startswith(), blender::StringRefNull::StringRefNull(), substr(), and unsafe_copy().