Blender V5.0
BLI_string_utils.hh File Reference
#include <cstdarg>
#include <string>
#include "BLI_compiler_attrs.h"
#include "BLI_function_ref.hh"
#include "BLI_string_ref.hh"
#include "BLI_utildefines.h"

Go to the source code of this file.

Macros

#define BLI_string_join_by_sep_char_with_tableN(sep, table, ...)
#define _BLI_STRING_ARGS_1   _BLI_STRING_ARGS_0 const char *a
#define _BLI_STRING_ARGS_2   _BLI_STRING_ARGS_1, const char *b
#define _BLI_STRING_ARGS_3   _BLI_STRING_ARGS_2, const char *c
#define _BLI_STRING_ARGS_4   _BLI_STRING_ARGS_3, const char *d
#define _BLI_STRING_ARGS_5   _BLI_STRING_ARGS_4, const char *e
#define _BLI_STRING_ARGS_6   _BLI_STRING_ARGS_5, const char *f
#define _BLI_STRING_ARGS_7   _BLI_STRING_ARGS_6, const char *g
#define _BLI_STRING_ARGS_8   _BLI_STRING_ARGS_7, const char *h
#define _BLI_STRING_ARGS_9   _BLI_STRING_ARGS_8, const char *i
#define _BLI_STRING_ARGS_10   _BLI_STRING_ARGS_9, const char *j

Functions

