Blender  V3.3
Classes | Macros
idprop_utils.c File Reference
#include <stdio.h>
#include <string.h>
#include "BLI_dynstr.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_ID.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
#include "MEM_guardedalloc.h"
#include "BLI_strict_flags.h"

Go to the source code of this file.

Classes

struct  ReprState
 

Macros

#define STR_APPEND_STR(str)   state->str_append_fn(state->user_data, str, (uint)strlen(str))
 
#define STR_APPEND_STR_QUOTE(str)   idp_str_append_escape(state, str, (uint)strlen(str), true)
 
#define STR_APPEND_STR_LEN_QUOTE(str, str_len)   idp_str_append_escape(state, str, str_len, true)
 
#define STR_APPEND_FMT(format, ...)
 

Functions

IDProp Repr

Convert an IDProperty to a string.

Output should be a valid Python literal (with minor exceptions - float nan for eg).

static void idp_str_append_escape (struct ReprState *state, const char *str, const uint str_len, bool quote)
 
static void idp_repr_fn_recursive (struct ReprState *state, const IDProperty *prop)
 
void IDP_repr_fn (const IDProperty *prop, void(*str_append_fn)(void *user_data, const char *str, uint str_len), void *user_data)
 
static void repr_str (void *user_data, const char *str, uint len)
 
char * IDP_reprN (const IDProperty *prop, uint *r_len)
 
void IDP_print (const IDProperty *prop)
 

Macro Definition Documentation

◆ STR_APPEND_FMT

#define STR_APPEND_FMT (   format,
  ... 
)
Value:
state->str_append_fn( \
state->user_data, \
state->buf, \
(uint)BLI_snprintf_rlen(state->buf, sizeof(state->buf), format, __VA_ARGS__))
size_t BLI_snprintf_rlen(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned int uint
Definition: BLI_sys_types.h:67
const int state
format
Definition: logImageCore.h:38

◆ STR_APPEND_STR

#define STR_APPEND_STR (   str)    state->str_append_fn(state->user_data, str, (uint)strlen(str))

◆ STR_APPEND_STR_LEN_QUOTE

#define STR_APPEND_STR_LEN_QUOTE (   str,
  str_len 
)    idp_str_append_escape(state, str, str_len, true)

◆ STR_APPEND_STR_QUOTE

#define STR_APPEND_STR_QUOTE (   str)    idp_str_append_escape(state, str, (uint)strlen(str), true)

Function Documentation

◆ IDP_print()

void IDP_print ( const IDProperty prop)

Definition at line 223 of file idprop_utils.c.

References IDP_reprN(), MEM_freeN, and NULL.

◆ IDP_repr_fn()

void IDP_repr_fn ( const IDProperty prop,
void(*)(void *user_data, const char *str, uint str_len)  str_append_fn,
void user_data 
)

Definition at line 195 of file idprop_utils.c.

References idp_repr_fn_recursive(), state, ReprState::str_append_fn, and user_data.

Referenced by IDP_reprN().

◆ idp_repr_fn_recursive()

static void idp_repr_fn_recursive ( struct ReprState state,
const IDProperty prop 
)
static

◆ IDP_reprN()

char* IDP_reprN ( const IDProperty prop,
uint r_len 
)

◆ idp_str_append_escape()

static void idp_str_append_escape ( struct ReprState state,
const char *  str,
const uint  str_len,
bool  quote 
)
static

Definition at line 40 of file idprop_utils.c.

References BLI_assert, BLI_snprintf_rlen(), Freestyle::c, len, state, and str.

◆ repr_str()

static void repr_str ( void user_data,
const char *  str,
uint  len 
)
static

Definition at line 206 of file idprop_utils.c.

References BLI_dynstr_nappend(), len, str, and user_data.

Referenced by IDP_reprN().