diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-30 21:09:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-09-30 22:18:25 +0300 |
commit | 07feb6e81441b084775e7cb7a042fc19c8c126d4 (patch) | |
tree | ec5ac3b0bcf6e5e07916e2ec39cca6d81a0f9ffe /source/blender/python/generic/py_capi_utils.h | |
parent | ddb157999eed6907e3fd8753d61e65491f2f3a6d (diff) |
PyC API: utility to parse a string as an RNA like enum
More convenient than comparing strings,
with the advantage that errors don't need to repeat expected values.
Diffstat (limited to 'source/blender/python/generic/py_capi_utils.h')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 4454aa11d77..1f552c3d78d 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -126,6 +126,17 @@ bool PyC_RunString_AsString(const char **imports, int PyC_ParseBool(PyObject *o, void *p); +struct PyC_StringEnumItems { + int value; + const char *id; +}; +struct PyC_StringEnum { + const struct PyC_StringEnumItems *items; + int value_found; +}; + +int PyC_ParseStringEnum(PyObject *o, void *p); + int PyC_CheckArgs_DeepCopy(PyObject *args); /* Integer parsing (with overflow checks), -1 on error. */ |