void void char * BLI_string_join_array_by_sep_char_with_tableN (char sep, char *table[], const char *strings[], uint strings_num) ATTR_NONNULL(2
size_t BLI_string_flip_side_name (char *name_dst, const char *name_src, bool strip_number, size_t name_dst_maxncpy) ATTR_NONNULL(1
size_t void BLI_uniquename_cb (blender::FunctionRef< bool(blender::StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
size_t void std::string BLI_uniquename_cb (blender::FunctionRef< bool(blender::StringRef)> unique_check, char delim, blender::StringRef name)
void BLI_uniquename (const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
void size_t BLI_string_len_array (const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
String Split
size_t BLI_string_split_name_number (const char *name, char delim, char *r_name_left, int *r_number) ATTR_NONNULL(1
size_t blender::StringRef BLI_string_split_name_number (const blender::StringRef name_full, char delim, int &r_number)
bool BLI_string_is_decimal (const char *string) ATTR_NONNULL(1)
void BLI_string_split_suffix (const char *string, size_t string_maxlen, char *r_body, char *r_suf) ATTR_NONNULL(1
void void BLI_string_split_prefix (const char *string, size_t string_maxlen, char *r_pre, char *r_body) ATTR_NONNULL(1

Implement: <tt>BLI_string_join_by_sep_charN(..)</tt>

#define _BLI_STRING_ARGS_0   char *__restrict dst, const size_t dst_len,
#define _BLI_STRING_ARGS_0
#define _BLI_STRING_ARGS_0   char *__restrict dst, const size_t dst_len, const char sep,
#define BLI_string_join_by_sep_charN(...)
#define _BLI_STRING_ARGS_0   const char sep,
char * BLI_string_join_array_by_sep_charN (char sep, const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_2 (_BLI_STRING_ARGS_1) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_3 (_BLI_STRING_ARGS_2) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_4 (_BLI_STRING_ARGS_3) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_5 (_BLI_STRING_ARGS_4) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_6 (_BLI_STRING_ARGS_5) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_7 (_BLI_STRING_ARGS_6) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_8 (_BLI_STRING_ARGS_7) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_9 (_BLI_STRING_ARGS_8) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_10 (_BLI_STRING_ARGS_9) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_join_by_sep_charN_11 (_BLI_STRING_ARGS_10) ATTR_NONNULL()

Implement: <tt>BLI_string_join(..)</tt>

#define BLI_string_join(...)
size_t BLI_string_join_array (char *result, size_t result_maxncpy, const char *strings[], uint strings_num) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_3 (_BLI_STRING_ARGS_1) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_4 (_BLI_STRING_ARGS_2) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_5 (_BLI_STRING_ARGS_3) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_6 (_BLI_STRING_ARGS_4) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_7 (_BLI_STRING_ARGS_5) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_8 (_BLI_STRING_ARGS_6) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_9 (_BLI_STRING_ARGS_7) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_10 (_BLI_STRING_ARGS_8) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_11 (_BLI_STRING_ARGS_9) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_12 (_BLI_STRING_ARGS_10) ATTR_NONNULL()

Implement: <tt>BLI_string_joinN(..)</tt>

#define BLI_string_joinN(...)
char * BLI_string_join_arrayN (const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_1 (_BLI_STRING_ARGS_1) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_2 (_BLI_STRING_ARGS_2) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_3 (_BLI_STRING_ARGS_3) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_4 (_BLI_STRING_ARGS_4) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_5 (_BLI_STRING_ARGS_5) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_6 (_BLI_STRING_ARGS_6) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_7 (_BLI_STRING_ARGS_7) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_8 (_BLI_STRING_ARGS_8) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_9 (_BLI_STRING_ARGS_9) ATTR_NONNULL()
BLI_INLINE char * _BLI_string_joinN_10 (_BLI_STRING_ARGS_10) ATTR_NONNULL()

Implement: <tt>BLI_string_join_by_sep_char(..)</tt>

#define BLI_string_join_by_sep_char(...)
size_t BLI_string_join_array_by_sep_char (char *result, size_t result_maxncpy, char sep, const char *strings[], uint strings_num) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_4 (_BLI_STRING_ARGS_1) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_5 (_BLI_STRING_ARGS_2) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_6 (_BLI_STRING_ARGS_3) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_7 (_BLI_STRING_ARGS_4) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_8 (_BLI_STRING_ARGS_5) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_9 (_BLI_STRING_ARGS_6) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_10 (_BLI_STRING_ARGS_7) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_11 (_BLI_STRING_ARGS_8) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_12 (_BLI_STRING_ARGS_9) ATTR_NONNULL()
BLI_INLINE size_t _BLI_string_join_by_sep_char_13 (_BLI_STRING_ARGS_10) ATTR_NONNULL()

String Replace

char ATTR_MALLOC
char * BLI_string_replaceN (const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BLI_string_replace (std::string &haystack, blender::StringRef needle, blender::StringRef other)
void BLI_string_replace_char (char *str, char src, char dst) ATTR_NONNULL(1)
bool BLI_string_replace_table_exact (char *string, size_t string_maxncpy, const char *replace_table[][2], int replace_table_len)
size_t BLI_string_replace_range (char *string, size_t string_maxncpy, int src_beg, int src_end, const char *dst)

Macro Definition Documentation

◆ _BLI_STRING_ARGS_0 [1/4]

#define _BLI_STRING_ARGS_0   const char sep,

Definition at line 221 of file BLI_string_utils.hh.

◆ _BLI_STRING_ARGS_0 [2/4]

#define _BLI_STRING_ARGS_0   char *__restrict dst, const size_t dst_len, const char sep,

Definition at line 221 of file BLI_string_utils.hh.

◆ _BLI_STRING_ARGS_0 [3/4]

#define _BLI_STRING_ARGS_0

Definition at line 221 of file BLI_string_utils.hh.

◆ _BLI_STRING_ARGS_0 [4/4]

#define _BLI_STRING_ARGS_0   char *__restrict dst, const size_t dst_len,

Definition at line 221 of file BLI_string_utils.hh.

◆ _BLI_STRING_ARGS_1

#define _BLI_STRING_ARGS_1   _BLI_STRING_ARGS_0 const char *a

◆ _BLI_STRING_ARGS_10

#define _BLI_STRING_ARGS_10   _BLI_STRING_ARGS_9, const char *j

◆ _BLI_STRING_ARGS_2

#define _BLI_STRING_ARGS_2   _BLI_STRING_ARGS_1, const char *b

◆ _BLI_STRING_ARGS_3

#define _BLI_STRING_ARGS_3   _BLI_STRING_ARGS_2, const char *c

◆ _BLI_STRING_ARGS_4

#define _BLI_STRING_ARGS_4   _BLI_STRING_ARGS_3, const char *d

◆ _BLI_STRING_ARGS_5

#define _BLI_STRING_ARGS_5   _BLI_STRING_ARGS_4, const char *e

◆ _BLI_STRING_ARGS_6

#define _BLI_STRING_ARGS_6   _BLI_STRING_ARGS_5, const char *f

◆ _BLI_STRING_ARGS_7

#define _BLI_STRING_ARGS_7   _BLI_STRING_ARGS_6, const char *g

◆ _BLI_STRING_ARGS_8

#define _BLI_STRING_ARGS_8   _BLI_STRING_ARGS_7, const char *h

◆ _BLI_STRING_ARGS_9

#define _BLI_STRING_ARGS_9   _BLI_STRING_ARGS_8, const char *i

◆ BLI_string_join

◆ BLI_string_join_by_sep_char

#define BLI_string_join_by_sep_char ( ...)
Value:
VA_NARGS_CALL_OVERLOAD(_BLI_string_join_by_sep_char_, __VA_ARGS__)

Definition at line 393 of file BLI_string_utils.hh.

Referenced by bpy_text_filepath_get().

◆ BLI_string_join_by_sep_char_with_tableN

#define BLI_string_join_by_sep_char_with_tableN ( sep,
table,
... )
Value:
sep, table, ((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
void void char * BLI_string_join_array_by_sep_char_with_tableN(char sep, char *table[], const char *strings[], uint strings_num) ATTR_NONNULL(2
#define VA_NARGS_COUNT(...)

Definition at line 130 of file BLI_string_utils.hh.

◆ BLI_string_join_by_sep_charN

#define BLI_string_join_by_sep_charN ( ...)
Value:
VA_NARGS_CALL_OVERLOAD(_BLI_string_join_by_sep_charN_, __VA_ARGS__)

Definition at line 486 of file BLI_string_utils.hh.

Referenced by pyrna_struct_anim_args_parse_no_resolve().

◆ BLI_string_joinN

#define BLI_string_joinN ( ...)

Function Documentation

◆ _BLI_string_join_10()

BLI_INLINE size_t _BLI_string_join_10 ( _BLI_STRING_ARGS_8 )

Definition at line 279 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_8, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_array(), and e.

◆ _BLI_string_join_11()

BLI_INLINE size_t _BLI_string_join_11 ( _BLI_STRING_ARGS_9 )

Definition at line 284 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_9, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_array(), e, and i.

◆ _BLI_string_join_12()

BLI_INLINE size_t _BLI_string_join_12 ( _BLI_STRING_ARGS_10 )

Definition at line 289 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_10, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_array(), e, and i.

◆ _BLI_string_join_3()

BLI_INLINE size_t _BLI_string_join_3 ( _BLI_STRING_ARGS_1 )

◆ _BLI_string_join_4()

BLI_INLINE size_t _BLI_string_join_4 ( _BLI_STRING_ARGS_2 )

Definition at line 249 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_2, ARRAY_SIZE, b, BLI_INLINE, and BLI_string_join_array().

◆ _BLI_string_join_5()

BLI_INLINE size_t _BLI_string_join_5 ( _BLI_STRING_ARGS_3 )

Definition at line 254 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_3, ARRAY_SIZE, b, BLI_INLINE, and BLI_string_join_array().

◆ _BLI_string_join_6()

BLI_INLINE size_t _BLI_string_join_6 ( _BLI_STRING_ARGS_4 )

Definition at line 259 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_4, ARRAY_SIZE, b, BLI_INLINE, and BLI_string_join_array().

◆ _BLI_string_join_7()

BLI_INLINE size_t _BLI_string_join_7 ( _BLI_STRING_ARGS_5 )

Definition at line 264 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_5, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_array(), and e.

◆ _BLI_string_join_8()

BLI_INLINE size_t _BLI_string_join_8 ( _BLI_STRING_ARGS_6 )

Definition at line 269 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_6, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_array(), and e.

◆ _BLI_string_join_9()

BLI_INLINE size_t _BLI_string_join_9 ( _BLI_STRING_ARGS_7 )

Definition at line 274 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_7, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_array(), and e.

◆ _BLI_string_join_by_sep_char_10()

BLI_INLINE size_t _BLI_string_join_by_sep_char_10 ( _BLI_STRING_ARGS_7 )

◆ _BLI_string_join_by_sep_char_11()

BLI_INLINE size_t _BLI_string_join_by_sep_char_11 ( _BLI_STRING_ARGS_8 )

◆ _BLI_string_join_by_sep_char_12()

BLI_INLINE size_t _BLI_string_join_by_sep_char_12 ( _BLI_STRING_ARGS_9 )

◆ _BLI_string_join_by_sep_char_13()

BLI_INLINE size_t _BLI_string_join_by_sep_char_13 ( _BLI_STRING_ARGS_10 )

◆ _BLI_string_join_by_sep_char_4()

BLI_INLINE size_t _BLI_string_join_by_sep_char_4 ( _BLI_STRING_ARGS_1 )

◆ _BLI_string_join_by_sep_char_5()

BLI_INLINE size_t _BLI_string_join_by_sep_char_5 ( _BLI_STRING_ARGS_2 )

◆ _BLI_string_join_by_sep_char_6()

BLI_INLINE size_t _BLI_string_join_by_sep_char_6 ( _BLI_STRING_ARGS_3 )

◆ _BLI_string_join_by_sep_char_7()

BLI_INLINE size_t _BLI_string_join_by_sep_char_7 ( _BLI_STRING_ARGS_4 )

◆ _BLI_string_join_by_sep_char_8()

BLI_INLINE size_t _BLI_string_join_by_sep_char_8 ( _BLI_STRING_ARGS_5 )

◆ _BLI_string_join_by_sep_char_9()

BLI_INLINE size_t _BLI_string_join_by_sep_char_9 ( _BLI_STRING_ARGS_6 )

◆ _BLI_string_join_by_sep_charN_10()

BLI_INLINE char * _BLI_string_join_by_sep_charN_10 ( _BLI_STRING_ARGS_9 )

◆ _BLI_string_join_by_sep_charN_11()

BLI_INLINE char * _BLI_string_join_by_sep_charN_11 ( _BLI_STRING_ARGS_10 )

◆ _BLI_string_join_by_sep_charN_2()

BLI_INLINE char * _BLI_string_join_by_sep_charN_2 ( _BLI_STRING_ARGS_1 )

◆ _BLI_string_join_by_sep_charN_3()

BLI_INLINE char * _BLI_string_join_by_sep_charN_3 ( _BLI_STRING_ARGS_2 )

◆ _BLI_string_join_by_sep_charN_4()

BLI_INLINE char * _BLI_string_join_by_sep_charN_4 ( _BLI_STRING_ARGS_3 )

◆ _BLI_string_join_by_sep_charN_5()

BLI_INLINE char * _BLI_string_join_by_sep_charN_5 ( _BLI_STRING_ARGS_4 )

◆ _BLI_string_join_by_sep_charN_6()

BLI_INLINE char * _BLI_string_join_by_sep_charN_6 ( _BLI_STRING_ARGS_5 )

◆ _BLI_string_join_by_sep_charN_7()

BLI_INLINE char * _BLI_string_join_by_sep_charN_7 ( _BLI_STRING_ARGS_6 )

◆ _BLI_string_join_by_sep_charN_8()

BLI_INLINE char * _BLI_string_join_by_sep_charN_8 ( _BLI_STRING_ARGS_7 )

◆ _BLI_string_join_by_sep_charN_9()

BLI_INLINE char * _BLI_string_join_by_sep_charN_9 ( _BLI_STRING_ARGS_8 )

◆ _BLI_string_joinN_1()

BLI_INLINE char * _BLI_string_joinN_1 ( _BLI_STRING_ARGS_1 )

◆ _BLI_string_joinN_10()

BLI_INLINE char * _BLI_string_joinN_10 ( _BLI_STRING_ARGS_10 )

Definition at line 369 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_10, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_arrayN(), e, and i.

◆ _BLI_string_joinN_2()

BLI_INLINE char * _BLI_string_joinN_2 ( _BLI_STRING_ARGS_2 )

◆ _BLI_string_joinN_3()

BLI_INLINE char * _BLI_string_joinN_3 ( _BLI_STRING_ARGS_3 )

◆ _BLI_string_joinN_4()

BLI_INLINE char * _BLI_string_joinN_4 ( _BLI_STRING_ARGS_4 )

◆ _BLI_string_joinN_5()

BLI_INLINE char * _BLI_string_joinN_5 ( _BLI_STRING_ARGS_5 )

Definition at line 344 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_5, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_arrayN(), and e.

◆ _BLI_string_joinN_6()

BLI_INLINE char * _BLI_string_joinN_6 ( _BLI_STRING_ARGS_6 )

Definition at line 349 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_6, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_arrayN(), and e.

◆ _BLI_string_joinN_7()

BLI_INLINE char * _BLI_string_joinN_7 ( _BLI_STRING_ARGS_7 )

Definition at line 354 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_7, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_arrayN(), and e.

◆ _BLI_string_joinN_8()

BLI_INLINE char * _BLI_string_joinN_8 ( _BLI_STRING_ARGS_8 )

Definition at line 359 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_8, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_arrayN(), and e.

◆ _BLI_string_joinN_9()

BLI_INLINE char * _BLI_string_joinN_9 ( _BLI_STRING_ARGS_9 )

Definition at line 364 of file BLI_string_utils.hh.

References _BLI_STRING_ARGS_9, ARRAY_SIZE, b, BLI_INLINE, BLI_string_join_arrayN(), e, and i.

◆ BLI_string_flip_side_name()

size_t BLI_string_flip_side_name ( char * name_dst,
const char * name_src,
bool strip_number,
size_t name_dst_maxncpy )

Finds the best possible flipped (left/right) name. For renaming; check for unique names afterwards.

Parameters
name_dstflipped name, assumed to be a pointer to a string of at least name_maxncpy size.
name_srcoriginal name, assumed to be a pointer to a string of at least name_maxncpy size.
strip_numberIf set, remove number extensions.
Returns
The number of bytes written into name.

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_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(), blender::ed::animation::flip_names(), mirror_bone_collection_assignments(), object_defgroup_unlocked_flip_map_ex(), blender::ed::object::object_select_mirror_exec(), pose_bone_do_paste(), update_duplicate_custom_bone_shapes(), and update_duplicate_subtarget().

◆ BLI_string_is_decimal()

bool BLI_string_is_decimal ( const char * string)

◆ BLI_string_join_array()

◆ BLI_string_join_array_by_sep_char()

◆ BLI_string_join_array_by_sep_char_with_tableN()

void void char * BLI_string_join_array_by_sep_char_with_tableN ( char sep,
char * table[],
const char * strings[],
uint strings_num )

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.

References ATTR_NONNULL, and BLI_string_join_array_by_sep_char_with_tableN().

Referenced by BLI_string_join_array_by_sep_char_with_tableN().

◆ BLI_string_join_array_by_sep_charN()

◆ BLI_string_join_arrayN()

char * BLI_string_join_arrayN ( const char * strings[],
uint strings_num )

◆ BLI_string_len_array()

void size_t BLI_string_len_array ( const char * strings[],
uint strings_num )

◆ BLI_string_replace()

void BLI_string_replace ( std::string & haystack,
blender::StringRef needle,
blender::StringRef other )

In-place replacement all occurrences of needle in haystack with other.

Definition at line 91 of file blenlib/intern/string_utils.cc.

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

Referenced by blender::TEST().

◆ BLI_string_replace_char()

◆ BLI_string_replace_range()

size_t BLI_string_replace_range ( char * string,
size_t string_maxncpy,
int src_beg,
int src_end,
const char * dst )

Write dst into the range between src_beg & src_end, resize within string_maxncpy limits, ensure null terminated.

Returns
the length of string.

Definition at line 129 of file blenlib/intern/string_utils.cc.

References BLI_assert, and UNLIKELY.

Referenced by BLI_path_frame(), BLI_path_frame_range(), eval_template(), and version_escape_curly_braces().

◆ BLI_string_replace_table_exact()

bool BLI_string_replace_table_exact ( char * string,
size_t string_maxncpy,
const char * replace_table[][2],
int replace_table_len )

Simple exact-match string replacement.

Parameters
replace_tableArray of source, destination pairs.
Note
Larger tables should use a hash table.

Definition at line 113 of file blenlib/intern/string_utils.cc.

References BLI_string_debug_size_after_nil, BLI_strncpy(), i, and STREQ.

Referenced by BKE_workspace_tool_id_replace_table(), and blo_do_versions_userdef().

◆ BLI_string_replaceN()

char * BLI_string_replaceN ( const char *__restrict str,
const char *__restrict substr_old,
const char *__restrict substr_new )

string with all instances of substr_old replaced with substr_new, Returns a copy of the c-string str into a newly MEM_mallocN'd and returns it.

Note
A rather wasteful string-replacement utility, though this shall do for now. Feel free to replace this with an even safe + nicer alternative
Parameters
strThe string to replace occurrences of substr_old in
substr_oldThe text in the string to find and replace
substr_newThe text in the string to find and replace
Return values
Returnsthe duplicated string

References ATTR_WARN_UNUSED_RESULT, and str.

Referenced by BKE_image_get_tile_strformat(), do_versions_sequencer_speed_effect_recursive(), blender::nodes::node_fn_replace_string_cc::replace_all(), replace_bbone_easing_rnapath(), and update_duplicate_action_constraint_settings().

◆ BLI_string_split_name_number() [1/2]

◆ BLI_string_split_name_number() [2/2]

size_t BLI_string_split_name_number ( const char * name,
char delim,
char * r_name_left,
int * r_number )

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"

Parameters
leftWhere to return copy of part preceding delim.
nrWhere to return value of numeric suffix.
nameString to split.
delimDelimiter character.
Returns
Length of left.

References ATTR_NONNULL, BLI_string_is_decimal(), BLI_string_split_name_number(), and name.

Referenced by BKE_id_new_name_validate(), BKE_mball_basis_find(), BKE_mball_is_same_group(), BKE_mball_properties_copy(), BLI_string_split_name_number(), init_meta(), namemap_get_name(), UniqueName_Map::populate(), UniqueName_Map::remove_full_name(), and blender::ed::vse::sequencer_change_effect_type_exec().

◆ BLI_string_split_prefix()

void void BLI_string_split_prefix ( const char * string,
size_t string_maxlen,
char * r_pre,
char * r_body )

"a.b.c" -> ("a.", "b.c").

References ATTR_NONNULL, and BLI_string_split_prefix().

Referenced by BLI_string_split_prefix(), and select_similar_prefix().

◆ BLI_string_split_suffix()

void BLI_string_split_suffix ( const char * string,
size_t string_maxlen,
char * r_body,
char * r_suf )

◆ BLI_uniquename()

void BLI_uniquename ( const struct ListBase * list,
void * vlink,
const char * defname,
char delim,
int name_offset,
size_t name_maxncpy )

Ensures that the specified block has a unique name within the containing list, incrementing its numeric suffix as necessary.

Parameters
listList containing the block
vlinkThe block to check the name for
defnameTo initialize block name if latter is empty
delimDelimits numeric suffix in name
name_offsetOffset of name within block structure
name_maxncpyMaximum length of name area

References ATTR_WARN_UNUSED_RESULT.

Referenced by action_groups_add_new(), add_to_modifier_list(), BKE_asset_metadata_tag_add(), BKE_collection_exporter_name_set(), BKE_constraint_unique_name(), BKE_fmodifier_name_set(), BKE_freestyle_lineset_unique_name(), BKE_gpencil_layer_addnew(), 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_insert_after(), BKE_nlatrack_insert_before(), BKE_pose_add_group(), BKE_preferences_asset_library_name_set(), BKE_preferences_extension_repo_module_set(), BKE_preferences_extension_repo_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(), do_versions_theme(), driver_add_new_variable(), driver_variable_unique_name(), blender::seq::modifier_copy(), blender::seq::modifier_unique_name(), blender::ed::outliner::namebutton_fn(), blender::bke::node_unique_name(), psys_unique_name(), tracks_map_merge(), viewlayer_aov_make_name_unique(), viewlayer_lightgroup_make_name_unique(), and workspace_layout_name_set().

◆ BLI_uniquename_cb() [1/2]

size_t void std::string BLI_uniquename_cb ( blender::FunctionRef< bool(blender::StringRef)> unique_check,
char delim,
blender::StringRef name )

Return a name that is unique (according to criteria specified by caller in unique_check callback), incrementing its numeric suffix as necessary.

Parameters
unique_checkReturn true if name is not unique
delimDelimits numeric suffix in name
nameName to be made unique
Returns
name that can be assigned by the caller to make it unique.
Note
Contrary to the other functions with the same name, this function does not directly set the unique name. That is the responsibility of the caller.

Definition at line 451 of file blenlib/intern/string_utils.cc.

References BLI_snprintf(), BLI_string_split_name_number(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), left, len, and name.

◆ BLI_uniquename_cb() [2/2]

size_t void BLI_uniquename_cb ( blender::FunctionRef< bool(blender::StringRefNull)> unique_check,
const char * defname,
char delim,
char * name,
size_t name_maxncpy )

Ensures name is unique (according to criteria specified by caller in unique_check callback), incrementing its numeric suffix as necessary.

Parameters
unique_checkReturn true if name is not unique
defnameTo initialize name if latter is empty
delimDelimits numeric suffix in name
nameName to be ensured unique
name_maxncpyMaximum length of name area

References name.

Referenced by BKE_attribute_calc_unique_name(), BKE_nlastrip_validate_name(), BKE_object_defgroup_unique_name(), bonecoll_ensure_name_unique(), blender::ed::asset::catalog_name_ensure_unique(), blender::animrig::Channelbag::channel_group_create(), CustomData_set_layer_unique_name(), blender::ed::object::dash_modifier_segment_add_exec(), dynamicPaintSurface_setUniqueName(), ed_armature_bone_unique_name(), ED_armature_ebone_unique_name(), long_id_names_process_action_slots_identifiers(), blender::bke::make_socket(), blender::io::AbstractHierarchyIterator::make_unique_name(), ntreeCompositOutputFileUniqueLayer(), ntreeCompositOutputFileUniquePath(), rename_mesh_uv_seam_attribute(), blender::nodes::socket_items::set_item_name_and_make_unique(), blender::animrig::slot_identifier_ensure_unique(), surface_setUniqueOutputName(), blender::TEST(), blender::ed::object::time_modifier_segment_add_exec(), blender::nodes::materialx::NodeGraph::unique_anonymous_node_name(), blender::bke::AttributeStorage::unique_name_calc(), blender::nodes::materialx::NodeGraph::unique_node_name(), unique_node_name(), blender::bke::unique_socket_template_identifier(), and blender::ed::transform::uniqueOrientationName().

Variable Documentation

◆ ATTR_MALLOC

char ATTR_MALLOC

Definition at line 41 of file BLI_string_utils.hh.