Changeset 978ccaf1 in mainline for uspace/app/bithenge/tree.h
- Timestamp:
- 2012-06-27T03:35:43Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 600f5d1
- Parents:
- 04a7435f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/tree.h
r04a7435f r978ccaf1 93 93 typedef struct bithenge_internal_node_ops_t { 94 94 /** @copydoc bithenge_node_t::bithenge_node_for_each */ 95 int (*for_each)(bithenge_node_t *node, bithenge_for_each_func_t func, void *data); 96 /** @copydoc bithenge_node_t::bithenge_node_destroy */ 97 int (*destroy)(bithenge_node_t *node); 95 int (*for_each)(bithenge_node_t *self, bithenge_for_each_func_t func, void *data); 96 /** Destroys the internal node. 97 * @param self The node to destroy. */ 98 void (*destroy)(bithenge_node_t *self); 98 99 } bithenge_internal_node_ops_t; 99 100 … … 109 110 /** Increment a node's reference count. 110 111 * @memberof bithenge_node_t 111 * @param node The node to reference. 112 * @return EOK on success or an error code from errno.h. */ 113 static inline int bithenge_node_inc_ref(bithenge_node_t *node) 112 * @param node The node to reference. */ 113 static inline void bithenge_node_inc_ref(bithenge_node_t *node) 114 114 { 115 115 assert(node); 116 116 node->refs++; 117 return EOK;118 117 } 119 118 120 intbithenge_node_dec_ref(bithenge_node_t *node);119 void bithenge_node_dec_ref(bithenge_node_t *node); 121 120 122 121 /** Iterate over a node's children. 123 122 * @memberof bithenge_node_t 124 * @param nodeThe internal node to iterate over.123 * @param self The internal node to iterate over. 125 124 * @param func The callback function. 126 125 * @param data Data to provide to the callback function. 127 126 * @return EOK on success or an error code from errno.h. */ 128 static inline int bithenge_node_for_each(bithenge_node_t *node, bithenge_for_each_func_t func, void *data) 127 static inline int bithenge_node_for_each(bithenge_node_t *self, 128 bithenge_for_each_func_t func, void *data) 129 129 { 130 assert( node->type == BITHENGE_NODE_INTERNAL);131 return node->internal_ops->for_each(node, func, data);130 assert(self->type == BITHENGE_NODE_INTERNAL); 131 return self->internal_ops->for_each(self, func, data); 132 132 } 133 133 134 134 /** Get the value of a boolean node. 135 135 * @memberof bithenge_node_t 136 * @param nodeThe boolean node.136 * @param self The boolean node. 137 137 * @return The node's value. */ 138 static inline bool bithenge_boolean_node_value(bithenge_node_t * node)138 static inline bool bithenge_boolean_node_value(bithenge_node_t *self) 139 139 { 140 assert( node->type == BITHENGE_NODE_BOOLEAN);141 return node->boolean_value;140 assert(self->type == BITHENGE_NODE_BOOLEAN); 141 return self->boolean_value; 142 142 } 143 143 144 144 /** Get the value of an integer node. 145 145 * @memberof bithenge_node_t 146 * @param nodeThe integer node.146 * @param self The integer node. 147 147 * @return The node's value. */ 148 static inline bithenge_int_t bithenge_integer_node_value(bithenge_node_t * node)148 static inline bithenge_int_t bithenge_integer_node_value(bithenge_node_t *self) 149 149 { 150 assert( node->type == BITHENGE_NODE_INTEGER);151 return node->integer_value;150 assert(self->type == BITHENGE_NODE_INTEGER); 151 return self->integer_value; 152 152 } 153 153 154 154 /** Get the value of an string node. 155 155 * @memberof bithenge_node_t 156 * @param nodeThe string node.156 * @param self The string node. 157 157 * @return The node's value. */ 158 static inline const char *bithenge_string_node_value(bithenge_node_t * node)158 static inline const char *bithenge_string_node_value(bithenge_node_t *self) 159 159 { 160 assert( node->type == BITHENGE_NODE_STRING);161 return node->string_value.ptr;160 assert(self->type == BITHENGE_NODE_STRING); 161 return self->string_value.ptr; 162 162 } 163 163
Note:
See TracChangeset
for help on using the changeset viewer.