ObjFW
|
00001 /* 00002 * Copyright (c) 2008, 2009, 2010, 2011, 2012 00003 * Jonathan Schleifer <js@webkeks.org> 00004 * 00005 * All rights reserved. 00006 * 00007 * This file is part of ObjFW. It may be distributed under the terms of the 00008 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in 00009 * the packaging of this file. 00010 * 00011 * Alternatively, it may be distributed under the terms of the GNU General 00012 * Public License, either version 2 or 3, which can be found in the file 00013 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this 00014 * file. 00015 */ 00016 00017 #import "OFObject.h" 00018 #import "OFCollection.h" 00019 #import "OFEnumerator.h" 00020 #import "OFSerialization.h" 00021 00022 typedef struct of_list_object_t of_list_object_t; 00029 struct of_list_object_t { 00031 of_list_object_t *next; 00033 of_list_object_t *previous; 00035 id object; 00036 }; 00037 00041 @interface OFList: OFObject <OFCopying, OFCollection, OFSerialization> 00042 { 00043 of_list_object_t *firstListObject; 00044 of_list_object_t *lastListObject; 00045 size_t count; 00046 unsigned long mutations; 00047 } 00048 00049 #ifdef OF_HAVE_PROPERTIES 00050 @property (readonly) of_list_object_t *firstListObject; 00051 @property (readonly) of_list_object_t *lastListObject; 00052 #endif 00053 00059 + list; 00060 00066 - (of_list_object_t*)firstListObject; 00067 00073 - (of_list_object_t*)lastListObject; 00074 00083 - (of_list_object_t*)appendObject: (id)object; 00084 00093 - (of_list_object_t*)prependObject: (id)object; 00094 00105 - (of_list_object_t*)insertObject: (id)object 00106 beforeListObject: (of_list_object_t*)listObject; 00107 00118 - (of_list_object_t*)insertObject: (id)object 00119 afterListObject: (of_list_object_t*)listObject; 00120 00126 - (void)removeListObject: (of_list_object_t*)listObject; 00127 00135 - (BOOL)containsObjectIdenticalTo: (id)object; 00136 00145 - (id)firstObject; 00146 00155 - (id)lastObject; 00156 @end 00157 00158 @interface OFListEnumerator: OFEnumerator 00159 { 00160 OFList *list; 00161 of_list_object_t *current; 00162 unsigned long mutations; 00163 unsigned long *mutationsPtr; 00164 } 00165 00166 - initWithList: (OFList*)list 00167 mutationsPointer: (unsigned long*)mutationsPtr; 00168 @end