Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

cntree.h

Go to the documentation of this file.
00001 /*
00002  * XetPan: a libEtPan! based Mail User Agent
00003  * Copyright (C) 2002-2003 Melvin Hadasht
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program 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
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #ifndef CNTREE_H
00021 #define CNTREE_H
00022 
00023 #include <clist.h>
00024 
00025 typedef struct cntree_s cntree;
00026 
00027 struct cntree_s {
00028   void *data;
00029   clist *children;
00030   cntree *parent;
00031 };
00032 
00033 cntree *
00034 cntree_new(void);
00035 
00036 cntree *
00037 cntree_new_with_data(void *data);
00038 
00039 void
00040 cntree_free(cntree *ntree, void (*free_callback)(cntree *atree, void *adata),
00041             void *data);
00042 
00043 clist *
00044 cntree_get_children(cntree *ntree);
00045 
00046 void
00047 cntree_set_children(cntree *ntree, clist *children);
00048 
00049 int
00050 cntree_append_child(cntree *parent, cntree *child);
00051 
00052 int
00053 cntree_prepend_child(cntree *parent, cntree *child);
00054 
00055 int
00056 cntree_remove_child(cntree* parent, cntree *child);
00057 
00058 void
00059 cntree_set_data(cntree *ntree, void *data);
00060 
00061 void *
00062 cntree_get_data(cntree *ntree);
00063 
00064 int
00065 cntree_get_children_count(cntree *ntree);
00066 
00067 int
00068 cntree_for_each(cntree *ntree, int (*callback)(cntree *atree, void *adata), 
00069                 void *data);
00070 
00071 int
00072 cntree_for_each_child(cntree *ntree, int (*callback)(cntree *atree, void *data),
00073                       void *data);
00074 
00075 cntree *
00076 cntree_get_root(cntree *ntree);
00077 
00078 cntree *
00079 cntree_find_child_with_data(cntree *parent, void *data);
00080 
00081 #endif
00082 
00083 
00084 
00085 
00086   

Generated on Wed Oct 22 15:50:20 2003 for XetPan by doxygen 1.3.2