ObjFW  Check-in [8dc49f1861]

Overview
Comment:Make - copy a protocol.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8dc49f186147656fcaf43bb2ec654f4f1a7299dbce85caeeffba4b16008b29c8
User & Date: js on 2009-05-18 16:49:09
Other Links: manifest | tags
Context
2009-05-18
17:50
Split OFArray into OFArray and OFMutableArray. check-in: 163409967e user: js tags: trunk
16:49
Make - copy a protocol. check-in: 8dc49f1861 user: js tags: trunk
2009-05-16
14:28
Add OFURLEncoding for OFString category. check-in: b992a4b0e5 user: js tags: trunk
Changes

Modified src/OFArray.h from [8da41f0b46] to [ec8ee2c449].

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

#import "OFObject.h"
#import "OFDataArray.h"

/**
 * The OFArray class provides a class for storing objects in an array.
 */
@interface OFArray: OFObject
{
	OFDataArray *array;
}

/**
 * \return A new autoreleased OFArray
 */
+ array;

/**
 * \return The number of objects in the OFArray
 */
- (size_t)count;

/**
 * \return The objects of the array as a C array
 */
- (id*)data;

/**
 * Clones the OFArray, creating a new one.
 *
 * \return A new autoreleased copy of the OFArray
 */
- (id)copy;

/**
 * Returns a specific object of the OFDataArray.
 *
 * \param index The number of the object to return
 * \return The specified object of the OFArray
 */
- (id)object: (size_t)index;







|



















<
<
<
<
<
<
<







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

#import "OFObject.h"
#import "OFDataArray.h"

/**
 * The OFArray class provides a class for storing objects in an array.
 */
@interface OFArray: OFObject <OFCopying>
{
	OFDataArray *array;
}

/**
 * \return A new autoreleased OFArray
 */
+ array;

/**
 * \return The number of objects in the OFArray
 */
- (size_t)count;

/**
 * \return The objects of the array as a C array
 */
- (id*)data;








/**
 * Returns a specific object of the OFDataArray.
 *
 * \param index The number of the object to return
 * \return The specified object of the OFArray
 */
- (id)object: (size_t)index;

Modified src/OFDataArray.h from [042b313b36] to [de40862157].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * The OFDataArray class provides 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
{
	char   *data;
	size_t itemsize;
	size_t count;
}

/**







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * The OFDataArray class provides 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>
{
	char   *data;
	size_t itemsize;
	size_t count;
}

/**
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- (size_t)itemsize;

/**
 * \return All elements of the OFDataArray
 */
- (void*)data;

/**
 * Clones the OFDataArray, creating a new one.
 *
 * \return A new autoreleased copy of the OFDataArray
 */
- (id)copy;

/**
 * Compares the OFDataArray to another object.
 *
 * \param obj An object to compare with
 * \return An integer which is the result of the comparison, see for example
 *	   strcmp
 */







<
<
<
<
<
<
<







62
63
64
65
66
67
68







69
70
71
72
73
74
75
- (size_t)itemsize;

/**
 * \return All elements of the OFDataArray
 */
- (void*)data;








/**
 * Compares the OFDataArray to another object.
 *
 * \param obj An object to compare with
 * \return An integer which is the result of the comparison, see for example
 *	   strcmp
 */
115
116
117
118
119
120
121
122
123
124
125
126
 * Removes the specified amount of items from the end of the OFDataArray.
 *
 * \param nitems The number of items to remove
 */
- removeNItems: (size_t)nitems;
@end

@interface OFBigDataArray: OFDataArray
{
	size_t size;
}
@end







|




108
109
110
111
112
113
114
115
116
117
118
119
 * Removes the specified amount of items from the end of the OFDataArray.
 *
 * \param nitems The number of items to remove
 */
- removeNItems: (size_t)nitems;
@end

@interface OFBigDataArray: OFDataArray <OFCopying>
{
	size_t size;
}
@end

Modified src/OFObject.h from [9df3b05f63] to [9afbf70556].

114
115
116
117
118
119
120

121
122
123
124
125
126
127
 * \param obj The object which is tested for equality
 * \return A boolean whether the object is equal to the other object
 */
- (BOOL)isEqual: (id)obj;

/**
 * Calculate a hash for the object.

 * Classes containing data (like strings, arrays, lists etc.) should reimplement
 * this!
 *
 * \return A 32 bit hash for the object
 */
- (uint32_t)hash;








>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
 * \param obj The object which is tested for equality
 * \return A boolean whether the object is equal to the other object
 */
- (BOOL)isEqual: (id)obj;

/**
 * Calculate a hash for the object.
 *
 * Classes containing data (like strings, arrays, lists etc.) should reimplement
 * this!
 *
 * \return A 32 bit hash for the object
 */
- (uint32_t)hash;

207
208
209
210
211
212
213











/**
 * Deallocates the object and also frees all memory allocated via its memory
 * pool.
 */
- (void)dealloc;
@end

















>
>
>
>
>
>
>
>
>
>
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224

/**
 * Deallocates the object and also frees all memory allocated via its memory
 * pool.
 */
- (void)dealloc;
@end

/**
 * Objects implementing this protocol can be copied.
 */
@protocol OFCopying
/**
 * \return A copy of the object
 */
- (id)copy;
@end

Modified src/OFString.h from [46177c0182] to [71d4835865].

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

#import "OFObject.h"
#import "OFArray.h"

/**
 * A class for managing strings.
 */
@interface OFString: OFObject
{
	char	     *string;
#ifdef __objc_INCLUDE_GNU
	unsigned int length;
#else
	int	     length;
#if __LP64__







|







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

#import "OFObject.h"
#import "OFArray.h"

/**
 * A class for managing strings.
 */
@interface OFString: OFObject <OFCopying>
{
	char	     *string;
#ifdef __objc_INCLUDE_GNU
	unsigned int length;
#else
	int	     length;
#if __LP64__
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
- (const char*)cString;

/**
 * \return The length of the OFString
 */
- (size_t)length;

/**
 * Clones the OFString, creating a new one.
 *
 * \return A new autoreleased copy of the OFString as a OFMutableString
 */
- (id)copy;

/**
 * Compares the OFString to another object.
 *
 * \param obj An object to compare with
 * \return An integer which is the result of the comparison, see for example
 *	   strcmp
 */







<
<
<
<
<
<
<







77
78
79
80
81
82
83







84
85
86
87
88
89
90
- (const char*)cString;

/**
 * \return The length of the OFString
 */
- (size_t)length;








/**
 * Compares the OFString to another object.
 *
 * \param obj An object to compare with
 * \return An integer which is the result of the comparison, see for example
 *	   strcmp
 */