ObjFW  Check-in [2690e9848f]

Overview
Comment:Start documenting stuff.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2690e9848f6455e21a4db9d814b2ebebfd69ababbbee8b0b9e5ecc5f64dbe813
User & Date: js on 2008-11-05 17:13:44
Other Links: manifest | tags
Context
2008-11-05
17:51
More documentation. check-in: 32ccf22a44 user: js tags: trunk
17:13
Start documenting stuff. check-in: 2690e9848f user: js tags: trunk
16:11
OFOverflowException -> OFOutOfRangeException. check-in: 3577c0d81c user: js tags: trunk
Changes

Added doxygen.cfg version [d551f60535].













>
>
>
>
>
>
1
2
3
4
5
6
PROJECT_NAME = "ObjFW"
OUTPUT_DIRECTORY = docs/
INPUT = src
FILE_PATTERNS = *.h *.m
HTML_OUTPUT = .
GENERATE_LATEX = NO

Modified src/OFArray.h from [73c8baf0bd] to [ee707a5900].

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
 * the packaging of this file.
 */

#import <stddef.h>

#import "OFObject.h"






@interface OFArray: OFObject
{
	char   *data;
	size_t itemsize;
	size_t items;
}







+ newWithItemSize: (size_t)is;







- initWithItemSize: (size_t)is;




- (size_t)items;









- (void*)data;







- (void*)item: (size_t)item;




- (void*)last;






- add: (void*)item;







- addNItems: (size_t)nitems
 fromCArray: (void*)carray;






- removeNItems: (size_t)nitems;
@end

@interface OFBigArray: OFArray
{
	size_t size;
}

- initWithSize: (size_t)is;

- addNItems: (size_t)nitems
 fromCArray: (void*)carray;
- removeNItems: (size_t)nitems;
@end







>
>
>
>
>







>
>
>
>
>
>

>
>
>
>
>
>
>

>
>
>
>

>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>

>
>
>
>

>
>
>
>
>
>

>
>
>
>
>
>
>


>
>
>
>
>
>








|
>




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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 * the packaging of this file.
 */

#import <stddef.h>

#import "OFObject.h"

/**
 * The OFArray class provides a class for storing dynamically sized arrays.
 * If you plan to store large hunks of data, you should consider using
 * OFBigArray, which allocates the memory in pages and not in bytes.
 */
@interface OFArray: OFObject
{
	char   *data;
	size_t itemsize;
	size_t items;
}

/**
 * Creates a new OFArray whose items all have the same size.
 *
 * \param is The size of each element in the OFArray
 * \return A new allocated and initialized OFArray
 */
+ newWithItemSize: (size_t)is;

/**
 * Initializes an already allocated OFArray whose items all have the same size.
 * 
 * \param is The size of each element in the OFArray
 * \return An initialized OFArray
 */
- initWithItemSize: (size_t)is;

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

/**
 * \return The size of each item in the OFArray in bytes
 */
- (size_t)itemsize;

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

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

/**
 * \return The last item of the OFArray
 */
- (void*)last;

/**
 * Adds an item to the OFArray.
 *
 * \param item An arbitrary item
 */
- add: (void*)item;

/**
 * Adds items from a C array to the OFArray
 *
 * \param nitems The number of items to add
 * \param carray A C array containing the items to add
 */
- addNItems: (size_t)nitems
 fromCArray: (void*)carray;

/**
 * Removes the last items from the OFArray
 *
 * \param nitems The number of items to remove
 */
- removeNItems: (size_t)nitems;
@end

@interface OFBigArray: OFArray
{
	size_t size;
}

+ newWithItemSize: (size_t)is;
- initWithItemSize: (size_t)is;
- addNItems: (size_t)nitems
 fromCArray: (void*)carray;
- removeNItems: (size_t)nitems;
@end

Modified src/OFArray.m from [806072ba44] to [97782e7ade].

101
102
103
104
105
106
107
108





109
110
111
112
113
114
115
	items -= nitems;

	return self;
}
@end

@implementation OFBigArray
- initWithSize: (size_t)is





{
	if ((self = [super init]))
		size = 0;

	return self;
}








|
>
>
>
>
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
	items -= nitems;

	return self;
}
@end

@implementation OFBigArray
+ newWithItemSize: (size_t)is
{
	return [[OFBigArray alloc] initWithItemSize: is];
}

- initWithItemSize: (size_t)is
{
	if ((self = [super init]))
		size = 0;

	return self;
}

Modified src/OFCString.h from [ed35d22672] to [661330dd84].

9
10
11
12
13
14
15



16
17
18
19
20
21






22




23




24






25







26






27






28
29
 * the packaging of this file.
 */

#import <stddef.h>

#import "OFString.h"




@interface OFCString: OFString
{
	char   *string;
	size_t length;
}







- initAsCString: (char*)str;




- (char*)cString;




- (size_t)length;






- (OFString*)clone;







- (int)compareTo: (OFString*)str;






- (OFString*)append: (OFString*)str;






- (OFString*)appendCString: (const char*)str;
@end







>
>
>






>
>
>
>
>
>

>
>
>
>

>
>
>
>

>
>
>
>
>
>

>
>
>
>
>
>
>

>
>
>
>
>
>
|
>
>
>
>
>
>
|

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 * the packaging of this file.
 */

#import <stddef.h>

#import "OFString.h"

/**
 * An OFString using a C string as internal storage.
 */
