|
Blender V4.3
|
#include <BLI_string_ref.hh>
Inherited by blender::StringRef, and blender::StringRefNull.
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 49 of file BLI_string_ref.hh.
|
constexprprotected |
Definition at line 149 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 304 of file BLI_string_ref.hh.
References BLI_assert, data_, and size_.
Referenced by ui_tooltip_period_needed().
|
constexpr |
Definition at line 194 of file BLI_string_ref.hh.
References data_.
Referenced by blender::io::obj::read_next_line(), 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 226 of file BLI_string_ref.hh.
References BLI_assert, size_, and unsafe_copy().
Referenced by BKE_asset_metadata_catalog_id_set(), copy(), blender::bke::bake::file_name_to_frame(), blender::ed::asset::index::init_indexer_entry_from_value(), blender::draw::compositor::Context::set_info_message(), 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 241 of file BLI_string_ref.hh.
|
constexpr |
Return a pointer to the start of the string.
Definition at line 170 of file BLI_string_ref.hh.
References data_.
Referenced by blender::ed::space_node::animation_basepath_change_new(), blender::bke::asset_blendfile_path_for_save(), blender::asset_system::asset_definition_default_file_path_from_dir(), BKE_fcurve_rnapath_set(), blender::animrig::create_fcurve_for_channel(), blender::nodes::node_composite_file_output_cc::FileOutputOperation::execute_multi_layer(), blender::nodes::node_composite_file_output_cc::FileOutputOperation::execute_single_layer_multi_view_exr(), blender::string_search::extract_normalized_words(), blender::ed::spreadsheet::GeometryDataSource::foreach_default_column_ids(), blender::string_search::get_fuzzy_match_errors(), blender::ed::asset::index::init_indexer_entry_from_value(), blender::bke::greasepencil::convert::legacy_object_modifier_influence(), legacy_socket_move_to_interface(), blender::bke::node_interface::make_panel(), blender::bke::forward_compat::make_socket(), blender::bke::node_interface::make_socket(), blender::string_search::match_word_initials(), blender::io::obj::MTLParser::MTLParser(), blender::ed::space_node::node_socket_get_translation_context(), blender::asset_system::utils::normalize_directory_path(), blender::operator<<(), blender::io::obj::parse_keyword(), blender::io::ply::parse_keyword(), blender::deg::RootPChanMap::print_debug(), blender::ed::sculpt_paint::greasepencil::process_stroke_weights(), pyrna_struct_getattro(), blender::ed::spreadsheet::spreadsheet_filter_panel_draw_header(), blender::bke::greasepencil::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), and blender::io::obj::OBJWriter::write_mtllib_name().
|
constexpr |
Definition at line 199 of file BLI_string_ref.hh.
Referenced by blender::io::obj::read_next_line().
|
constexpr |
Return true when the string ends with the given suffix.
Definition at line 265 of file BLI_string_ref.hh.
Referenced by blender::bke::compositor::add_passes_used_by_cryptomatte_node(), blender::eevee::Cryptomatte::begin_sync(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_manifest(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_names(), blender::bke::bake::find_sorted_meta_files(), blender::ed::space_node::gather_socket_link_operations(), blender::gpu::match_renderer(), blender::nodes::node_geo_remove_attribute_cc::node_geo_exec(), blender::gpu::Shader::print_log(), save_set_filepath(), blender::tests::TEST(), version_mesh_crease_generic(), and wm_file_write_check_with_report_on_failure().
The behavior of those functions matches the standard library implementation of std::string_view.
Definition at line 319 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by blender::gpu::GPULogParser::at_any(), blender::animrig::default_channel_group_for_path(), blender::gpu::VKShader::fragment_interface_declare(), blender::io::obj::geom_update_group(), getname_anim_fcurve_for_slot(), blender::gpu::tests::gpu_shader_lib_test(), icon_source_edit_cb(), blender::gpu::match_renderer(), blender::nodes::node_geo_remove_attribute_cc::node_geo_exec(), blender::gpu::MTLLogParser::parse_line(), blender::gpu::tests::print_test_line(), svg_replace_color_attributes(), and ui_tooltip_period_needed().
Definition at line 325 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), pos, and str.
Definition at line 373 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
|
constexpr |
Definition at line 367 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 349 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Definition at line 343 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::asset_system::AssetLibraryService::normalize_asset_weak_reference_relative_asset_identifier(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_line(), and blender::tests::TEST().
|
constexpr |
Definition at line 385 of file BLI_string_ref.hh.
References BLI_assert, 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().
Definition at line 361 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
|
constexpr |
Definition at line 355 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 295 of file BLI_string_ref.hh.
References BLI_assert, data_, and size_.
Referenced by blender::bke::cryptomatte::manifest::from_manifest().
|
constexpr |
Definition at line 204 of file BLI_string_ref.hh.
References size_.
|
constexpr |
Definition at line 162 of file BLI_string_ref.hh.
References size_.
Referenced by blender::animrig::legacy::action_fcurves_remove(), blender::ui::BasicTreeViewItem::add_label(), blender::ed::object::bake_simulation::bake_simulation_get_path_users(), calculate_selection_fcurve_bounds(), blender::gpu::shader::ShaderCreateInfo::check_error(), blender::gpu::ShaderCompiler::compile(), blender::ed::asset::shelf::create_activate_operator_params(), blender::ed::space_node::create_description_inspection_string(), blender::nodes::draw_bake_data_block_list_item(), blender::nodes::draw_common_bake_settings(), blender::ed::spreadsheet::SpreadsheetLayoutDrawer::draw_content_cell(), ED_armature_bone_rename(), blender::animrig::fcurve_matches_collection_path(), filelist_readjob_all_asset_library(), blender::gpu::shader::ShaderCreateInfo::finalize(), blender::nodes::find_output_attributes_to_store(), blender::gpu::GLShader::fragment_interface_declare(), blender::gpu::VKShader::fragment_interface_declare(), blender::bke::cryptomatte::manifest::from_manifest(), blender::io::ply::generate_vertex_map(), blender::asset_system::AssetLibraryService::get_asset_library(), blender::asset_system::AssetLibraryService::get_asset_library_on_disk(), blender::bke::bake::get_modifier_bake_path(), blender::bke::bake::get_node_bake_path(), get_uv_attribute(), blender::nodes::node_shader_math_cc::gpu_shader_get_name(), blender::gpu::VKShader::init(), blender::gpu::tests::ShaderSpecializationConst::init_shader(), blender::ed::object::bake_simulation::initialize_modifier_bake_directory_if_necessary(), blender::gpu::shader::is_vulkan_compatible_interface(), blender::bke::node_interface::make_panel(), blender::bke::node_interface::make_socket(), blender::ed::space_node::node_socket_get_translation_context(), blender::bke::nodeSocketShortLabel(), blender::asset_system::utils::normalize_directory_path(), blender::ed::outliner::outliner_draw_get_warning_tree_element(), blender::ed::outliner::outliner_draw_get_warning_tree_element_subtree(), blender::ed::outliner::outliner_draw_overrides_rna_buts(), blender::ed::outliner::outliner_draw_warning_column(), paint_brush_set_default_reference(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_file(), blender::gpu::MTLLogParser::parse_line(), blender::gpu::print_interface(), print_interface(), blender::gpu::Shader::print_log(), pyrna_struct_getattro(), rna_path_from_ptr_to_property_index_ex(), rna_prepend_real_ID_path(), blender::ed::spreadsheet::spreadsheet_filter_panel_draw(), blender::ed::spreadsheet::spreadsheet_filter_panel_draw_header(), blender::io::obj::OBJMesh::store_uv_coords_and_indices(), ui_block_view_find_matching_in_old_block_impl(), ui_but_event_property_operator_string(), ui_popup_menu_create_block(), ui_tooltip_period_needed(), uiTemplateStatusInfo(), blender::bke::pbvh::pixels::update_pixels(), version_node_socket_id_delim(), blender::gpu::VKShader::vertex_interface_declare(), blender::ed::sculpt_paint::visit_library_catalogs_catalog_for_search(), and wm_drag_draw_tooltip().
|
constexpr |
Definition at line 175 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 184 of file BLI_string_ref.hh.
|
constexpr |
Definition at line 189 of file BLI_string_ref.hh.
Definition at line 331 of file BLI_string_ref.hh.
References BLI_assert, blender::index_or_npos_to_int64(), and pos.
Referenced by blender::bke::bake::get_blend_file_name(), and blender::asset_system::AssetLibraryService::rfind_blendfile_extension().
Definition at line 337 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 157 of file BLI_string_ref.hh.
References size_.
Referenced by blender::ed::space_node::animation_basepath_change_new(), blender::bke::asset_blendfile_path_for_save(), blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(), BKE_fcurve_rnapath_set(), blender::LinearAllocator< Allocator >::copy_string(), blender::animrig::create_fcurve_for_channel(), blender::StringRef::drop_known_prefix(), blender::animrig::fcurve_matches_collection_path(), fileentry_uiname(), blender::string_search::get_best_word_index_that_startswith(), blender::string_search::get_fuzzy_match_errors(), blender::gpu::GLShaderInterface::GLShaderInterface(), icon_source_edit_cb(), blender::gpu::shader::ShaderCreateInfo::image(), blender::bke::node_interface::make_panel(), blender::bke::node_interface::make_socket(), blender::string_search::match_word_initials(), blender::asset_system::utils::normalize_directory_path(), blender::asset_system::utils::normalize_path(), blender::operator<<(), blender::io::obj::parse_keyword(), blender::io::ply::parse_keyword(), pyrna_struct_getattro(), blender::bke::cryptomatte::manifest::quoted_string_len_(), blender::ed::curves::selection_attribute_writer_by_name(), blender::gpu::shader::ShaderCreateInfo::storage_buf(), svg_replace_color_attributes(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), uiTemplateStatusInfo(), and blender::gpu::shader::ShaderCreateInfo::uniform_buf().
|
constexpr |
Return true when the string starts with the given prefix.
Definition at line 249 of file BLI_string_ref.hh.
Referenced by blender::bke::compositor::add_passes_used_by_cryptomatte_node(), 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::string_search::get_best_word_index_that_startswith(), blender::nodes::group_input_insert_link(), blender::nodes::group_output_insert_link(), blender::asset_system::AssetCatalogPath::is_contained_in(), blender::nodes::node_geo_remove_attribute_cc::node_geo_exec(), blender::tests::TEST(), ui_but_event_property_operator_string(), ui_tooltip_data_from_button_or_extra_icon(), version_bonecollection_anim(), version_node_socket_id_delim(), blender::bke::bake::DiskBlobWriter::write_as_stream(), and blender::bke::bake::MemoryBlobWriter::write_as_stream().
|
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 283 of file BLI_string_ref.hh.
References BLI_assert, data_, 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::greasepencil::convert::AnimDataConvertor::fcurves_convert(), blender::bke::cryptomatte::manifest::from_manifest(), blender::ed::asset::index::init_indexer_entry_from_value(), blender::nodes::node_geo_remove_attribute_cc::node_geo_exec(), blender::asset_system::utils::normalize_path(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_line(), blender::gpu::Shader::print_log(), blender::gpu::tests::print_test_line(), blender::asset_system::AssetCatalogPath::rebase(), blender::asset_system::AssetLibraryService::resolve_asset_weak_reference_to_exploded_path(), blender::asset_system::tests::TEST(), blender::tests::TEST(), trim(), ui_but_drawstr_without_sep_char(), ui_popup_string_hash(), and unescape().
|
constexpr |
Definition at line 391 of file BLI_string_ref.hh.
References trim().
Referenced by BKE_asset_metadata_catalog_id_set(), blender::asset_system::AssetCatalogPath::cleanup_component(), blender::io::obj::OBJParser::parse(), blender::io::obj::MTLParser::parse_and_store(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_file(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_line(), blender::io::obj::parse_texture_map(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), trim(), trim(), and wm_block_dialog_create().
|
constexpr |
Return a new StringRef that does not contain leading and trailing white-space.
Definition at line 399 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 408 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 214 of file BLI_string_ref.hh.
Referenced by copy().
|
protected |
Definition at line 51 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::StringRef::operator[](), blender::StringRefNull::operator[](), startswith(), blender::StringRefNull::StringRefNull(), substr(), and unsafe_copy().
|
staticconstexpr |
Definition at line 58 of file BLI_string_ref.hh.
Referenced by blender::string_search::StringSearchBase::add_impl(), blender::gpu::GPULogParser::at_any(), blender::animrig::default_channel_group_for_path(), blender::bke::cryptomatte::CryptomatteStampDataCallbackData::extract_layer_hash(), blender::bke::bake::get_blend_file_name(), blender::string_search::get_fuzzy_match_errors(), getname_anim_fcurve_for_slot(), blender::index_or_npos_to_int64(), make(), blender::gpu::match_renderer(), blender::asset_system::AssetLibraryService::normalize_asset_weak_reference_relative_asset_identifier(), blender::asset_system::utils::normalize_path(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_line(), blender::asset_system::AssetLibraryService::resolve_asset_weak_reference_to_exploded_path(), blender::asset_system::AssetLibraryService::rfind_blendfile_extension(), blender::bke::cryptomatte::manifest::skip_whitespaces_(), trim(), ui_popup_string_hash(), and ui_tooltip_period_needed().
|
protected |
Definition at line 52 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::StringRef::operator[](), blender::StringRefNull::operator[](), size(), startswith(), blender::StringRefNull::StringRefNull(), substr(), and unsafe_copy().