[Bf-blender-cvs] [93c6b12df58] master: Cleanup: use doxygen sections in py_capi_rna.c

Campbell Barton noreply at git.blender.org
Wed Sep 1 09:01:09 CEST 2021


Commit: 93c6b12df584bd94a1d02b90ec213714e39c1fb1
Author: Campbell Barton
Date:   Wed Sep 1 17:00:04 2021 +1000
Branches: master
https://developer.blender.org/rB93c6b12df584bd94a1d02b90ec213714e39c1fb1

Cleanup: use doxygen sections in py_capi_rna.c

===================================================================

M	source/blender/python/generic/py_capi_rna.c
M	source/blender/python/generic/py_capi_rna.h

===================================================================

diff --git a/source/blender/python/generic/py_capi_rna.c b/source/blender/python/generic/py_capi_rna.c
index f6a556a3fff..235b136ca74 100644
--- a/source/blender/python/generic/py_capi_rna.c
+++ b/source/blender/python/generic/py_capi_rna.c
@@ -37,6 +37,10 @@
 
 #include "MEM_guardedalloc.h"
 
+/* -------------------------------------------------------------------- */
+/** \name Enum Utilities
+ * \{ */
+
 /**
  * Convert all items into a single comma separated string.
  * Use for creating useful error messages.
@@ -59,6 +63,12 @@ char *pyrna_enum_repr(const EnumPropertyItem *item)
   return cstring;
 }
 
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Enum Conversion Utilities
+ * \{ */
+
 /**
  * Same as #RNA_enum_value_from_id, but raises an exception.
  */
@@ -78,47 +88,6 @@ int pyrna_enum_value_from_id(const EnumPropertyItem *item,
   return 0;
 }
 
-/**
- * Use with #PyArg_ParseTuple's `O&` formatting.
- */
-int pyrna_enum_value_parse_string(PyObject *o, void *p)
-{
-  const char *identifier = PyUnicode_AsUTF8(o);
-  if (identifier == NULL) {
-    PyErr_Format(PyExc_TypeError, "expected a string enum, not %.200s", Py_TYPE(o)->tp_name);
-    return 0;
-  }
-  struct BPy_EnumProperty_Parse *parse_data = p;
-  if (pyrna_enum_value_from_id(
-          parse_data->items, identifier, &parse_data->value, "enum identifier") == -1) {
-    return 0;
-  }
-
-  parse_data->value_orig = o;
-  parse_data->is_set = true;
-  return 1;
-}
-
-/**
- * Use with #PyArg_ParseTuple's `O&` formatting.
- */
-int pyrna_enum_bitfield_parse_set(PyObject *o, void *p)
-{
-  if (!PySet_Check(o)) {
-    PyErr_Format(PyExc_TypeError, "expected a set, not %.200s", Py_TYPE(o)->tp_name);
-    return 0;
-  }
-
-  struct BPy_EnumProperty_Parse *parse_data = p;
-  if (pyrna_enum_bitfield_from_set(
-          parse_data->items, o, &parse_data->value, "enum identifier set") == -1) {
-    return 0;
-  }
-  parse_data->value_orig = o;
-  parse_data->is_set = true;
-  return 1;
-}
-
 /**
  * Takes a set of strings and map it to and array of booleans.
  *
@@ -247,3 +216,52 @@ PyObject *pyrna_enum_bitfield_as_set(const EnumPropertyItem *items, int value)
 
   return ret;
 }
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Argument Parsing Helpers
+ * \{ */
+
+/**
+ * Use with #PyArg_ParseTuple's `O&` formatting.
+ */
+int pyrna_enum_value_parse_string(PyObject *o, void *p)
+{
+  const char *identifier = PyUnicode_AsUTF8(o);
+  if (identifier == NULL) {
+    PyErr_Format(PyExc_TypeError, "expected a string enum, not %.200s", Py_TYPE(o)->tp_name);
+    return 0;
+  }
+  struct BPy_EnumProperty_Parse *parse_data = p;
+  if (pyrna_enum_value_from_id(
+          parse_data->items, identifier, &parse_data->value, "enum identifier") == -1) {
+    return 0;
+  }
+
+  parse_data->value_orig = o;
+  parse_data->is_set = true;
+  return 1;
+}
+
+/**
+ * Use with #PyArg_ParseTuple's `O&` formatting.
+ */
+int pyrna_enum_bitfield_parse_set(PyObject *o, void *p)
+{
+  if (!PySet_Check(o)) {
+    PyErr_Format(PyExc_TypeError, "expected a set, not %.200s", Py_TYPE(o)->tp_name);
+    return 0;
+  }
+
+  struct BPy_EnumProperty_Parse *parse_data = p;
+  if (pyrna_enum_bitfield_from_set(
+          parse_data->items, o, &parse_data->value, "enum identifier set") == -1) {
+    return 0;
+  }
+  parse_data->value_orig = o;
+  parse_data->is_set = true;
+  return 1;
+}
+
+/** \} */
diff --git a/source/blender/python/generic/py_capi_rna.h b/source/blender/python/generic/py_capi_rna.h
index d1a30e2177a..326ca777a4b 100644
--- a/source/blender/python/generic/py_capi_rna.h
+++ b/source/blender/python/generic/py_capi_rna.h
@@ -32,6 +32,20 @@ int pyrna_enum_value_from_id(const struct EnumPropertyItem *item,
                              int *value,
                              const char *error_prefix);
 
+unsigned int *pyrna_enum_bitmap_from_set(const struct EnumPropertyItem *items,
+                                         PyObject *value,
+                                         int type_size,
+                                         bool type_convert_sign,
+                                         int bitmap_size,
+                                         const char *error_prefix);
+
+int pyrna_enum_bitfield_from_set(const struct EnumPropertyItem *items,
+                                 PyObject *value,
+                                 int *r_value,
+                                 const char *error_prefix);
+
+PyObject *pyrna_enum_bitfield_as_set(const struct EnumPropertyItem *items, int value);
+
 /**
  * Data for #pyrna_enum_value_parse_string & #pyrna_enum_bitfield_parse_set parsing utilities.
  * Use with #PyArg_ParseTuple's `O&` formatting.
@@ -50,17 +64,3 @@ struct BPy_EnumProperty_Parse {
 };
 int pyrna_enum_value_parse_string(PyObject *o, void *p);
 int pyrna_enum_bitfield_parse_set(PyObject *o, void *p);
-
-unsigned int *pyrna_enum_bitmap_from_set(const struct EnumPropertyItem *items,
-                                         PyObject *value,
-                                         int type_size,
-                                         bool type_convert_sign,
-                                         int bitmap_size,
-                                         const char *error_prefix);
-
-int pyrna_enum_bitfield_from_set(const struct EnumPropertyItem *items,
-                                 PyObject *value,
-                                 int *r_value,
-                                 const char *error_prefix);
-
-PyObject *pyrna_enum_bitfield_as_set(const struct EnumPropertyItem *items, int value);



More information about the Bf-blender-cvs mailing list