@interface OFCString: OFString
{
	char   *string;
	size_t length;
}

/**
 * Initializes an already allocated OFCString.
 * 
 * \param str A C string to initialize the OFCString with.
 * \returns An initialized OFCString
 */
- initAsCString: (char*)str;

/**
 * \return The OFCString as a C string.
 */
- (char*)cString;

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

/**
 * Clones the OFCString, creating a new one.
 * 
 * \return A copy of the OFCString
 */
- (OFString*)clone;

/**
 * Compares the OFCString to another OFString.
 *
 * \param str An OFString in a compatible type to compare with
 * \return An integer which is the result of the comparison, see strcmp.
 */
- (int)compareTo: (OFString*)str;

/**
 * Append another OFString to the OFCString.
 *
 * \param str An OFString in a compatible type to append
 */
- append: (OFString*)str;

/**
 * Append a C string to the OFCString.
 *
 * \param str A C string to append
 */
- appendCString: (const char*)str;
@end

Modified src/OFCString.m from [c7f67be4d5] to [92741a24d4].

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
}

- (int)compareTo: (OFString*)str
{
	return strcmp(string, [str cString]);
}

- (OFString*)append: (OFString*)str
{
	return [self appendCString: [str cString]];
}

- (OFString*)appendCString: (const char*)str
{
	char   *newstr;
	size_t newlen, strlength;

	if (string == NULL) 
		return [self setTo: [OFString newAsCString: (char*)str]];








|




|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
}

- (int)compareTo: (OFString*)str
{
	return strcmp(string, [str cString]);
}

- append: (OFString*)str
{
	return [self appendCString: [str cString]];
}

- appendCString: (const char*)str
{
	char   *newstr;
	size_t newlen, strlength;

	if (string == NULL) 
		return [self setTo: [OFString newAsCString: (char*)str]];

Modified src/OFString.h from [71a7d2b095] to [bd63b22084].

22
23
24
25
26
27
28
29
30
31
32

- (char*)cString;
- (wchar_t*)wcString;
- (size_t)length;
- (OFString*)setTo: (OFString*)str;
- (OFString*)clone;
- (int)compareTo: (OFString*)str;
- (OFString*)append: (OFString*)str;
- (OFString*)appendCString: (const char*)str;
- (OFString*)appendWideCString: (const wchar_t*)str;
@end







|
|
|

22
23
24
25
26
27
28
29
30
31
32

- (char*)cString;
- (wchar_t*)wcString;
- (size_t)length;
- (OFString*)setTo: (OFString*)str;
- (OFString*)clone;
- (int)compareTo: (OFString*)str;
- append: (OFString*)str;
- appendCString: (const char*)str;
- appendWideCString: (const wchar_t*)str;
@end

Modified src/OFString.m from [a6d9bc8397] to [d41ed2e6b4].

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
}

- (int)compareTo: (OFString*)str
{
	OF_NOT_IMPLEMENTED(0)
}

- (OFString*)append: (OFString*)str
{
	OF_NOT_IMPLEMENTED(nil)
}

- (OFString*)appendCString: (const char*)str
{
	OF_NOT_IMPLEMENTED(nil)
}

- (OFString*)appendWideCString: (const wchar_t*)str
{
	OF_NOT_IMPLEMENTED(nil)
}
@end







|




|




|




71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
}

- (int)compareTo: (OFString*)str
{
	OF_NOT_IMPLEMENTED(0)
}

- append: (OFString*)str
{
	OF_NOT_IMPLEMENTED(nil)
}

- appendCString: (const char*)str
{
	OF_NOT_IMPLEMENTED(nil)
}

- appendWideCString: (const wchar_t*)str
{
	OF_NOT_IMPLEMENTED(nil)
}
@end

Modified src/OFWideCString.h from [4c42e42372] to [8140132478].

21
22
23
24
25
26
27
28
29
30
}

- initAsWideCString: (wchar_t*)str;
- (wchar_t*)wcString;
- (size_t)length;
- (OFString*)clone;
- (int)compareTo: (OFString*)str;
- (OFString*)append: (OFString*)str;
- (OFString*)appendWideCString: (const wchar_t*)str;
@end







|
|

21
22
23
24
25
26
27
28
29
30
}

- initAsWideCString: (wchar_t*)str;
- (wchar_t*)wcString;
- (size_t)length;
- (OFString*)clone;
- (int)compareTo: (OFString*)str;
- append: (OFString*)str;
- appendWideCString: (const wchar_t*)str;
@end

Modified src/OFWideCString.m from [9a593a3045] to [882172ee7f].

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
}

- (int)compareTo: (OFString*)str
{
	return wcscmp(string, [str wcString]);
}

- (OFString*)append: (OFString*)str
{
	return [self appendWideCString: [str wcString]];
}

- (OFString*)appendWideCString: (const wchar_t*)str
{
	wchar_t	*newstr;
	size_t	newlen, strlength;

	if (string == NULL) 
		return [self setTo: [OFString
					newAsWideCString: (wchar_t*)str]];







|




|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
}

- (int)compareTo: (OFString*)str
{
	return wcscmp(string, [str wcString]);
}

- append: (OFString*)str
{
	return [self appendWideCString: [str wcString]];
}

- appendWideCString: (const wchar_t*)str
{
	wchar_t	*newstr;
	size_t	newlen, strlength;

	if (string == NULL) 
		return [self setTo: [OFString
					newAsWideCString: (wchar_t*)str]];