Blender V4.5
blender::StringRef Class Reference

#include <BLI_string_ref.hh>

Inherits blender::StringRefBase.

Public Member Functions

#StringRef Inline Methods
constexpr StringRef ()
constexpr StringRef (StringRefNull other)
constexpr StringRef (const char *str)
constexpr StringRef (const char *str, int64_t length)
constexpr StringRef (const char *begin, const char *one_after_end)
constexpr StringRef (std::string_view view)
constexpr StringRef (Span< char > span)
 StringRef (const std::string &str)
constexpr StringRef drop_prefix (int64_t n) const
constexpr StringRef drop_known_prefix (StringRef prefix) const
constexpr StringRef drop_suffix (int64_t n) const
constexpr StringRef drop_known_suffix (StringRef suffix) const
constexpr char operator[] (int64_t index) const
Public Member Functions inherited from blender::StringRefBase
void copy_utf8_truncated (char *dst, int64_t dst_size) const
void copy_bytes_truncated (char *dst, int64_t dst_size) const
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
template<size_t N>
void copy_utf8_truncated (char(&dst)[N]) const
template<size_t N>
void copy_bytes_truncated (char(&dst)[N]) const
void copy_unsafe (char *dst) 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

Additional Inherited Members

Static Public Attributes inherited from blender::StringRefBase
static constexpr int64_t not_found = -1
constexpr StringRefBase (const char *data, int64_t size)
Protected Attributes inherited from blender::StringRefBase
const char * data_
int64_t size_

Detailed Description

References a const char array. It might not be null terminated.

StringRef can be compared with StringRef and StringRefNull.

Definition at line 150 of file BLI_string_ref.hh.

Constructor & Destructor Documentation

◆ StringRef() [1/8]

blender::StringRef::StringRef ( )
constexpr

Definition at line 494 of file BLI_string_ref.hh.

References nullptr, and blender::StringRefBase::StringRefBase().

