|
Blender V4.5
|
Go to the source code of this file.
Macros | |
| #define | BLI_UTF8_MAX 6 |
| #define | BLI_UTF8_WIDTH_MAX 2 /* columns */ |
| #define | BLI_UTF8_ERR ((unsigned int)-1) |
String Copy/Format Macros | |
Avoid repeating destination with sizeof(..).
| |
| #define | STRNCPY_UTF8(dst, src) |
| #define | STRNCPY_UTF8_RLEN(dst, src) |
| #define | STRNLEN_UTF8(str) |
Functions | |
| char * | BLI_strncpy_utf8 (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1 |
| char size_t | BLI_strncpy_utf8_rlen (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| char size_t size_t | BLI_strncpy_utf8_rlen_unterminated (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) |
| ptrdiff_t | BLI_str_utf8_invalid_byte (const char *str, size_t str_len) ATTR_NONNULL(1) |
| int | BLI_str_utf8_invalid_strip (char *str, size_t str_len) ATTR_NONNULL(1) |
| int | BLI_str_utf8_invalid_substitute (char *str, size_t str_len, const char substitute) ATTR_NONNULL(1) |
| const char * | BLI_str_utf8_invalid_substitute_as_needed (const char *str, size_t str_len, const char substitute, char *buf, const size_t buf_maxncpy) ATTR_NONNULL(1 |
| const char int | BLI_str_utf8_size_or_error (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| int | BLI_str_utf8_size_safe (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| unsigned int | BLI_str_utf8_as_unicode_or_error (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| unsigned int | BLI_str_utf8_as_unicode_safe (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| unsigned int | BLI_str_utf8_as_unicode_step_safe (const char *__restrict p, size_t p_len, size_t *__restrict index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| unsigned int unsigned int | BLI_str_utf8_as_unicode_step_or_error (const char *__restrict p, size_t p_len, size_t *__restrict index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| unsigned int unsigned int size_t | BLI_str_utf8_from_unicode_len (unsigned int c) ATTR_WARN_UNUSED_RESULT |
| size_t | BLI_str_utf8_from_unicode (unsigned int c, char *dst, size_t dst_maxncpy) ATTR_NONNULL(2) |
| size_t | BLI_str_utf8_as_utf32 (char32_t *__restrict dst_w, const char *__restrict src_c, size_t dst_w_maxncpy) ATTR_NONNULL(1 |
| size_t size_t | BLI_str_utf32_as_utf8 (char *__restrict dst, const char32_t *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1 |
| size_t size_t size_t | BLI_str_utf32_as_utf8_len_ex (const char32_t *src, size_t src_maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| size_t | BLI_str_utf32_as_utf8_len (const char32_t *src) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| const char * | BLI_str_find_prev_char_utf8 (const char *p, const char *str_start) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1 |
| const char const char * | BLI_str_find_next_char_utf8 (const char *p, const char *str_end) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1 |
| const char const char size_t | BLI_wstrlen_utf8 (const wchar_t *src) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT |
| size_t | BLI_strlen_utf8_ex (const char *strc, size_t *r_len_bytes) ATTR_NONNULL(1 |
| size_t | BLI_strlen_utf8 (const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT |
| size_t | BLI_strnlen_utf8_ex (const char *strc, size_t strc_maxlen, size_t *r_len_bytes) ATTR_NONNULL(1 |
| size_t size_t | BLI_strnlen_utf8 (const char *strc, size_t strc_maxlen) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT |
| size_t | BLI_strncpy_wchar_as_utf8 (char *__restrict dst, const wchar_t *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1 |
| size_t size_t | BLI_strncpy_wchar_from_utf8 (wchar_t *__restrict dst_w, const char *__restrict src_c, size_t dst_w_maxncpy) ATTR_NONNULL(1 |
| size_t size_t int | BLI_wcwidth_or_error (char32_t ucs) ATTR_WARN_UNUSED_RESULT |
| int | BLI_wcwidth_safe (char32_t ucs) ATTR_WARN_UNUSED_RESULT |
| int | BLI_wcswidth_or_error (const char32_t *pwcs, size_t n) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| char32_t | BLI_str_utf32_char_to_upper (char32_t wc) |
| char32_t | BLI_str_utf32_char_to_lower (char32_t wc) |
| bool | BLI_str_utf32_char_is_breaking_space (char32_t codepoint) |
| bool | BLI_str_utf32_char_is_optional_break_after (char32_t codepoint, char32_t codepoint_prev) |
| bool | BLI_str_utf32_char_is_optional_break_before (char32_t codepoint, char32_t codepoint_prev) |
| int | BLI_str_utf8_char_width_or_error (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| int | BLI_str_utf8_char_width_safe (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| size_t | BLI_str_partition_utf8 (const char *str, const unsigned int delim[], const char **r_sep, const char **r_suf) ATTR_NONNULL(1 |
| size_t size_t | BLI_str_rpartition_utf8 (const char *str, const unsigned int delim[], const char **r_sep, const char **r_suf) ATTR_NONNULL(1 |
| size_t size_t size_t | BLI_str_partition_ex_utf8 (const char *str, const char *end, const unsigned int delim[], const char **r_sep, const char **r_suf, bool from_right) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| size_t size_t size_t bool | BLI_str_utf8_truncate_at_size (char *str, const size_t str_size) |
| int | BLI_str_utf8_offset_to_index (const char *str, size_t str_len, int offset_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| int | BLI_str_utf8_offset_from_index (const char *str, size_t str_len, int index_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| int | BLI_str_utf8_offset_to_column (const char *str, size_t str_len, int offset_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| int | BLI_str_utf8_offset_from_column (const char *str, size_t str_len, int column_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| int | BLI_str_utf8_offset_to_column_with_tabs (const char *str, size_t str_len, int offset_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| int | BLI_str_utf8_offset_from_column_with_tabs (const char *str, size_t str_len, int column_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
Variables | |
| size_t | ATTR_WARN_UNUSED_RESULT |
| #define BLI_UTF8_ERR ((unsigned int)-1) |
Definition at line 286 of file BLI_string_utf8.h.
Referenced by blf_glyph_from_utf8_and_step(), BLI_str_partition_ex_utf8(), BLI_str_utf8_as_unicode_or_error(), BLI_str_utf8_as_unicode_safe(), BLI_str_utf8_as_unicode_step_or_error(), BLI_str_utf8_as_unicode_step_safe(), BLI_str_utf8_as_utf32(), BLI_str_utf8_char_width_or_error(), and BLI_str_utf8_char_width_safe().
| #define BLI_UTF8_MAX 6 |
Size in bytes.
Definition at line 284 of file BLI_string_utf8.h.
Referenced by console_insert_invoke(), draw_suggestion_list(), find_family_object(), text_insert_invoke(), txt_add_char_intern(), and txt_replace_char().
| #define BLI_UTF8_WIDTH_MAX 2 /* columns */ |
Definition at line 285 of file BLI_string_utf8.h.
Referenced by textview_wrap_offsets().
| #define STRNCPY_UTF8 | ( | dst, | |
| src ) |
Definition at line 294 of file BLI_string_utf8.h.
Referenced by action_groups_add_new(), ANIM_armature_bonecoll_name_set(), ANIM_bonecoll_new(), arg_handle_engine_set(), asset_metadata_tag_add(), BKE_gpencil_layer_addnew(), BKE_id_new_name_validate(), BKE_image_add_renderslot(), BKE_keyblock_add(), BKE_keyingset_add(), BKE_object_defgroup_set_name(), BKE_preferences_asset_library_name_set(), BKE_preferences_extension_repo_name_set(), BKE_shaderfx_new(), BKE_view_layer_add(), BKE_view_layer_add_aov(), BKE_view_layer_add_lightgroup(), BKE_view_layer_rename(), BKE_view_layer_rename_lightgroup(), blo_do_versions_userdef(), boid_new_rule(), blender::ed::transform::calculatePropRatio(), blender::animrig::Channelbag::channel_group_create(), blender::animrig::convert_to_layered_action(), CustomData_set_layer_unique_name(), do_versions_nodetree_file_output_layers_2_64_5(), driver_add_new_variable(), dynamicPaintSurface_setUniqueName(), ED_info_draw_stats(), ED_node_shader_default(), blender::seq::ensure_unique_name(), blender::init_data(), blender::ed::asset::index::init_indexer_entry_from_value(), blender::animrig::Action::layer_add(), blender::bke::greasepencil::convert::legacy_object_modifier_common(), blender::ed::object::modifier_add(), modifier_allocate_and_init(), ntreeCompositOutputFileAddSocket(), ntreeCompositOutputFileSetLayer(), ntreeCompositOutputFileSetPath(), blender::ed::object::object_speaker_add_exec(), preferences_extension_repo_add_exec(), proj_paint_add_slot(), blender::ed::object::shaderfx_add(), blender::animrig::Action::slot_add(), blender::animrig::Action::slot_identifier_define(), blender::animrig::Action::slot_identifier_propagate(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), ui_but_anim_expression_create(), ui_but_anim_expression_set(), blender::ed::space_node::ui_node_menu_column(), view_layer_add(), WM_dropboxmap_find(), WM_keyconfig_new(), and wm_keymap_new().
| #define STRNCPY_UTF8_RLEN | ( | dst, | |
| src ) |
Definition at line 295 of file BLI_string_utf8.h.
Referenced by bone_autoside_name().
| #define STRNLEN_UTF8 | ( | str | ) |
Definition at line 297 of file BLI_string_utf8.h.
| const char const char * BLI_str_find_next_char_utf8 | ( | const char * | p, |
| const char * | str_end ) |
| p | a pointer to a position within a UTF8 encoded string |
| str_end | a pointer to the byte following the end of the string. |
Finds the start of the next UTF8 character in the string after p
p does not have to be at the beginning of a UTF8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.
References ATTR_RETURNS_NONNULL, and ATTR_WARN_UNUSED_RESULT.
Referenced by BLI_str_cursor_step_next_utf8(), ui_text_clip_give_next_off(), and ui_text_position_from_hidden().
| const char * BLI_str_find_prev_char_utf8 | ( | const char * | p, |
| const char * | str_start ) |
BLI_str_find_prev_char_utf8:
| p | pointer to some position within str |
| str_start | pointer to the beginning of a UTF8 encoded string |
Given a position p with a UTF8 encoded string str, find the start of the previous UTF8 character starting before. p Returns str_start if no UTF8 characters are present in str_start before p.
p does not have to be at the beginning of a UTF8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.
References ATTR_RETURNS_NONNULL, and ATTR_WARN_UNUSED_RESULT.
Referenced by blf_font_width_to_rstrlen(), BLI_str_cursor_step_prev_utf8(), draw_brackets(), blender::nodes::geo_eval_log::StringLog::StringLog(), text_delete_exec(), txt_wrap_move_eol(), ui_text_clip_cursor(), ui_text_clip_give_prev_off(), ui_text_clip_right_label(), and unit_find_str().
| size_t size_t size_t BLI_str_partition_ex_utf8 | ( | const char * | str, |
| const char * | end, | ||
| const unsigned int | delim[], | ||
| const char ** | r_sep, | ||
| const char ** | r_suf, | ||
| bool | from_right ) |
References ATTR_NONNULL, ATTR_WARN_UNUSED_RESULT, BLI_str_partition_ex_utf8(), BLI_str_utf8_offset_from_column(), BLI_str_utf8_offset_from_column_with_tabs(), BLI_str_utf8_offset_from_index(), BLI_str_utf8_offset_to_column(), BLI_str_utf8_offset_to_column_with_tabs(), BLI_str_utf8_offset_to_index(), BLI_str_utf8_truncate_at_size(), and str.
Referenced by BLI_str_partition_ex_utf8(), blender::ed::space_node::node_select_grouped_name(), and TEST().
| size_t BLI_str_partition_utf8 | ( | const char * | str, |
| const unsigned int | delim[], | ||
| const char ** | r_sep, | ||
| const char ** | r_suf ) |
References ATTR_NONNULL, BLI_str_partition_utf8(), and str.
Referenced by BLI_str_partition_utf8(), and TEST().
| size_t size_t BLI_str_rpartition_utf8 | ( | const char * | str, |
| const unsigned int | delim[], | ||
| const char ** | r_sep, | ||
| const char ** | r_suf ) |
References ATTR_NONNULL, BLI_str_rpartition_utf8(), and str.
Referenced by BLI_str_rpartition_utf8(), and TEST().
| size_t size_t BLI_str_utf32_as_utf8 | ( | char *__restrict | dst, |
| const char32_t *__restrict | src, | ||
| size_t | dst_maxncpy ) |
| size_t BLI_str_utf32_as_utf8_len | ( | const char32_t * | src | ) |
Definition at line 1156 of file string_utf8.cc.
References BLI_str_utf8_from_unicode_len(), and len.
Referenced by BKE_vfont_clipboard_set(), and ED_curve_editfont_load().
| size_t size_t size_t BLI_str_utf32_as_utf8_len_ex | ( | const char32_t * | src, |
| size_t | src_maxlen ) |
Definition at line 1144 of file string_utf8.cc.
References BLI_str_utf8_from_unicode_len(), and len.
Referenced by font_select_to_buffer().
| bool BLI_str_utf32_char_is_breaking_space | ( | char32_t | codepoint | ) |
Definition at line 826 of file string_utf8.cc.
References ELEM.
Referenced by blf_font_wrap_apply(), BLI_str_utf32_char_is_optional_break_after(), BLI_str_utf32_char_is_optional_break_before(), and BLI_strncpy_wchar_from_utf8().
| bool BLI_str_utf32_char_is_optional_break_after | ( | char32_t | codepoint, |
| char32_t | codepoint_prev ) |
Definition at line 848 of file string_utf8.cc.
References BLI_str_utf32_char_is_breaking_space(), and ELEM.
Referenced by blf_font_wrap_apply(), and BLI_strncpy_wchar_from_utf8().
| bool BLI_str_utf32_char_is_optional_break_before | ( | char32_t | codepoint, |
| char32_t | codepoint_prev ) |
Definition at line 889 of file string_utf8.cc.
References BLI_str_utf32_char_is_breaking_space(), and ELEM.
Referenced by blf_font_wrap_apply(), and BLI_strncpy_wchar_from_utf8().
| char32_t BLI_str_utf32_char_to_lower | ( | char32_t | wc | ) |
Return the lowercase of a 32-bit character or the character when no case change is needed.
Definition at line 713 of file string_utf8.cc.
References ARRAY_SIZE, max, min, and U.
Referenced by BLI_strncpy_wchar_from_utf8(), and set_case().
| char32_t BLI_str_utf32_char_to_upper | ( | char32_t | wc | ) |
Return the uppercase of a 32-bit character or the character when no case change is needed.
Definition at line 602 of file string_utf8.cc.
References ARRAY_SIZE, max, min, and U.
Referenced by BLI_strncpy_wchar_from_utf8(), and set_case().
| unsigned int BLI_str_utf8_as_unicode_or_error | ( | const char * | p | ) |
| p | a pointer to Unicode character encoded as UTF8 |
Converts a sequence of bytes encoded as UTF8 to a Unicode character. If p does not point to a valid UTF8 encoded character, results are undefined. If you are not sure that the bytes are complete valid Unicode characters, you should use g_utf8_get_char_validated() instead.
Return value: the resulting character
Definition at line 966 of file string_utf8.cc.
References BLI_UTF8_ERR, len, mask(), UNLIKELY, utf8_char_compute_skip_or_error_with_mask(), and utf8_char_decode().
Referenced by BLI_str_partition_ex_utf8(), BLI_str_utf8_as_unicode_safe(), BLI_str_utf8_char_width_or_error(), BLI_str_utf8_char_width_safe(), insert_text_invoke(), key_event_glyph_or_text(), text_autocomplete_build(), and text_insert_invoke().
| unsigned int BLI_str_utf8_as_unicode_safe | ( | const char * | p | ) |
Definition at line 980 of file string_utf8.cc.
References BLI_str_utf8_as_unicode_or_error(), BLI_UTF8_ERR, result, and UNLIKELY.
Referenced by blf_font_glyph_advance(), blf_font_wrap_apply(), blender::string_search::extract_normalized_words(), and blender::string_search::get_fuzzy_match_errors().
| unsigned int unsigned int BLI_str_utf8_as_unicode_step_or_error | ( | const char *__restrict | p, |
| size_t | p_len, | ||
| size_t *__restrict | index ) |
UTF8 decoding that steps over the index (unless an error is encountered).
| p | The text to step over. |
| p_len | The length of p. |
| index | Index of p to step over. |
References ATTR_WARN_UNUSED_RESULT.
Referenced by cursor_delim_type_utf8().
| unsigned int BLI_str_utf8_as_unicode_step_safe | ( | const char *__restrict | p, |
| size_t | p_len, | ||
| size_t *__restrict | index ) |
UTF8 decoding that steps over the index. When an error is encountered fall back to LATIN1, stepping over a single byte.
| p | The text to step over. |
| p_len | The length of p. |
| index | Index of p to step over. |
References ATTR_WARN_UNUSED_RESULT.
Referenced by blf_glyph_from_utf8_and_step(), blender::string_search::damerau_levenshtein_distance(), blender::string_search::extract_normalized_words(), blender::string_search::match_word_initials(), text_autocomplete_build(), text_insert_exec(), txt_insert_buf(), txt_replace_char(), and utf8_as_char32().
| size_t BLI_str_utf8_as_utf32 | ( | char32_t *__restrict | dst_w, |
| const char *__restrict | src_c, | ||
| size_t | dst_w_maxncpy ) |
| int BLI_str_utf8_char_width_or_error | ( | const char * | p | ) |
Definition at line 572 of file string_utf8.cc.
References BLI_str_utf8_as_unicode_or_error(), BLI_UTF8_ERR, and BLI_wcwidth_or_error().
Referenced by blf_str_offset_from_cursor_position(), BLI_str_cursor_step_next_utf8(), BLI_str_cursor_step_prev_utf8(), and BLI_strncpy_wchar_from_utf8().
| int BLI_str_utf8_char_width_safe | ( | const char * | p | ) |
Definition at line 582 of file string_utf8.cc.
References BLI_str_utf8_as_unicode_or_error(), BLI_UTF8_ERR, and BLI_wcwidth_safe().
Referenced by BLI_strncpy_wchar_from_utf8(), console_cursor_wrap_offset(), flatten_column_to_offset(), flatten_width(), space_text_cursor_set_to_pos_wrapped(), space_text_draw(), space_text_draw_wrapped(), space_text_get_char_pos(), space_text_get_cursor_rel(), space_text_get_visible_lines(), space_text_wrap_offset_in_line(), textview_wrap_offsets(), txt_utf8_forward_columns(), txt_wrap_move_bol(), txt_wrap_move_eol(), and while().
| size_t BLI_str_utf8_from_unicode | ( | unsigned int | c, |
| char * | dst, | ||
| size_t | dst_maxncpy ) |
BLI_str_utf8_from_unicode:
| c | a Unicode character code |
| dst | output buffer, must have at least dst_maxncpy bytes of space. If the length required by c exceeds dst_maxncpy, the bytes available bytes will be zeroed and dst_maxncpy returned. |
Converts a single character to UTF8.
Definition at line 1067 of file string_utf8.cc.
References BLI_string_debug_size, i, len, UNLIKELY, and UTF8_VARS_FROM_CHAR32.
Referenced by BLI_str_utf32_as_utf8(), BLI_strncpy_wchar_as_utf8(), find_family_object(), blender::io::usd::make_safe_name(), txt_add_char_intern(), txt_extended_ascii_as_utf8(), txt_replace_char(), and wm_event_add_ghostevent().
Definition at line 1055 of file string_utf8.cc.
References len, and UTF8_VARS_FROM_CHAR32.
Referenced by blf_font_wrap_apply(), BLI_str_utf32_as_utf8_len(), BLI_str_utf32_as_utf8_len_ex(), BLI_wstrlen_utf8(), and text_insert_invoke().
| ptrdiff_t BLI_str_utf8_invalid_byte | ( | const char * | str, |
| size_t | str_len ) |
Find first UTF8 invalid byte in given str, of str_len bytes.
Definition at line 150 of file string_utf8.cc.
References ELEM, str, and utf8_char_compute_skip().
Referenced by blender::string_search::StringSearchBase::add_impl(), blf_str_is_utf8_valid_lazy_init(), BLI_str_utf8_invalid_strip(), BLI_str_utf8_invalid_substitute(), BLI_str_utf8_invalid_substitute_as_needed(), blender::StringRefBase::copy_utf8_truncated(), blender::nodes::node_geo_import_text::node_geo_exec(), TEST(), txt_extended_ascii_as_utf8(), and UI_text_clip_middle_ex().
| int BLI_str_utf8_invalid_strip | ( | char * | str, |
| size_t | str_len ) |
Remove any invalid UTF8 byte (taking into account multi-bytes sequences).
| str | a null terminated string. |
| str_len | the result of strlen(str). |
Definition at line 285 of file string_utf8.cc.
References BLI_assert, BLI_str_utf8_invalid_byte(), and str.
Referenced by BKE_id_new_name_validate(), BKE_vfontdata_from_freetypefont(), blo_do_versions_450(), blender::seq::edit_strip_name_set(), id_name_final_build(), outputNumInput(), TEST(), ui_textedit_end(), and wm_clipboard_text_get_ex().
| int BLI_str_utf8_invalid_substitute | ( | char * | str, |
| size_t | str_len, | ||
| const char | substitute ) |
Substitute any invalid UTF8 byte with substitute (taking into account multi-bytes sequences). The length of the string remains unchanged.
| str | a null terminated string. |
| str_len | the result of strlen(str). |
Definition at line 310 of file string_utf8.cc.
References BLI_assert, BLI_str_utf8_invalid_byte(), and str.
Referenced by BLI_str_utf8_invalid_substitute_as_needed(), and TEST().
|
nodiscard |
A utility for BLI_str_utf8_invalid_substitute that returns str when it contains a valid UTF8 string. Otherwise it is copied into buf with invalid byte sequences substituted for substitute.
References ATTR_WARN_UNUSED_RESULT, and str.
Referenced by WM_window_title().
| int BLI_str_utf8_offset_from_column | ( | const char * | str, |
| size_t | str_len, | ||
| int | column_target ) |
Definition at line 1324 of file string_utf8.cc.
References BLI_str_utf8_as_unicode_step_safe(), BLI_wcwidth_safe(), and str.
Referenced by BLI_str_partition_ex_utf8().
| int BLI_str_utf8_offset_from_column_with_tabs | ( | const char * | str, |
| size_t | str_len, | ||
| int | column_target, | ||
| int | tab_width ) |
Definition at line 1357 of file string_utf8.cc.
References BLI_str_utf8_as_unicode_step_safe(), BLI_wcwidth_safe(), and str.
Referenced by BLI_str_partition_ex_utf8(), text_convert_whitespace_exec(), textview_draw_string(), txt_move_down(), txt_move_up(), and txt_wrap_move_bol().
| int BLI_str_utf8_offset_from_index | ( | const char * | str, |
| size_t | str_len, | ||
| int | index_target ) |
Return the byte offset in str from index_target.
| index_target | The unicode index, where multi-byte characters are counted once. There is no need to clamp this value, the index is logically clamped to BLI_strlen_utf8(str) or below. |
Definition at line 1296 of file string_utf8.cc.
References BLI_assert, BLI_str_utf8_as_unicode_step_safe(), str, and UNUSED_VARS.
Referenced by BLI_str_partition_ex_utf8(), ED_space_text_region_location_from_cursor(), blender::nodes::node_geo_string_to_curves_cc::get_text_layout(), blender::nodes::node_fn_slice_string_cc::node_build_multi_function(), TEST(), and txt_sel_set().
| int BLI_str_utf8_offset_to_column | ( | const char * | str, |
| size_t | str_len, | ||
| int | offset_target ) |
Definition at line 1310 of file string_utf8.cc.
References BLI_assert, BLI_str_utf8_as_unicode_step_safe(), BLI_wcwidth_safe(), and str.
Referenced by BLI_str_partition_ex_utf8(), and space_text_wrap_offset_in_line().
| int BLI_str_utf8_offset_to_column_with_tabs | ( | const char * | str, |
| size_t | str_len, | ||
| int | offset_target, | ||
| int | tab_width ) |
Definition at line 1339 of file string_utf8.cc.
References BLI_assert, BLI_str_utf8_as_unicode_step_safe(), BLI_wcwidth_safe(), and str.
Referenced by BLI_str_partition_ex_utf8(), text_convert_whitespace_exec(), textview_draw_sel(), txt_move_down(), and txt_move_up().
| int BLI_str_utf8_offset_to_index | ( | const char * | str, |
| size_t | str_len, | ||
| int | offset_target ) |
Definition at line 1279 of file string_utf8.cc.
References BLI_assert, BLI_str_utf8_as_unicode_step_safe(), str, and UNUSED_VARS.
Referenced by BLI_str_partition_ex_utf8(), draw_brackets(), and text_jump_to_file_at_point_exec().
| const char int BLI_str_utf8_size_or_error | ( | const char * | p | ) |
Definition at line 956 of file string_utf8.cc.
References utf8_char_compute_skip_or_error().
Referenced by handleNumInput(), ui_do_but_textedit(), ui_handle_menu_letter_press_search(), wm_event_add_ghostevent(), WM_event_print(), and WM_event_utf8_to_ascii().
| int BLI_str_utf8_size_safe | ( | const char * | p | ) |
Use when we want to skip errors.
Definition at line 961 of file string_utf8.cc.
References utf8_char_compute_skip().
Referenced by BLI_strlen_utf8_ex(), BLI_strnlen_utf8_ex(), blender::seq::build_character_info(), console_cursor_wrap_offset(), console_indent_or_autocomplete_exec(), console_insert_invoke(), draw_brackets(), flatten_column_to_offset(), flatten_string(), flatten_width(), blender::string_search::get_fuzzy_match_errors(), blender::ed::vse::sequencer_text_insert_invoke(), space_text_cursor_set_to_pos_wrapped(), space_text_draw(), space_text_draw_wrapped(), space_text_get_char_pos(), space_text_get_cursor_rel(), space_text_get_visible_lines(), space_text_wrap_offset_in_line(), text_convert_whitespace_exec(), text_font_draw_character_utf8(), text_format_fill(), text_insert_invoke(), textview_wrap_offsets(), txt_utf8_forward_columns(), txt_wrap_move_bol(), txt_wrap_move_eol(), txtfmt_glsl_format_line(), txtfmt_osl_format_line(), txtfmt_pov_format_line(), txtfmt_pov_ini_format_line(), txtfmt_py_format_line(), ui_text_clip_cursor(), and while().
| size_t size_t size_t bool BLI_str_utf8_truncate_at_size | ( | char * | str, |
| const size_t | str_size ) |
Ensure that str has a null byte in the range of [0..str_size], while not generating any invalid UTF-8 code. The resulting strlen(str) is guaranteed to be less than str_size.
Definition at line 1256 of file string_utf8.cc.
References BLI_assert, BLI_strnlen_utf8_ex(), and str.
Referenced by BLI_str_partition_ex_utf8(), bone_autoside_name(), long_id_names_process_action_slots_identifiers(), and read_id_struct().
| size_t BLI_strlen_utf8 | ( | const char * | strc | ) |
Definition at line 492 of file string_utf8.cc.
References BLI_strlen_utf8_ex().
Referenced by blo_do_versions_260(), blender::seq::calc_text_runtime(), insert_text_exec(), key_event_glyph_or_text(), blender::nodes::node_fn_string_length_cc::node_build_multi_function(), radial_control_paint_cursor(), TEST(), txt_sel_set(), ui_but_text_password_hide(), and blender::ed::object::voxel_size_edit_draw().
| size_t BLI_strlen_utf8_ex | ( | const char * | strc, |
| size_t * | r_len_bytes ) |
References BLI_strlen_utf8_ex().
Referenced by BKE_curve_init(), BLI_strlen_utf8_ex(), curve_blend_read_data(), blender::nodes::node_geo_string_to_curves_cc::get_text_layout(), and txt_add_object().
| char * BLI_strncpy_utf8 | ( | char *__restrict | dst, |
| const char *__restrict | src, | ||
| size_t | dst_maxncpy ) |
Referenced by acf_filldrivers_name(), acf_generic_idblock_name(), acf_nla_controls_name(), acf_summary_name(), BKE_preferences_extension_remote_to_name(), blender::animrig::versioning::convert_legacy_action_assignments(), CustomData_validate_layer_name(), blender::seq::edit_strip_name_set(), fileselect_ensure_updated_file_params(), blender::animrig::generic_assign_action_slot(), node_blend_label(), node_filter_label(), blender::nodes::node_fn_boolean_math_cc::node_label(), blender::nodes::node_fn_compare_cc::node_label(), blender::nodes::node_fn_float_to_int_cc::node_label(), blender::nodes::node_fn_match_string_cc::node_label(), blender::nodes::node_geo_closure_cc::input_node::node_label(), blender::nodes::node_geo_foreach_geometry_element_cc::input_node::node_label(), blender::nodes::node_geo_repeat_cc::repeat_input_node::node_label(), blender::nodes::node_geo_simulation_cc::sim_input_node::node_label(), blender::nodes::node_geo_warning_cc::node_label(), blender::nodes::node_composite_mask_cc::node_mask_label(), node_math_label(), node_vector_math_label(), pyrna_py_to_prop(), blender::nodes::node_sh_mix_cc::sh_node_mix_label(), blender::animrig::Action::slot_add(), blender::animrig::Action::slot_add_for_id_type(), blender::animrig::Action::slot_display_name_define(), ui_but_string_get_ex(), ui_but_string_set(), blender::ed::space_node::ui_node_sock_name(), and ui_textedit_string_set().
| char size_t BLI_strncpy_utf8_rlen | ( | char *__restrict | dst, |
| const char *__restrict | src, | ||
| size_t | dst_maxncpy ) |
References ATTR_WARN_UNUSED_RESULT, and str.
Referenced by BLI_uniquename_cb().
| char size_t size_t BLI_strncpy_utf8_rlen_unterminated | ( | char *__restrict | dst, |
| const char *__restrict | src, | ||
| size_t | dst_maxncpy ) |
A version of BLI_strncpy_utf8_rlen that doesn't null terminate the string.
Definition at line 422 of file string_utf8.cc.
References BLI_string_debug_size, and str_utf8_copy_max_bytes_impl().
Referenced by blender::StringRefBase::copy_utf8_truncated().
| size_t BLI_strncpy_wchar_as_utf8 | ( | char *__restrict | dst, |
| const wchar_t *__restrict | src, | ||
| size_t | dst_maxncpy ) |
References ATTR_NONNULL, and BLI_strncpy_wchar_as_utf8().
Referenced by BKE_appdir_font_folder_default(), BLI_current_working_dir(), and BLI_strncpy_wchar_as_utf8().
| size_t size_t BLI_strncpy_wchar_from_utf8 | ( | wchar_t *__restrict | dst_w, |
| const char *__restrict | src_c, | ||
| size_t | dst_w_maxncpy ) |
References ATTR_NONNULL, ATTR_WARN_UNUSED_RESULT, BLI_str_utf32_char_is_breaking_space(), BLI_str_utf32_char_is_optional_break_after(), BLI_str_utf32_char_is_optional_break_before(), BLI_str_utf32_char_to_lower(), BLI_str_utf32_char_to_upper(), BLI_str_utf8_char_width_or_error(), BLI_str_utf8_char_width_safe(), BLI_strncpy_wchar_from_utf8(), BLI_wcswidth_or_error(), BLI_wcwidth_or_error(), and BLI_wcwidth_safe().
Referenced by BLI_strncpy_wchar_from_utf8().
| size_t size_t BLI_strnlen_utf8 | ( | const char * | strc, |
| size_t | strc_maxlen ) |
| strc | the string to measure the length. |
| strc_maxlen | the string length (in bytes) |
Definition at line 526 of file string_utf8.cc.
References BLI_strnlen_utf8_ex().
Referenced by BLI_strnlen_utf8_ex(), blender::string_search::count_utf8_code_points(), space_text_draw_wrapped(), TEST(), and ui_text_position_to_hidden().
| size_t BLI_strnlen_utf8_ex | ( | const char * | strc, |
| size_t | strc_maxlen, | ||
| size_t * | r_len_bytes ) |
| int BLI_wcswidth_or_error | ( | const char32_t * | pwcs, |
| size_t | n ) |
Definition at line 567 of file string_utf8.cc.
Referenced by BLI_strncpy_wchar_from_utf8().
| size_t size_t int BLI_wcwidth_or_error | ( | char32_t | ucs | ) |
Count columns that character/string occupies (based on wcwidth.co).
Definition at line 549 of file string_utf8.cc.
Referenced by blf_glyph_render(), BLI_str_cursor_step_next_utf32(), BLI_str_cursor_step_prev_utf32(), BLI_str_utf8_char_width_or_error(), BLI_strncpy_wchar_from_utf8(), and BLI_wcwidth_safe().
| int BLI_wcwidth_safe | ( | char32_t | ucs | ) |
Definition at line 558 of file string_utf8.cc.
References BLI_wcwidth_or_error().
Referenced by blf_font_draw_mono(), BLI_str_utf8_char_width_safe(), BLI_str_utf8_offset_from_column(), BLI_str_utf8_offset_from_column_with_tabs(), BLI_str_utf8_offset_to_column(), BLI_str_utf8_offset_to_column_with_tabs(), and BLI_strncpy_wchar_from_utf8().
| const char const char size_t BLI_wstrlen_utf8 | ( | const wchar_t * | src | ) |
Definition at line 456 of file string_utf8.cc.
References BLI_str_utf8_from_unicode_len(), and len.
| size_t ATTR_WARN_UNUSED_RESULT |
Definition at line 184 of file BLI_string_utf8.h.