ObjFW  Diff

Differences From Artifact [8fbc274411]:

To Artifact [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
 * 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.)




@interface OFException: OFObject
{
	id   object;
	char *string;
}







+ newWithObject: (id)obj;







- initWithObject: (id)obj;




- free;





- raise;




- (char*)cString;
@end




@interface OFNoMemException: OFException
{
	size_t req_size;
}








+ newWithObject: (id)obj
	andSize: (size_t)size;








- initWithObject: (id)obj
	 andSize: (size_t)size;




- (char*)cString;




- (size_t)requestedSize;
@end

@interface OFNotImplementedException: OFException
{
	SEL selector;
}







|

>
>
>






>
>
>
>
>
>

>
>
>
>
>
>
>

>
>
>
>

>
>
>
>
>

>
>
>
>



>
>
>





>
>
>
>
>
>
>


>
>
>
>
>
>
>
>


>
>
>
>

>
>
>
>







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.) */

/**
 * 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;
}