12 #define PY_SSIZE_T_CLEAN
36 for (
bool is_first =
true; item->
identifier; item++) {
55 const char *identifier,
57 const char *error_prefix)
62 PyExc_ValueError,
"%s: '%.200s' not found in (%s)", error_prefix, identifier, enum_str);
73 bool type_convert_sign,
75 const char *error_prefix)
84 while (_PySet_NextEntry(value, &
pos, &key, &
hash)) {
85 const char *param = PyUnicode_AsUTF8(key);
87 PyErr_Format(PyExc_TypeError,
88 "%.200s expected a string, not %.200s",
90 Py_TYPE(key)->tp_name);
101 if (type_convert_sign) {
102 if (type_size == 2) {
104 signed short as_signed;
107 ret_convert.as_signed = (
signed short)
ret;
108 index = (int)ret_convert.as_unsigned;
110 else if (type_size == 1) {
112 signed char as_signed;
115 ret_convert.as_signed = (
signed char)
ret;
116 index = (int)ret_convert.as_unsigned;
136 const char *error_prefix)
148 while (_PySet_NextEntry(value, &
pos, &key, &
hash)) {
149 const char *param = PyUnicode_AsUTF8(key);
152 PyErr_Format(PyExc_TypeError,
153 "%.200s expected a string, not %.200s",
155 Py_TYPE(key)->tp_name);
172 PyObject *
ret = PySet_New(
NULL);
178 for (index = 0; identifier[index]; index++) {
179 item = PyUnicode_FromString(identifier[index]);
180 PySet_Add(
ret, item);
196 const char *identifier = PyUnicode_AsUTF8(o);
197 if (identifier ==
NULL) {
198 PyErr_Format(PyExc_TypeError,
"expected a string enum, not %.200s", Py_TYPE(o)->tp_name);
203 parse_data->
items, identifier, &parse_data->
value,
"enum identifier") == -1) {
208 parse_data->
is_set =
true;
214 if (!PySet_Check(o)) {
215 PyErr_Format(PyExc_TypeError,
"expected a set, not %.200s", Py_TYPE(o)->tp_name);
221 parse_data->
items, o, &parse_data->
value,
"enum identifier set") == -1) {
225 parse_data->
is_set =
true;
#define BLI_assert_unreachable()
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format,...) ATTR_PRINTF_FORMAT(2
Read Guarded memory(de)allocation.
#define RNA_ENUM_BITFLAG_SIZE
void(* MEM_freeN)(void *vmemh)
static void error(const char *str)
int pyrna_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value, const char *error_prefix)
int pyrna_enum_bitfield_parse_set(PyObject *o, void *p)
int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
PyObject * pyrna_enum_bitfield_as_set(const EnumPropertyItem *items, int value)
char * pyrna_enum_repr(const EnumPropertyItem *item)
BLI_bitmap * pyrna_enum_bitmap_from_set(const EnumPropertyItem *items, PyObject *value, int type_size, bool type_convert_sign, int bitmap_size, const char *error_prefix)
int pyrna_enum_value_parse_string(PyObject *o, void *p)
int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item, const int value, const char **r_identifier)
bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
const struct EnumPropertyItem * items