Referenced by blender::bke::compositor::add_passes_used_by_cryptomatte_node(), blender::bke::compositor::add_passes_used_by_render_layer_node(), blender::ui::attribute_data_type_string(), blender::ui::attribute_domain_string(), blender::ed::object::bake_simulation::bake_simulation_get_path_users(), blender::ed::asset::catalog_rename(), blender::ed::space_node::create_multi_input_log_inspection_string(), blender::bke::bake::deserialize_bake_item(), blender::nodes::draw_bake_data_block_list_item(), blender::nodes::draw_common_bake_settings(), blender::ed::spreadsheet::SpreadsheetLayoutDrawer::draw_content_cell(), drop_known_prefix(), drop_known_suffix(), drop_prefix(), drop_suffix(), blender::io::drop_whitespace(), blender::nodes::node_composite_group_input_cc::GroupInputOperation::execute(), blender::nodes::LazyFunctionForClosureZone::execute_impl(), blender::dot_export::Attributes::export__as_bracket_list(), blender::csv_parse::CsvRecord::field_str(), blender::nodes::node_fn_format_string_cc::format_without_format_specifier(), blender::nodes::node_fn_format_string_cc::FormatStringMultiFunction::FormatStringMultiFunction(), blender::animrig::generic_slot_for_autoassign(), blender::io::obj::geom_new_object(), blender::io::obj::geom_set_curve_type(), blender::io::obj::geom_update_smooth_group(), blender::bke::bake::get_blend_file_name(), blender::nodes::get_dot_cluster_for_context(), blender::nodes::node_composite_cryptomatte_cc::CryptoMatteOperation::get_layers_from_image(), blender::bke::bake::get_modifier_bake_path(), blender::bke::bake::get_node_bake_path(), blender::draw::compositor_engine::Context::get_pass(), blender::bke::NamedLayerSelectionFieldInput::get_varray_for_context(), blender::nodes::group_input_insert_link(), blender::nodes::group_output_insert_link(), blender::animrig::Slot::identifier_ensure_prefix(), blender::animrig::Slot::identifier_without_prefix(), blender::ed::asset::index::init_user_data(), blender::ed::object::bake_simulation::initialize_modifier_bake_directory_if_necessary(), blender::nodes::socket_usage_inference::input_may_affect_visibility(), blender::nodes::LazyFunctionForGeometryNode::input_name(), blender::compositor::is_socket_available(), blender::asset_system::AssetCatalogPath::iterate_components(), blender::bke::forward_compat::make_socket(), blender::bke::mesh_custom_normals_to_legacy(), blender::bke::mesh_sculpt_mask_to_legacy(), blender::nodes::node_geo_remove_attribute_cc::node_geo_exec(), blender::nodes::node_group_declare_panel_recursive(), blender::ed::space_node::node_socket_get_tooltip(), blender::bke::NodeStructIDNameGetter< T >::operator()(), blender::DefaultHash< SpreadsheetColumnID >::operator()(), blender::nodes::IDPropNameGetter::operator()(), blender::io::obj::OBJParser::parse(), blender::io::obj::MTLParser::parse_and_store(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_file(), blender::io::parse_float(), blender::io::parse_int(), blender::gpu::MTLLogParser::parse_line(), blender::io::obj::parse_texture_map(), blender::io::obj::parse_texture_option(), blender::gpu::MSLGeneratorInterface::prepare_from_createinfo(), blender::nodes::node_fn_format_string_cc::preprocess_python_compatible_syntax(), blender::timeit::print_duration(), blender::gpu::print_resource(), blender::gpu::print_resource(), print_resource(), print_resource_alias(), uiLayout::prop(), blender::io::ply::read_header(), blender::io::read_next_line(), blender::io::fbx::read_ufbx_property(), blender::asset_system::AssetCatalogPath::rebase(), blender::asset_system::AssetLibraryService::resolve_asset_weak_reference_to_exploded_path(), blender::render::Context::result_type_from_pass(), blender::ed::asset::screenshot_preview_poll(), blender::nodes::socket_items::set_item_name_and_make_unique(), blender::animrig::Action::slot_display_name_define(), blender::animrig::Action::slot_identifier_define(), blender::nodes::geo_eval_log::StringLog::StringLog(), blender::StringRefBase::substr(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::StringRefBase::trim(), blender::StringRefBase::trim(), blender::nodes::materialx::NodeGraph::unique_node_name(), blender::bke::bake::unpack_geometry_nodes_bake(), blender::nodes::decl::IDSocketDeclaration::update_or_build(), blender::locale::MOFile::value(), blender::timeit::ScopedTimer::~ScopedTimer(), and blender::timeit::ScopedTimerAveraged::~ScopedTimerAveraged().

◆ StringRef() [2/8]

blender::StringRef::StringRef ( StringRefNull other)
constexpr

StringRefNull can be converted into StringRef, but not the other way around.

Definition at line 499 of file BLI_string_ref.hh.

References blender::StringRefBase::data(), blender::StringRefBase::size(), and blender::StringRefBase::StringRefBase().

◆ StringRef() [3/8]

blender::StringRef::StringRef ( const char * str)
constexpr

Create a StringRef from a null-terminated c-string.

Definition at line 504 of file BLI_string_ref.hh.

References length(), str, and blender::StringRefBase::StringRefBase().

◆ StringRef() [4/8]

blender::StringRef::StringRef ( const char * str,
int64_t length )
constexpr

Definition at line 509 of file BLI_string_ref.hh.

References length(), str, and blender::StringRefBase::StringRefBase().

◆ StringRef() [5/8]

blender::StringRef::StringRef ( const char * begin,
const char * one_after_end )
constexpr

Create a StringRef from a start and end pointer. This invokes undefined behavior when the second point points to a smaller address than the first one.

Definition at line 570 of file BLI_string_ref.hh.

References blender::StringRefBase::begin(), BLI_assert, and blender::StringRefBase::StringRefBase().

◆ StringRef() [6/8]

blender::StringRef::StringRef ( std::string_view view)
constexpr

◆ StringRef() [7/8]

blender::StringRef::StringRef ( Span< char > span)
constexpr

◆ StringRef() [8/8]

blender::StringRef::StringRef ( const std::string & str)
inline

Reference a std::string. Remember that when the std::string is destructed, the StringRef will point to uninitialized memory.

Definition at line 580 of file BLI_string_ref.hh.

References blender::StringRefBase::data(), blender::StringRefBase::size(), str, and blender::StringRefBase::StringRefBase().

Member Function Documentation

◆ drop_known_prefix()

StringRef blender::StringRef::drop_known_prefix ( StringRef prefix) const
constexpr

Return a new StringRef with the given prefix being skipped. This invokes undefined behavior if the string does not begin with the given prefix.

Definition at line 529 of file BLI_string_ref.hh.

References BLI_assert, drop_prefix(), blender::StringRefBase::size(), blender::StringRefBase::startswith(), and StringRef().

Referenced by blender::tests::TEST(), ui_but_event_property_operator_string(), version_bonecollection_anim(), and version_node_socket_id_delim().

◆ drop_known_suffix()

StringRef blender::StringRef::drop_known_suffix ( StringRef suffix) const
constexpr

Return a new StringRef with the given suffix being skipped. This invokes undefined behavior if the string does not begin with the given suffix.

Definition at line 550 of file BLI_string_ref.hh.

References BLI_assert, drop_suffix(), blender::StringRefBase::endswith(), blender::StringRefBase::size(), and StringRef().

Referenced by exr_channels_in_multi_part_file().

◆ drop_prefix()

◆ drop_suffix()

StringRef blender::StringRef::drop_suffix ( int64_t n) const
constexpr

Return a new StringRef that does not contain the last n chars. This invokes undefined behavior when n is negative.

Definition at line 539 of file BLI_string_ref.hh.

References BLI_assert, blender::StringRefBase::data_, blender::StringRefBase::size_, and StringRef().

Referenced by drop_known_suffix(), blender::nodes::node_fn_format_string_cc::preprocess_python_compatible_syntax(), blender::tests::TEST(), and blender::tests::TEST().

◆ operator[]()

char blender::StringRef::operator[] ( int64_t index) const
constexpr

Get the char at the given index.

Definition at line 559 of file BLI_string_ref.hh.

References BLI_assert, blender::StringRefBase::data_, and blender::StringRefBase::size_.


The documentation for this class was generated from the following file: