ObjFW  Check-in [b5e28fc975]

Overview
Comment:More documentation stuff.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b5e28fc975db49817f512ea081972918cd18b3112dbe33de86e00786c29f980a
User & Date: js on 2008-11-05 20:30:07
Other Links: manifest | tags
Context
2008-11-06
16:06
Even more documentation. check-in: 89c545c3e9 user: js tags: trunk
2008-11-05
20:30
More documentation stuff. check-in: b5e28fc975 user: js tags: trunk
18:22
More documentation. check-in: 1caf21d1b2 user: js tags: trunk
Changes

Modified src/OFArray.h from [603616dc3f] to [1b567eb69c].

73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96







-
+








-
+







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

/**
 * Adds items from a C array to the OFArray
 * 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
 * Removes a specified amount of the last items from the OFArray.
 *
 * \param nitems The number of items to remove
 */
- removeNItems: (size_t)nitems;
@end

/**
118
119
120
121
122
123
124
125

126
127
128
129
130
131
132
133
134

135
136
137
138
139
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
133

134
135
136
137
138
139







-
+








-
+





 * 
 * \param is The size of each element in the OFBigArray
 * \return An initialized OFBigArray
 */
- initWithItemSize: (size_t)is;

/**
 * Adds items from a C array to the OFBigArray
 * Adds items from a C array to the OFBigArray.
 *
 * \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 OFBigArray
 * Removes a specified amount of the last items from the OFBigArray.
 *
 * \param nitems The number of items to remove
 */
- removeNItems: (size_t)nitems;
@end

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

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
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







-
-
+
+




-
+




-
+














-
+







	char   *string;
	size_t length;
}

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

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

/**
 * \return The length of the OFCString.
 * \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.
 * \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

Modified src/OFConstCString.h from [a6c136d668] to [594c3b2544].

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
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







-
-
+
+




-
+




-
+














-
+



	const char *string;
	size_t	   length;
}

/**
 * Initializes an already allocated OFConstCString.
 * 
 * \param str A constant C string to initialize the OFConstCString with.
 * \returns An initialized OFConstCString
 * \param str A constant C string to initialize the OFConstCString with
 * \return An initialized OFConstCString
 */
- initAsConstCString: (const char*)str;

/**
 * \return The OFConstCString as a constant C string.
 * \return The OFConstCString as a constant C strin
 */
- (const char*)cString;

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

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

/**
 * Compares the OFConstCString 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.
 * \return An integer which is the result of the comparison, see strcmp
 */
- (int)compareTo: (OFString*)str;
@end

Modified src/OFConstWideCString.h from [9dcf63a10a] to [85176fdaf9].

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
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







-
-
+
+

-
+


-
+




-
+














-
+



	size_t	      length;
}

/**
 * Initializes an already allocated OFConstWideCString.
 * 
 * \param str A constant wide C string to initialize the OFConstWideCString
 * 	  with.
 * \returns An initialized OFConstWideCString
 * 	  with
 * \return An initialized OFConstWideCString
 */
- initAsConstWideCString: (const wchar_t*)wstr;
- initAsConstWideCString: (const wchar_t*)str;

/**
 * \return The OFConstWideCString as a constant wide C string.
 * \return The OFConstWideCString as a constant wide C string
 */
- (const wchar_t*)wcString;

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

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

/**
 * Compares the OFConstWideCString 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 wcscmp.
 * \return An integer which is the result of the comparison, see wcscmp
 */
- (int)compareTo: (OFString*)str;
@end

Modified src/OFExceptions.h from [8fbc274411] to [809bee699f].

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
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
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







-
+

+
+
+






+
+
+
+
+
+

+
+
+
+
+
+
+

+
+
+
+

+
+
+
+
+

+
+
+
+



+
+
+





+
+
+
+
+
+
+


+
+
+
+
+
+
+
+


+
+
+
+

+
+
+
+







 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import <stddef.h>
#import "OFObject.h"

// FIXME: Exceptions should include which type of error occoured (fopen etc.)
/* FIXME: Exceptions should include which type of error occoured (fopen etc.) */

/**
 * The OFException class is the base class for all exceptions in ObjFW.
 */
@interface OFException: OFObject
{
	id   object;
	char *string;
}

