summaryrefslogtreecommitdiffstats
path: root/libcnary/include/node.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-02-06 18:28:28 +0100
committerGravatar Nikias Bassen2023-02-06 18:28:28 +0100
commitd3908006349f38bcfc0151daebd98b6873a2dbfc (patch)
tree238072fa5380039ad29af87c0d6e618ab37d4d5b /libcnary/include/node.h
parent52826a6c229ed3e353d4dae711a6c52a96d99764 (diff)
downloadlibplist-d3908006349f38bcfc0151daebd98b6873a2dbfc.tar.gz
libplist-d3908006349f38bcfc0151daebd98b6873a2dbfc.tar.bz2
libcnary: Updated typedefs of node_t and node_list_t to contain pointer
This makes the code more readable. Obviously all the code that uses it is also updated.
Diffstat (limited to 'libcnary/include/node.h')
-rw-r--r--libcnary/include/node.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/libcnary/include/node.h b/libcnary/include/node.h
index 7e9da50..123241a 100644
--- a/libcnary/include/node.h
+++ b/libcnary/include/node.h
@@ -24,42 +24,42 @@
24#ifndef NODE_H_ 24#ifndef NODE_H_
25#define NODE_H_ 25#define NODE_H_
26 26
27#include "node_list.h"
27#include "object.h" 28#include "object.h"
28 29
29#define NODE_TYPE 1; 30#define NODE_TYPE 1;
30 31
31struct node_list_t;
32
33// This class implements the abstract iterator class 32// This class implements the abstract iterator class
34typedef struct node_t { 33typedef struct node* node_t;
34struct node {
35 // Super class 35 // Super class
36 struct node_t* next; 36 node_t next;
37 struct node_t* prev; 37 node_t prev;
38 unsigned int count; 38 unsigned int count;
39 39
40 // Local Members 40 // Local Members
41 void *data; 41 void *data;
42 struct node_t* parent; 42 node_t parent;
43 struct node_list_t* children; 43 node_list_t children;
44} node_t; 44};
45 45
46void node_destroy(struct node_t* node); 46void node_destroy(node_t node);
47struct node_t* node_create(struct node_t* parent, void* data); 47node_t node_create(node_t parent, void* data);
48 48
49int node_attach(struct node_t* parent, struct node_t* child); 49int node_attach(node_t parent, node_t child);
50int node_detach(struct node_t* parent, struct node_t* child); 50int node_detach(node_t parent, node_t child);
51int node_insert(struct node_t* parent, unsigned int index, struct node_t* child); 51int node_insert(node_t parent, unsigned int index, node_t child);
52 52
53unsigned int node_n_children(struct node_t* node); 53unsigned int node_n_children(node_t node);
54node_t* node_nth_child(struct node_t* node, unsigned int n); 54node_t node_nth_child(node_t node, unsigned int n);
55node_t* node_first_child(struct node_t* node); 55node_t node_first_child(node_t node);
56node_t* node_prev_sibling(struct node_t* node); 56node_t node_prev_sibling(node_t node);
57node_t* node_next_sibling(struct node_t* node); 57node_t node_next_sibling(node_t node);
58int node_child_position(struct node_t* parent, node_t* child); 58int node_child_position(node_t parent, node_t child);
59 59
60typedef void* (*copy_func_t)(const void *src); 60typedef void* (*copy_func_t)(const void *src);
61node_t* node_copy_deep(node_t* node, copy_func_t copy_func); 61node_t node_copy_deep(node_t node, copy_func_t copy_func);
62 62
63void node_debug(struct node_t* node); 63void node_debug(node_t node);
64 64
65#endif /* NODE_H_ */ 65#endif /* NODE_H_ */