Open SCAP Library
|
00001 /* 00002 * Copyright 2010 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * "Daniel Kopecek" <dkopecek@redhat.com> 00021 */ 00022 #ifndef RBT_STR_H 00023 #define RBT_STR_H 00024 00025 #include "rbt_common.h" 00026 00027 struct rbt_str_node { 00028 char *key; 00029 void *data; 00030 }; 00031 00032 typedef struct rbt_str_node rbt_str_node_t; 00033 00034 #define rbt_str_node_key(np) (((struct rbt_str_node *)(rbt_node_ptr(np)->_node))->key) 00035 #define rbt_str_node_data(np) (((struct rbt_str_node *)(rbt_node_ptr(np)->_node))->data) 00036 00037 rbt_t *rbt_str_new (void); 00038 void rbt_str_free (rbt_t *rbt); 00039 void rbt_str_free_cb (rbt_t *rbt, void (*callback)(struct rbt_str_node *)); 00040 void rbt_str_free_cb2 (rbt_t *rbt, void (*callback)(struct rbt_str_node *, void *user), void *user); 00041 00042 int rbt_str_add(rbt_t *rbt, char *key, void *data); 00043 void *rbt_str_rep(rbt_t *rbt, const char *key, void *data); 00044 int rbt_str_del(rbt_t *rbt, const char *key, void **n); 00045 int rbt_str_getnode(rbt_t *rbt, const char *key, struct rbt_str_node **node); 00046 int rbt_str_get(rbt_t *rbt, const char *key, void **data); 00047 00048 int rbt_str_walk_preorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags); 00049 int rbt_str_walk_inorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags); 00050 int rbt_str_walk_inorder2(rbt_t *rbt, int (*callback)(struct rbt_str_node *, void *), void *user, rbt_walk_t flags); 00051 int rbt_str_walk_postorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags); 00052 int rbt_str_walk_levelorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags); 00053 int rbt_str_walk(rbt_t *rbt, rbt_walk_t type, int (*callback)(struct rbt_str_node *)); 00054 size_t rbt_str_size(rbt_t *rbt); 00055 00056 #endif /* RBT_STR_H */