Blender V4.3
idprop_utils.cc File Reference
#include <algorithm>
#include <cstdio>
#include <cstring>
#include "BLI_dynstr.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_ID.h"
#include "BKE_idprop.hh"
#include "BKE_idtype.hh"
#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 (ReprState *state, const char *str, const uint str_len, bool quote)
 
static void idp_repr_fn_recursive (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)
 
const char * IDP_type_str (const eIDPropertyType type, const short sub_type)
 
const char * IDP_type_str (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(SNPRINTF_RLEN(state->buf, format, __VA_ARGS__)))
#define SNPRINTF_RLEN(dst, format,...)
Definition BLI_string.h:598
unsigned int uint
format
static ulong state[N]

Referenced by idp_repr_fn_recursive().

◆ STR_APPEND_STR

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

Referenced by idp_repr_fn_recursive().

◆ STR_APPEND_STR_LEN_QUOTE

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

Referenced by idp_repr_fn_recursive().

◆ STR_APPEND_STR_QUOTE

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

Referenced by idp_repr_fn_recursive().

Function Documentation

◆ IDP_print()

void IDP_print ( const IDProperty * prop)

◆ IDP_repr_fn()

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

Definition at line 230 of file idprop_utils.cc.

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

Referenced by IDP_reprN().

◆ idp_repr_fn_recursive()

◆ IDP_reprN()

char * IDP_reprN ( const IDProperty * prop,
uint * r_len )

◆ idp_str_append_escape()

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

Definition at line 43 of file idprop_utils.cc.

References BLI_assert, len, SNPRINTF_RLEN, state, and str.

◆ IDP_type_str() [1/2]

const char * IDP_type_str ( const eIDPropertyType type,
const short sub_type )

◆ IDP_type_str() [2/2]

const char * IDP_type_str ( const IDProperty * prop)

Definition at line 309 of file idprop_utils.cc.

References IDP_type_str(), IDProperty::subtype, and IDProperty::type.

◆ repr_str()

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

Definition at line 240 of file idprop_utils.cc.

References BLI_dynstr_nappend(), len, and str.

Referenced by IDP_reprN().