summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/glibext/constants.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-01-29 19:20:44 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-01-29 19:20:44 (GMT)
commit4cf3bae97734a9bc380aaed66059c495ecb4c41b (patch)
tree5ba07bc4f65e7ea5e2e2eba0af15b04e60982189 /plugins/pychrysalide/glibext/constants.c
parent8cbc874ef01f3d161d4ca253167d8f80e689c814 (diff)
Define a new interface to compare items.
Diffstat (limited to 'plugins/pychrysalide/glibext/constants.c')
-rw-r--r--plugins/pychrysalide/glibext/constants.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/pychrysalide/glibext/constants.c b/plugins/pychrysalide/glibext/constants.c
index dc8d657..88e0fe9 100644
--- a/plugins/pychrysalide/glibext/constants.c
+++ b/plugins/pychrysalide/glibext/constants.c
@@ -27,6 +27,7 @@
#include <i18n.h>
#include <glibext/bufferline.h>
+#include <glibext/comparison.h>
#include <glibext/configuration.h>
#include <glibext/linesegment.h>
#include <glibext/gbinportion.h>
@@ -252,6 +253,48 @@ int convert_to_buffer_line_flags(PyObject *arg, void *dst)
* *
* Paramètres : type = type dont le dictionnaire est à compléter. *
* *
+* Description : Définit les constantes relatives aux modes de comparaison. *
+* *
+* Retour : true en cas de succès de l'opération, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool define_comparable_item_constants(PyTypeObject *type)
+{
+ bool result; /* Bilan à retourner */
+ PyObject *values; /* Groupe de valeurs à établir */
+
+ values = PyDict_New();
+
+ result = add_const_to_group(values, "LT", RCO_LT);
+ if (result) result = add_const_to_group(values, "LE", RCO_LE);
+ if (result) result = add_const_to_group(values, "EQ", RCO_EQ);
+ if (result) result = add_const_to_group(values, "NE", RCO_NE);
+ if (result) result = add_const_to_group(values, "GT", RCO_GT);
+ if (result) result = add_const_to_group(values, "GE", RCO_GE);
+
+ if (!result)
+ {
+ Py_DECREF(values);
+ goto exit;
+ }
+
+ result = attach_constants_group_to_type(type, true, "RichCmpOperation", values,
+ "Modes for objects comparison.");
+
+ exit:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type dont le dictionnaire est à compléter. *
+* *
* Description : Définit les constantes relatives aux paramètres de config. *
* *
* Retour : true en cas de succès de l'opération, false sinon. *