* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/*
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
-#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
-#error "Only <glib.h> can be included directly."
-#endif
-
#ifndef __G_NODE_H__
#define __G_NODE_H__
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
#include <glib/gmem.h>
G_BEGIN_DECLS
*/
#define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL)
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_new (gpointer data);
+GLIB_AVAILABLE_IN_ALL
void g_node_destroy (GNode *root);
+GLIB_AVAILABLE_IN_ALL
void g_node_unlink (GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_copy_deep (GNode *node,
GCopyFunc copy_func,
gpointer data);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_copy (GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_insert (GNode *parent,
gint position,
GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_insert_before (GNode *parent,
GNode *sibling,
GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_insert_after (GNode *parent,
GNode *sibling,
GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_prepend (GNode *parent,
GNode *node);
+GLIB_AVAILABLE_IN_ALL
guint g_node_n_nodes (GNode *root,
GTraverseFlags flags);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_get_root (GNode *node);
+GLIB_AVAILABLE_IN_ALL
gboolean g_node_is_ancestor (GNode *node,
GNode *descendant);
+GLIB_AVAILABLE_IN_ALL
guint g_node_depth (GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_find (GNode *root,
GTraverseType order,
GTraverseFlags flags,
g_node_insert ((parent), (position), g_node_new (data))
/**
+ * g_node_insert_data_after:
+ * @parent: the #GNode to place the new #GNode under
+ * @sibling: the sibling #GNode to place the new #GNode after
+ * @data: the data for the new #GNode
+ *
+ * Inserts a new #GNode after the given sibling.
+ *
+ * Returns: the new #GNode
+ */
+
+#define g_node_insert_data_after(parent, sibling, data) \
+ g_node_insert_after ((parent), (sibling), g_node_new (data))
+/**
* g_node_insert_data_before:
* @parent: the #GNode to place the new #GNode under
* @sibling: the sibling #GNode to place the new #GNode before
#define g_node_append_data(parent, data) \
g_node_insert_before ((parent), NULL, g_node_new (data))
-/* traversal function, assumes that `node' is root
- * (only traverses `node' and its subtree).
+/* traversal function, assumes that 'node' is root
+ * (only traverses 'node' and its subtree).
* this function is just a high level interface to
* low level traversal functions, optimized for speed.
*/
+GLIB_AVAILABLE_IN_ALL
void g_node_traverse (GNode *root,
GTraverseType order,
GTraverseFlags flags,
GNodeTraverseFunc func,
gpointer data);
-/* return the maximum tree height starting with `node', this is an expensive
+/* return the maximum tree height starting with 'node', this is an expensive
* operation, since we need to visit all nodes. this could be shortened by
- * adding `guint height' to struct _GNode, but then again, this is not very
+ * adding 'guint height' to struct _GNode, but then again, this is not very
* often needed, and would make g_node_insert() more time consuming.
*/
+GLIB_AVAILABLE_IN_ALL
guint g_node_max_height (GNode *root);
+GLIB_AVAILABLE_IN_ALL
void g_node_children_foreach (GNode *node,
GTraverseFlags flags,
GNodeForeachFunc func,
gpointer data);
+GLIB_AVAILABLE_IN_ALL
void g_node_reverse_children (GNode *node);
+GLIB_AVAILABLE_IN_ALL
guint g_node_n_children (GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_nth_child (GNode *node,
guint n);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_last_child (GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_find_child (GNode *node,
GTraverseFlags flags,
gpointer data);
+GLIB_AVAILABLE_IN_ALL
gint g_node_child_position (GNode *node,
GNode *child);
+GLIB_AVAILABLE_IN_ALL
gint g_node_child_index (GNode *node,
gpointer data);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_first_sibling (GNode *node);
+GLIB_AVAILABLE_IN_ALL
GNode* g_node_last_sibling (GNode *node);
/**
#define g_node_first_child(node) ((node) ? \
((GNode*) (node))->children : NULL)
-#ifndef G_DISABLE_DEPRECATED
-void g_node_push_allocator (gpointer dummy);
-void g_node_pop_allocator (void);
-#endif
-
G_END_DECLS
#endif /* __G_NODE_H__ */