ObjFW  Diff

Differences From Artifact [12c31cb041]:

To Artifact [c32fd13d67]:


1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
49
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51












+
+



















-
+




+





-







/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "OFObject.h"
#import "OFCollection.h"
#import "OFEnumerator.h"

/**
 * \brief A list object.
 *
 * A struct that contains a pointer to the next list object, the previous list
 * object and the object.
 */
typedef struct __of_list_object {
	/// A pointer to the next list object in the list
	struct __of_list_object *next;
	/// A pointer to the previous list object in the list
	struct __of_list_object *prev;
	/// The object for the list object
	id			object;
} of_list_object_t;

/**
 * \brief A class which provides easy to use double-linked lists.
 */
@interface OFList: OFObject <OFCopying>
@interface OFList: OFObject <OFCopying, OFCollection, OFFastEnumeration>
{
	of_list_object_t *firstListObject;
	of_list_object_t *lastListObject;
	size_t		 count;
	unsigned long	 mutations;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) of_list_object_t *firstListObject;
@property (readonly) of_list_object_t *lastListObject;
@property (readonly) size_t count;
#endif

/**
 * \return A new autoreleased OFList
 */
+ list;

103
104
105
106
107
108
109

110
111
112
113









114


115

105
106
107
108
109
110
111
112
113



114
115
116
117
118
119
120
121
122

123
124
125
126







+

-
-
-
+
+
+
+
+
+
+
+
+
-
+
+

+

/**
 * Removes the object with the specified list object from the list.
 *
 * \param listobj The list object returned by append / prepend
 */
- (void)removeListObject: (of_list_object_t*)listobj;
@end

/**
 * \return The number of items in the list.
 */
/// \cond internal
@interface OFListEnumerator: OFEnumerator
{
	of_list_object_t *first;
	of_list_object_t *current;
	unsigned long	 mutations;
	unsigned long	 *mutationsPtr;
}

- (size_t)count;
- initWithFirstListObject: (of_list_object_t*)first
	 mutationsPointer: (unsigned long*)mutations_ptr;
@end
/// \endcond