Blender
V3.3
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "BLI_dynstr.h"
#include "BLI_memarena.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
Go to the source code of this file.
Classes | |
struct | DynStrElem |
struct | DynStr |
Macros | |
#define | va_copy(a, b) ((a) = (b)) |
Typedefs | |
typedef struct DynStrElem | DynStrElem |
Functions | |
DynStr * | BLI_dynstr_new (void) |
DynStr * | BLI_dynstr_new_memarena (void) |
BLI_INLINE void * | dynstr_alloc (DynStr *__restrict ds, size_t size) |
void | BLI_dynstr_append (DynStr *__restrict ds, const char *cstr) |
void | BLI_dynstr_nappend (DynStr *__restrict ds, const char *cstr, int len) |
void | BLI_dynstr_vappendf (DynStr *__restrict ds, const char *__restrict format, va_list args) |
void | BLI_dynstr_appendf (DynStr *__restrict ds, const char *__restrict format,...) |
int | BLI_dynstr_get_len (const DynStr *ds) |
void | BLI_dynstr_get_cstring_ex (const DynStr *__restrict ds, char *__restrict rets) |
char * | BLI_dynstr_get_cstring (const DynStr *ds) |
void | BLI_dynstr_clear (DynStr *ds) |
void | BLI_dynstr_free (DynStr *ds) |
Dynamically sized string ADT.
Definition in file BLI_dynstr.c.
#define va_copy | ( | a, | |
b | |||
) | ((a) = (b)) |
Definition at line 29 of file BLI_dynstr.c.
typedef struct DynStrElem DynStrElem |
Definition at line 1 of file BLI_dynstr.c.
Append a c-string to a DynStr.
ds | The DynStr to append to. |
cstr | The c-string to append. |
Definition at line 75 of file BLI_dynstr.c.
References dynstr_alloc(), DynStrElem::next, NULL, and DynStrElem::str.
Referenced by BKE_cryptomatte_entries_to_matte_id(), BKE_mesh_debug_info(), BKE_reports_prepend(), BKE_reports_prependf(), BLI_dynstr_appendf(), BLI_dynstr_vappendf(), BLI_str_replaceN(), BM_mesh_debug_info(), console_copy_exec(), blender::gpu::create_key(), DRW_shader_library_create_shader_string(), eevee_get_defines(), EEVEE_shaders_cryptomatte_sh_get(), EEVEE_shaders_depth_of_field_gather_get(), EEVEE_shaders_depth_of_field_resolve_get(), EEVEE_shaders_depth_of_field_scatter_get(), get_rna_access(), make(), Matrix_str(), menu_items_from_ui_create(), mesh_debug_info_from_cd_flag(), outliner_orphans_purge_invoke(), blender::gpu::Shader::print_log(), report_copy_exec(), rna_array_as_string_recursive(), RNA_path_append(), rna_path_rename_fix(), RNA_pointer_as_string_id(), RNA_property_as_string(), RNA_struct_available_or_report(), ui_layout_introspect_items(), Vector_str(), WM_operator_pystring_ex(), and wm_platform_support_create_link().
Definition at line 173 of file BLI_dynstr.c.
References BLI_dynstr_append(), len, MEM_callocN, MEM_freeN, and NULL.
Clear the DynStr
ds | The DynStr to clear. |
Definition at line 263 of file BLI_dynstr.c.
References BLI_memarena_clear(), DynStr::curlen, DynStr::elems, free(), DynStr::last, DynStr::memarena, DynStrElem::next, and NULL.
Referenced by BLI_dynstr_free(), clear(), and menu_items_from_ui_create().
Free the DynStr
ds | The DynStr to free. |
Definition at line 281 of file BLI_dynstr.c.
References BLI_dynstr_clear(), BLI_memarena_free(), MEM_freeN, and DynStr::memarena.
Referenced by BKE_cryptomatte_entries_to_matte_id(), BKE_mesh_debug_info(), BKE_reportf(), BKE_reports_prepend(), BKE_reports_prependf(), BKE_reports_string(), BLI_sprintfN(), BLI_str_replaceN(), BM_mesh_debug_info(), bmp_slots_as_args(), console_copy_exec(), blender::gpu::create_gpu_name(), blender::gpu::create_key(), DRW_shader_library_create_shader_string(), eevee_get_defines(), EEVEE_shaders_cryptomatte_sh_get(), EEVEE_shaders_depth_of_field_gather_get(), EEVEE_shaders_depth_of_field_resolve_get(), EEVEE_shaders_depth_of_field_scatter_get(), get_keyframe_values_create_reports(), get_rna_access(), IDP_reprN(), make(), mathutils_dynstr_to_py(), menu_items_from_ui_create(), outliner_orphans_purge_invoke(), blender::gpu::Shader::print_log(), pyrna_enum_repr(), pyrna_func_call(), report_copy_exec(), rna_idp_path_create(), RNA_path_append(), rna_path_rename_fix(), RNA_pointer_as_string_id(), RNA_pointer_as_string_keywords_ex(), RNA_property_as_string(), RNA_struct_available_or_report(), studiolight_write_solid_light(), UI_layout_introspect(), WM_operator_pystring_ex(), wm_platform_support_create_link(), and WM_reportf().
char* BLI_dynstr_get_cstring | ( | const DynStr * | ds | ) |
Get a DynStr's contents as a c-string.
ds | The DynStr of interest. |
Definition at line 256 of file BLI_dynstr.c.
References BLI_dynstr_get_cstring_ex(), DynStr::curlen, and MEM_mallocN.
Referenced by BKE_cryptomatte_entries_to_matte_id(), BKE_mesh_debug_info(), BKE_reportf(), BKE_reports_prepend(), BKE_reports_prependf(), BKE_reports_string(), BLI_sprintfN(), BLI_str_replaceN(), BM_mesh_debug_info(), bmp_slots_as_args(), console_copy_exec(), blender::gpu::create_gpu_name(), blender::gpu::create_key(), DRW_shader_library_create_shader_string(), eevee_get_defines(), EEVEE_shaders_cryptomatte_sh_get(), EEVEE_shaders_depth_of_field_gather_get(), EEVEE_shaders_depth_of_field_resolve_get(), EEVEE_shaders_depth_of_field_scatter_get(), get_keyframe_values_create_reports(), get_rna_access(), IDP_reprN(), outliner_orphans_purge_invoke(), blender::gpu::Shader::print_log(), pyrna_enum_repr(), pyrna_func_call(), report_copy_exec(), rna_idp_path_create(), RNA_path_append(), rna_path_rename_fix(), RNA_pointer_as_string_id(), RNA_pointer_as_string_keywords_ex(), RNA_property_as_string(), RNA_struct_available_or_report(), studiolight_write_solid_light(), UI_layout_introspect(), WM_operator_pystring_ex(), and WM_reportf().
Get a DynStr's contents as a c-string. The rets argument must be allocated to be at least the size of BLI_dynstr_get_len(ds) + 1
.
ds | The DynStr of interest. |
rets | The string to fill. |
Definition at line 240 of file BLI_dynstr.c.
References BLI_assert, DynStrElem::next, and DynStrElem::str.
Referenced by add(), BLI_dynstr_get_cstring(), mathutils_dynstr_to_py(), strdup_memarena_from_dynstr(), and wm_platform_support_create_link().
int BLI_dynstr_get_len | ( | const DynStr * | ds | ) |
Find the length of a DynStr.
ds | The DynStr of interest. |
Definition at line 235 of file BLI_dynstr.c.
References DynStr::curlen.
Referenced by add(), BKE_reportf(), BKE_reports_prepend(), BKE_reports_prependf(), BKE_reports_string(), console_copy_exec(), IDP_reprN(), make(), mathutils_dynstr_to_py(), menu_items_from_ui_create(), strdup_memarena_from_dynstr(), studiolight_write_solid_light(), and wm_platform_support_create_link().
Append a length clamped c-string to a DynStr.
ds | The DynStr to append to. |
cstr | The c-string to append. |
len | The maximum length of the c-string to copy. |
Definition at line 94 of file BLI_dynstr.c.
References BLI_strnlen(), dynstr_alloc(), len, DynStrElem::next, NULL, and DynStrElem::str.
Referenced by BKE_cryptomatte_entries_to_matte_id(), BLI_str_replaceN(), console_copy_exec(), menu_items_from_ui_create(), blender::gpu::Shader::print_log(), repr_str(), and rna_path_rename_fix().
Create a new DynStr.
Definition at line 50 of file BLI_dynstr.c.
References DynStr::curlen, DynStr::elems, DynStr::last, MEM_mallocN, DynStr::memarena, and NULL.
Referenced by BKE_cryptomatte_entries_to_matte_id(), BKE_mesh_debug_info(), BKE_reportf(), BKE_reports_prepend(), BKE_reports_prependf(), BKE_reports_string(), BLI_sprintfN(), BLI_str_replaceN(), BM_mesh_debug_info(), bmp_slots_as_args(), Color_str(), console_copy_exec(), blender::gpu::create_gpu_name(), blender::gpu::create_key(), DRW_shader_library_create_shader_string(), eevee_get_defines(), EEVEE_shaders_cryptomatte_sh_get(), EEVEE_shaders_depth_of_field_gather_get(), EEVEE_shaders_depth_of_field_resolve_get(), EEVEE_shaders_depth_of_field_scatter_get(), Euler_str(), get_keyframe_values_create_reports(), get_rna_access(), IDP_reprN(), Matrix_str(), outliner_orphans_purge_invoke(), blender::gpu::Shader::print_log(), pyrna_enum_repr(), pyrna_func_call(), Quaternion_str(), report_copy_exec(), rna_idp_path_create(), RNA_path_append(), rna_path_rename_fix(), RNA_pointer_as_string_id(), RNA_pointer_as_string_keywords_ex(), RNA_property_as_string(), RNA_struct_available_or_report(), studiolight_write_solid_light(), UI_layout_introspect(), Vector_str(), WM_operator_pystring_ex(), wm_platform_support_create_link(), and WM_reportf().
Create a new DynStr.
Definition at line 60 of file BLI_dynstr.c.
References BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, DynStr::curlen, DynStr::elems, DynStr::last, MEM_mallocN, DynStr::memarena, and NULL.
Referenced by make(), and menu_items_from_ui_create().
Definition at line 114 of file BLI_dynstr.c.
References BLI_dynstr_append(), len, MEM_callocN, MEM_freeN, NULL, and va_copy.
BLI_INLINE void* dynstr_alloc | ( | DynStr *__restrict | ds, |
size_t | size | ||
) |
Definition at line 70 of file BLI_dynstr.c.
References BLI_memarena_alloc(), and size().
Referenced by BLI_dynstr_append(), and BLI_dynstr_nappend().