/**
 * Creates a new exception.
 *
 * \param obj The object which caused the exception
 * \return A new exception
 */
+ newWithObject: (id)obj;

/**
 * Initializes an already allocated OFException.
 *
 * \param obj The object which caused the exception
 * \return An initialized OFException
 */
- initWithObject: (id)obj;

/**
 * Frees an OFException and the memory it allocated.
 */
- free;

/**
 * Raises an OFException and aborts execution if the exception is not caught.
 */

- raise;

/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;
@end

/**
 * An OFException indicating there is not enough memory available.
 */
@interface OFNoMemException: OFException
{
	size_t req_size;
}

/**
 * Creates a new no memory exception.
 *
 * \param obj The object which caused the exception
 * \param size The size of the memory that couldn't be allocated
 * \return A new no memory exception
 */
+ newWithObject: (id)obj
	andSize: (size_t)size;

/**
 * Initializes an already allocated no memory exception.
 *
 * \param obj The object which caused the exception
 * \param size The size of the memory that couldn't be allocated
 * \return An initialized new no memory exception
 */
- initWithObject: (id)obj
	 andSize: (size_t)size;

/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;

/**
 * \return The size of the memoory that couldn't be allocated
 */
- (size_t)requestedSize;
@end

@interface OFNotImplementedException: OFException
{
	SEL selector;
}

Modified src/OFString.h from [bd63b22084] to [6e7e01107f].

10
11
12
13
14
15
16



17





18






19





20





21
22



23




24




25






26






27







28






29






30






31
32
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







+
+
+

+
+
+
+
+

+
+
+
+
+
+

+
+
+
+
+

+
+
+
+
+


+
+
+

+
+
+
+

+
+
+
+

+
+
+
+
+
+

+
+
+
+
+
+

+
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+
+
+
+

+
+
+
+
+
+


 */

#import <wchar.h>
#import <stddef.h>

#import "OFObject.h"

/**
 * The OFString class can store and modify string of different types.
 */
@interface OFString: OFObject
/**
 * \param str A constant C string from which the new OFConstCString will be
 *	  created
 * \return A new OFConstCString
 */
+ newAsConstCString: (const char*)str;

/**
 * \param str A constant wide C string from which the new OFConstCString will be
 *	  created
 * \return A new OFConstWideCString
 */
+ newAsConstWideCString: (const wchar_t*)str;

/**
 * \param str A C string from which the new OFConstCString will be created
 * \return A new OFCString
 */
+ newAsCString: (char*)str;

/**
 * \param str A wide C string from which the new OFConstCString will be created
 * \return A new OFWideCString
 */
+ newAsWideCString: (wchar_t*)str;

/**
 * \return The OFString as a C-type string of the type it was created as
 */
- (char*)cString;

/**
 * \return The OFString as a C-type wide string of the type it was created as
 */
- (wchar_t*)wcString;

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

/**
 * Sets the OFString to the specified OFString.
 *
 * \param str The OFString to set the current OFString to
 */
- (OFString*)setTo: (OFString*)str;

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

/**
 * Compares the OFString 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 OFString.
 *
 * \param str An OFString in a compatible type to append
 */
- append: (OFString*)str;

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

/**
 * Append a wide C string to the OFString.
 *
 * \param str A wide C string to append
 */
- appendWideCString: (const wchar_t*)str;
@end

Modified src/OFWideCString.h from [ea45f8fc70] to [81a5610d59].

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
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







-
-
+
+




-
+




-
+














-
+







	wchar_t	*string;
	size_t  length;
}

/**
 * Initializes an already allocated OFWideCString.
 * 
 * \param str A wide C string to initialize the OFWideCString with.
 * \returns An initialized OFWideCString
 * \param str A wide C string to initialize the OFWideCString with
 * \return An initialized OFWideCString
 */
- initAsWideCString: (wchar_t*)str;

/**
 * \return The OFWideCString as a wide C string.
 * \return The OFWideCString as a wide C string
 */
- (wchar_t*)wcString;

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

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

/**
 * Compares the OFWideCString 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 wcscmp.
 * \return An integer which is the result of the comparison, see wcscmp
 */
- (int)compareTo: (OFString*)str;

/**
 * Append another OFString to the OFWideCString.
 *
 * \param str An OFString in a compatible type to append