ObjFW  Check-in [fe0aa66897]

Overview
Comment:Add -[firstObject] and -[lastObject] to OFList.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fe0aa66897c55e19d9b3aa3d2983fc9423216d02074fb49d807d317dbc1e8419
User & Date: js on 2011-05-22 00:44:35
Other Links: manifest | tags
Context
2011-05-26
17:23
Add OFEnumerating protocol. check-in: 6ddfe1975c user: js tags: trunk
2011-05-22
00:44
Add -[firstObject] and -[lastObject] to OFList. check-in: fe0aa66897 user: js tags: trunk
2011-05-21
18:10
Better way to define OF_ENDIANESS_NATIVE. check-in: e52a53d668 user: js tags: trunk
Changes

Modified src/OFList.h from [2f5f6769f6] to [7e6619efad].

121
122
123
124
125
126
127




















128
129
130
131
132
133
134
135
136
137
138
139
140

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




















@end

@interface OFListEnumerator: OFEnumerator
{
	OFList		 *list;
	of_list_object_t *current;
	unsigned long	 mutations;
	unsigned long	 *mutationsPtr;
}

-     initWithList: (OFList*)list
  mutationsPointer: (unsigned long*)mutationsPtr;
@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

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

/**
 * \brief Returns the first object of the list or nil.
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \return The first object of the list or nil
 */
- (id)firstObject;

/**
 * \brief Returns the last object of the list or nil.
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \return The last object of the list or nil
 */
- (id)lastObject;
@end

@interface OFListEnumerator: OFEnumerator
{
	OFList		 *list;
	of_list_object_t *current;
	unsigned long	 mutations;
	unsigned long	 *mutationsPtr;
}

-     initWithList: (OFList*)list
  mutationsPointer: (unsigned long*)mutationsPtr;
@end

Modified src/OFList.m from [60c8cd9af5] to [8b7bb79b80].

170
171
172
173
174
175
176
















177
178
179
180
181
182
183
	count--;
	mutations++;

	[listObject->object release];

	[self freeMemory: listObject];
}

















- (size_t)count
{
	return count;
}

- (BOOL)isEqual: (id)object







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
	count--;
	mutations++;

	[listObject->object release];

	[self freeMemory: listObject];
}

- (id)firstObject
{
	if (firstListObject != NULL)
		return firstListObject->object;

	return nil;
}

- (id)lastObject
{
	if (lastListObject != NULL)
		return lastListObject->object;

	return nil;
}

- (size_t)count
{
	return count;
}

- (BOOL)isEqual: (id)object