Blender  V2.59
BLI_listbase.h
Go to the documentation of this file.
00001 /*
00002  * $Id: BLI_listbase.h 36442 2011-05-02 13:35:04Z campbellbarton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028 */
00029 
00030 #ifndef BLI_LISTBASE_H
00031 #define BLI_LISTBASE_H
00032 
00037 #include "DNA_listBase.h"
00038 //struct ListBase;
00039 //struct LinkData;
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
00046 void *BLI_findlink(const struct ListBase *listbase, int number);
00047 int BLI_findindex(const struct ListBase *listbase, void *vlink);
00048 int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset);
00049 
00050 /* find forwards */
00051 void *BLI_findstring(const struct ListBase *listbase, const char *id, const int offset);
00052 void *BLI_findstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
00053 
00054 /* find backwards */
00055 void *BLI_rfindstring(const struct ListBase *listbase, const char *id, const int offset);
00056 void *BLI_rfindstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
00057 
00058 void BLI_freelistN(struct ListBase *listbase);
00059 void BLI_addtail(struct ListBase *listbase, void *vlink);
00060 void BLI_remlink(struct ListBase *listbase, void *vlink);
00061 int BLI_remlink_safe(struct ListBase *listbase, void *vlink);
00062 
00063 void BLI_addhead(struct ListBase *listbase, void *vlink);
00064 void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);
00065 void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink);
00066 void BLI_sortlist(struct ListBase *listbase, int (*cmp)(void *, void *));
00067 void BLI_freelist(struct ListBase *listbase);
00068 int BLI_countlist(const struct ListBase *listbase);
00069 void BLI_freelinkN(struct ListBase *listbase, void *vlink);
00070 
00071 void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src);
00072 void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src);
00073 
00074 /* create a generic list node containing link to provided data */
00075 struct LinkData *BLI_genericNodeN(void *data);
00076 
00077 #ifdef __cplusplus
00078 }
00079 #endif
00080 
00081 #endif