Blender
V3.3
|
Go to the source code of this file.
Macros | |
#define | BLI_string_join(result, result_len, ...) |
#define | BLI_string_joinN(...) BLI_string_join_arrayN(((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__)) |
#define | BLI_string_join_by_sep_charN(sep, ...) |
#define | BLI_string_join_by_sep_char_with_tableN(sep, table, ...) |
Typedefs | |
typedef bool(* | UniquenameCheckCallback) (void *arg, const char *name) |
Functions | |
size_t | BLI_split_name_num (char *left, int *nr, const char *name, char delim) |
bool | BLI_string_is_decimal (const char *string) ATTR_NONNULL() |
void | BLI_string_split_suffix (const char *string, char *r_body, char *r_suf, size_t str_len) |
void | BLI_string_split_prefix (const char *string, char *r_pre, char *r_body, size_t str_len) |
char * | BLI_string_join_array (char *result, size_t result_len, const char *strings[], uint strings_len) ATTR_NONNULL() |
char * | BLI_string_join_array_by_sep_char (char *result, size_t result_len, char sep, const char *strings[], uint strings_len) ATTR_NONNULL() |
char * | BLI_string_join_arrayN (const char *strings[], uint strings_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() |
char * | BLI_string_join_array_by_sep_charN (char sep, const char *strings[], uint strings_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() |
char * | BLI_string_join_array_by_sep_char_with_tableN (char sep, char *table[], const char *strings[], uint strings_len) ATTR_NONNULL() |
size_t | BLI_string_flip_side_name (char *r_name, const char *from_name, bool strip_number, size_t name_len) |
bool | BLI_uniquename_cb (UniquenameCheckCallback unique_check, void *arg, const char *defname, char delim, char *name, size_t name_len) |
bool | BLI_uniquename (struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_len) |
Take multiple arguments, pass as (array, length).
Definition at line 88 of file BLI_string_utils.h.
#define BLI_string_join_by_sep_char_with_tableN | ( | sep, | |
table, | |||
... | |||
) |
Definition at line 96 of file BLI_string_utils.h.
#define BLI_string_join_by_sep_charN | ( | sep, | |
... | |||
) |
Definition at line 93 of file BLI_string_utils.h.
#define BLI_string_joinN | ( | ... | ) | BLI_string_join_arrayN(((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__)) |
Definition at line 91 of file BLI_string_utils.h.
Definition at line 21 of file BLI_string_utils.h.
size_t BLI_split_name_num | ( | char * | left, |
int * | nr, | ||
const char * | name, | ||
char | delim | ||
) |
Looks for a numeric suffix preceded by delim
character on the end of name, puts preceding part into *left and value of suffix into *nr. Returns the length of *left.
Foo.001 -> "Foo", 1 Returning the length of "Foo"
left | Where to return copy of part preceding delim . |
nr | Where to return value of numeric suffix. \param name: String to split . |
delim | Delimiter character`. |
Definition at line 25 of file string_utils.c.
References Freestyle::a, and left.
Referenced by BKE_main_namemap_get_name(), BKE_main_namemap_remove_name(), BKE_mball_basis_find(), BKE_mball_is_same_group(), BKE_mball_properties_copy(), BLI_uniquename_cb(), init_meta(), and main_namemap_populate().
size_t BLI_string_flip_side_name | ( | char * | r_name, |
const char * | from_name, | ||
bool | strip_number, | ||
size_t | name_len | ||
) |
Finds the best possible flipped (left/right) name. For renaming; check for unique names afterwards.
r_name | flipped name, assumed to be a pointer to a string of at least name_len size. |
from_name | original name, assumed to be a pointer to a string of at least name_len size. |
strip_number | If set, remove number extensions. |
Definition at line 112 of file string_utils.c.
References BLI_snprintf_rlen(), BLI_strcasestr(), BLI_strncpy(), BLI_strncpy_rlen(), BLI_strnlen(), is_char_sep(), len, and NULL.
Referenced by action_flip_pchan(), action_flip_pchan_rna_paths(), add_verts_to_dgroups(), armature_duplicate_selected_exec(), armature_symmetrize_exec(), BKE_object_defgroup_flip_index(), BKE_object_defgroup_flip_map(), BKE_object_defgroup_flip_map_single(), BKE_object_defgroup_mirror_selection(), BKE_pose_channel_get_mirrored(), bpy_flip_name(), ED_armature_bones_flip_names(), ED_armature_ebone_get_mirrored(), ED_wpaint_mirror_vgroup_ensure(), flip_names(), object_select_mirror_exec(), pose_bone_do_paste(), updateDuplicateCustomBoneShapes(), and updateDuplicateSubtarget().
bool BLI_string_is_decimal | ( | const char * | string | ) |
Definition at line 55 of file string_utils.c.
Referenced by ED_text_is_syntax_highlight_supported(), and TEST().
char* BLI_string_join_array | ( | char * | result, |
size_t | result_len, | ||
const char * | strings[], | ||
uint | strings_len | ||
) |
Join strings, return newly allocated string.
Definition at line 347 of file string_utils.c.
References Freestyle::c, and result.
Referenced by draw_seq_in_view(), draw_seq_text_get_overlay_string(), and draw_viewport_name().
char* BLI_string_join_array_by_sep_char | ( | char * | result, |
size_t | result_len, | ||
char | sep, | ||
const char * | strings[], | ||
uint | strings_len | ||
) |
A version of BLI_string_join that takes a separator which can be any character including '\0'.
Definition at line 364 of file string_utils.c.
References Freestyle::c, and result.
Referenced by RE_render_result_full_channel_name().
char* BLI_string_join_array_by_sep_char_with_tableN | ( | char | sep, |
char * | table[], | ||
const char * | strings[], | ||
uint | strings_len | ||
) |
A version of BLI_string_join_array_by_sep_charN that takes a table array. The new location of each string is written into this array.
Definition at line 424 of file string_utils.c.
References BLI_strcpy_rlen(), Freestyle::c, MEM_mallocN, and result.
char* BLI_string_join_array_by_sep_charN | ( | char | sep, |
const char * | strings[], | ||
uint | strings_len | ||
) |
A version of BLI_string_joinN that takes a separator which can be any character including '\0'.
Definition at line 400 of file string_utils.c.
References BLI_strcpy_rlen(), Freestyle::c, MEM_mallocN, and result.
char* BLI_string_join_arrayN | ( | const char * | strings[], |
uint | strings_len | ||
) |
Join an array of strings into a newly allocated, null terminated string.
Definition at line 384 of file string_utils.c.
References BLI_strcpy_rlen(), Freestyle::c, MEM_mallocN, and result.
Referenced by blender::gpu::Shader::print_log(), and string_join_array_maybe_alloc().
void BLI_string_split_prefix | ( | const char * | string, |
char * | r_pre, | ||
char * | r_body, | ||
size_t | str_len | ||
) |
"a.b.c"
-> ("a."
, "b.c"
).
Definition at line 93 of file string_utils.c.
References BLI_strncpy(), BLI_strnlen(), is_char_sep(), and len.
Referenced by select_similar_prefix().
void BLI_string_split_suffix | ( | const char * | string, |
char * | r_body, | ||
char * | r_suf, | ||
size_t | str_len | ||
) |
Based on BLI_split_dirfile()
/ os.path.splitext()
, "a.b.c"
-> ("a.b"
, ".c"
).
Definition at line 75 of file string_utils.c.
References BLI_strncpy(), BLI_strnlen(), is_char_sep(), and len.
Referenced by select_similar_suffix().
bool BLI_uniquename | ( | struct ListBase * | list, |
void * | vlink, | ||
const char * | defname, | ||
char | delim, | ||
int | name_offset, | ||
size_t | name_len | ||
) |
Ensures that the specified block has a unique name within the containing list, incrementing its numeric suffix as necessary. Returns true if name had to be adjusted.
list | List containing the block |
vlink | The block to check the name for |
defname | To initialize block name if latter is empty |
delim | Delimits numeric suffix in name |
name_offset | Offset of name within block structure |
name_len | Maximum length of name area |
Definition at line 309 of file string_utils.c.
References BLI_assert, BLI_uniquename_cb(), data, ELEM, NULL, POINTER_OFFSET, and uniquename_unique_check().
Referenced by action_groups_add_new(), AnimationImporter::add_bone_fcurve(), add_to_modifier_list(), BKE_asset_metadata_tag_add(), BKE_constraint_unique_name(), BKE_freestyle_lineset_unique_name(), BKE_gpencil_layer_addnew(), BKE_gpencil_modifier_unique_name(), BKE_gpencil_palette_addnew(), BKE_gpencil_palettecolor_addnew(), BKE_keyblock_add(), BKE_keyingset_add(), BKE_mask_layer_unique_name(), BKE_modifier_unique_name(), BKE_nla_action_stash(), BKE_nlatrack_add(), BKE_pose_add_group(), BKE_preferences_asset_library_name_set(), BKE_scene_add_render_view(), BKE_shaderfx_unique_name(), BKE_tracking_object_unique_name(), BKE_tracking_plane_track_unique_name(), BKE_tracking_track_unique_name(), BKE_view_layer_add(), BKE_view_layer_rename(), do_versions_after_linking_300(), do_versions_nodetree_customnodes(), driver_add_new_variable(), driver_variable_unique_name(), ED_gpencil_join_objects_exec(), fcurve_add_to_list(), gpencil_layer_copy_exec(), namebutton_fn(), nodeUniqueName(), poselib_add_exec(), poselib_rename_exec(), psys_unique_name(), SEQ_modifier_unique_name(), tracks_map_merge(), viewlayer_aov_make_name_unique(), viewlayer_lightgroup_make_name_unique(), and workspace_layout_name_set().
bool BLI_uniquename_cb | ( | UniquenameCheckCallback | unique_check, |
void * | arg, | ||
const char * | defname, | ||
char | delim, | ||
char * | name, | ||
size_t | name_len | ||
) |
Ensures name is unique (according to criteria specified by caller in unique_check callback), incrementing its numeric suffix as necessary. Returns true if name had to be adjusted.
unique_check | Return true if name is not unique |
arg | Additional arg to unique_check–meaning is up to caller |
defname | To initialize name if latter is empty |
delim | Delimits numeric suffix in name |
name | Name to be ensured unique |
name_len | Maximum length of name area |
Definition at line 233 of file string_utils.c.
References BLI_snprintf(), BLI_split_name_num(), BLI_strncpy(), BLI_strncpy_utf8_rlen(), left, and len.
Referenced by BKE_id_attribute_calc_unique_name(), BKE_nlastrip_validate_name(), BKE_object_defgroup_unique_name(), BKE_object_facemap_unique_name(), BLI_uniquename(), catalog_name_ensure_unique(), CustomData_set_layer_unique_name(), dash_segment_add_exec(), dynamicPaintSurface_setUniqueName(), ed_armature_bone_unique_name(), ED_armature_ebone_unique_name(), make_socket(), ntree_interface_identifier(), ntreeCompositOutputFileUniqueLayer(), ntreeCompositOutputFileUniquePath(), surface_setUniqueOutputName(), unique_socket_template_identifier(), and uniqueOrientationName().