ObjFW  Check-in [6b45991a6a]

Overview
Comment:Add OFComparing protocol.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6b45991a6a52de1b5cfa2366f823c81fd98852557ad62e5833dfbe282977aba7
User & Date: js on 2010-12-25 13:14:14
Other Links: manifest | tags
Context
2010-12-25
13:20
Adjust OFString and OFDataArray to OFComparing protocol. check-in: 43c60ede3c user: js tags: trunk
13:14
Add OFComparing protocol. check-in: 6b45991a6a user: js tags: trunk
2010-12-23
18:16
Add +[componentsOfPath:] and +[directoryNameOfPath:] to OFFile. check-in: 1e52247065 user: js tags: trunk
Changes

Modified src/OFDataArray.h from [c3f8c7f7f4] to [0a2f130382].

15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29







-
+








/**
 * \brief A class for storing arbitrary data in an array.
 *
 * If you plan to store large hunks of data, you should consider using
 * OFBigDataArray, which allocates the memory in pages rather than in bytes.
 */
@interface OFDataArray: OFObject <OFCopying>
@interface OFDataArray: OFObject <OFCopying, OFComparing>
{
	char   *data;
	size_t count;
	size_t itemSize;
}

#ifdef OF_HAVE_PROPERTIES
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
77
78
79
80
81
82
83








84
85
86
87
88
89
90







-
-
-
-
-
-
-
-







- (size_t)itemSize;

/**
 * \return All elements of the OFDataArray as a C array
 */
- (void*)cArray;

/**
 * Compares the OFDataArray to another object.
 *
 * \param ary A data array to compare with
 * \return An of_comparsion_result_t
 */
- (of_comparison_result_t)compare: (OFDataArray*)ary;

/**
 * Returns a specific item of the OFDataArray.
 *
 * \param index The number of the item to return
 * \return The specified item of the OFDataArray
 */
- (void*)itemAtIndex: (size_t)index;

Modified src/OFObject.h from [a268b416fa] to [e8182b85e4].

372
373
374
375
376
377
378
379

380
381
382
383















384
372
373
374
375
376
377
378

379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399







-
+




+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

 * \brief A protocol for the creation of mutable copies.
 *
 * This protocol is implemented by objects that can be mutable and immutable
 * and allows returning a mutable copy.
 */
@protocol OFMutableCopying
/**
 * \return A copy of the object
 * \return A mutable copy of the object
 */
- mutableCopy;
@end

/**
 * \brief A protocol for comparing objects.
 *
 * This protocol is implemented by objects that can be compared.
 */
@protocol OFComparing
/**
 * Compares the object with another object.
 *
 * \param obj An object to compare the object to
 * \return The result of the comparison
 */
- (of_comparison_result_t)compare: (id)obj;
@end

extern size_t of_pagesize;

Modified src/OFString.h from [425969f6b0] to [f308e10429].

30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44







-
+







extern size_t of_string_index_to_position(const char*, size_t, size_t);

@class OFArray;

/**
 * \brief A class for handling strings.
 */
@interface OFString: OFObject <OFCopying, OFMutableCopying>
@interface OFString: OFObject <OFCopying, OFMutableCopying, OFComparing>
{
	char	     *string;
	unsigned int length;
#if defined(OF_APPLE_RUNTIME) && __LP64__
	int	     _unused;
#endif
	BOOL	     isUTF8;
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
261
262
263
264
265
266
267








268
269
270
271
272
273
274







-
-
-
-
-
-
-
-







 */
- (size_t)cStringLength;

/// \cond internal
- (BOOL)isUTF8;
/// \endcond

/**
 * Compares the OFString to another OFString.
 *
 * \param str A string to compare with
 * \return An of_comparison_result_t
 */
- (of_comparison_result_t)compare: (OFString*)str;

/**
 * Compares the OFString to another OFString without caring about the case.
 *
 * \param str A string to compare with
 * \return An of_comparison_result_t
 */
- (of_comparison_result_t)caseInsensitiveCompare: (OFString*)str;