[gegl] Add gegl_node_list_input/output_pads()
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Add gegl_node_list_input/output_pads()
- Date: Thu, 8 May 2014 15:19:02 +0000 (UTC)
commit 739599cb514e4e98dc97bce4adb9eb18b6ac940c
Author: Daniel Sabo <DanielSabo gmail com>
Date: Tue May 6 06:15:09 2014 -0700
Add gegl_node_list_input/output_pads()
gegl/graph/gegl-node.c | 36 ++++++++++++++++++++++++++++++++++++
gegl/graph/gegl-node.h | 23 +++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index b1314a5..40916f6 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -408,6 +408,42 @@ gegl_node_has_pad (GeglNode *self,
return gegl_node_get_pad (self, name) != NULL;
}
+static inline gchar **
+_make_pad_list (GSList *iter)
+{
+ gchar **list;
+ gint i;
+
+ if (!iter)
+ return NULL;
+
+ list = g_new0 (gchar *, g_slist_length (iter) + 1);
+
+ for (i = 0; iter; iter = iter->next, i++)
+ {
+ GeglPad *pad = iter->data;
+ list[i] = g_strdup (pad->name);
+ }
+
+ return list;
+}
+
+gchar **
+gegl_node_list_input_pads (GeglNode *self)
+{
+ g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
+
+ return _make_pad_list (self->input_pads);
+}
+
+gchar **
+gegl_node_list_output_pads (GeglNode *self)
+{
+ g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
+
+ return _make_pad_list (self->output_pads);
+}
+
/**
* gegl_node_get_pads:
* @self: a #GeglNode.
diff --git a/gegl/graph/gegl-node.h b/gegl/graph/gegl-node.h
index fb0af9a..5af5afe 100644
--- a/gegl/graph/gegl-node.h
+++ b/gegl/graph/gegl-node.h
@@ -538,6 +538,29 @@ GeglNode * gegl_node_get_producer (GeglNode *node,
gboolean gegl_node_has_pad (GeglNode *node,
const gchar *pad_name);
+/**
+ * gegl_node_list_input_pads:
+ * @node: the node we are querying
+ *
+ * If the node has any input pads this function returns a null terminated
+ * array of pad names, otherwise it returns NULL. The return value can be
+ * freed with g_strfreev().
+ *
+ * Return value: (transfer full) (array zero-terminated=1)
+ */
+gchar ** gegl_node_list_input_pads (GeglNode *node);
+
+/**
+ * gegl_node_list_output_pads:
+ * @node: the node we are querying
+ *
+ * If the node has any output pads this function returns a null terminated
+ * array of pad names, otherwise it returns NULL. The return value can be
+ * freed with g_strfreev().
+ *
+ * Return value: (transfer full) (array zero-terminated=1)
+ */
+gchar ** gegl_node_list_output_pads (GeglNode *node);
/***
* Binding conveniences:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]