Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

list.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 * lescegra                                                           *
00003 *                                                                    *
00004 * http://geeky.kicks-ass.org/projects/lescegra.html                  *
00005 *                                                                    *
00006 * Copyright 2003 by Enno Cramer <uebergeek@web.de>                   *
00007 *                                                                    *
00008 * This library is free software; you can redistribute it and/or      *
00009 * modify it under the terms of the GNU Library General Public        *
00010 * License as published by the Free Software Foundation; either       *
00011 * version 2 of the License, or (at your option) any later version.   *
00012 *                                                                    *
00013 * This library is distributed in the hope that it will be useful,    *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *
00016 * Library General Public License for more details.                   *
00017 *                                                                    *
00018 * You should have received a copy of the GNU Library General Public  *
00019 * License along with this library; if not, write to the Free         *
00020 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
00021 *********************************************************************/
00022 
00023 #ifndef LSG_LIST_H
00024 #define LSG_LIST_H
00025 
00026 /**
00027  * \file  list.h
00028  * \brief Linked list
00029  */
00030 
00031 #include <lescegra/util/object.h>
00032 
00033 typedef struct LsgListElement_s LsgListElement;
00034 struct LsgListElement_s {
00035     LsgListElement* next;
00036     void* value;
00037 };
00038 
00039 /**
00040  * \ingroup util
00041  * \brief   Linked list
00042  *
00043  * A linked list
00044  */
00045 typedef struct {
00046     LsgObject super;
00047     LsgListElement* first;
00048 } LsgList;
00049 
00050 /**
00051  * \brief LsgList iterator
00052  *
00053  * An LsgIterator for the LsgList
00054  */
00055 typedef struct {
00056     LsgObject super;
00057     LsgListElement* element;
00058     int index;
00059 } LsgIterator;
00060 
00061 /**
00062  * You know the deal :)
00063  */
00064 LsgList* LsgList_create(void);
00065 void LsgList_init(LsgList* self);
00066 unsigned int LsgList_count(const LsgList* self);
00067 void LsgList_append(LsgList* self, void* data);
00068 void LsgList_insert(LsgList* list, unsigned int index, void* data);
00069 void LsgList_remove(LsgList* list, unsigned int index);
00070 void LsgList_removeObject(LsgList* list, void* data);
00071 void LsgList_empty(LsgList* list);
00072 void* LsgList_set(LsgList* list, unsigned int index, void* data);
00073 void* LsgList_get(const LsgList* list, unsigned int index);
00074 void LsgList_destroy(LsgList* self);
00075 
00076 LsgIterator* LsgIterator_create(const LsgList* list);
00077 void LsgIterator_init(LsgIterator* self, const LsgList* list);
00078 int LsgIterator_hasNext(const LsgIterator* self);
00079 void* LsgIterator_next(LsgIterator* self);
00080 int LsgIterator_index(const LsgIterator* self);
00081 
00082 #endif
00083 

(c) 2003, by Enno Cramer
generated on 9 Jul 2003
lescegra - doxygen