ObjFW
 All Classes Functions Variables
OFList.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 #import "OFCollection.h"
19 #import "OFEnumerator.h"
20 #import "OFSerialization.h"
21 
22 typedef struct of_list_object_t of_list_object_t;
35  __unsafe_unretained id object;
36 };
37 
42 {
45  size_t count;
46  unsigned long mutations;
47 }
48 
49 #ifdef OF_HAVE_PROPERTIES
50 @property (readonly) of_list_object_t *firstListObject;
51 @property (readonly) of_list_object_t *lastListObject;
52 #endif
53 
59 + (instancetype)list;
60 
66 - (of_list_object_t*)firstListObject;
67 
73 - (of_list_object_t*)lastListObject;
74 
83 - (of_list_object_t*)appendObject: (id)object;
84 
93 - (of_list_object_t*)prependObject: (id)object;
94 
105 - (of_list_object_t*)insertObject: (id)object
106  beforeListObject: (of_list_object_t*)listObject;
107 
118 - (of_list_object_t*)insertObject: (id)object
119  afterListObject: (of_list_object_t*)listObject;
120 
126 - (void)removeListObject: (of_list_object_t*)listObject;
127 
135 - (BOOL)containsObjectIdenticalTo: (id)object;
136 
145 - (id)firstObject;
146 
155 - (id)lastObject;
156 
160 - (void)removeAllObjects;
161 @end
162 
163 @interface OFListEnumerator: OFEnumerator
164 {
165  OFList *list;
166  of_list_object_t *current;
167  unsigned long mutations;
168  unsigned long *mutationsPtr;
169 }
170 
171 - initWithList: (OFList*)list
172  mutationsPointer: (unsigned long*)mutationsPtr;
173 @end