ObjFW  Check-in [10be0cc7e6]

Overview
Comment:New OFInitializationFailedException.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 10be0cc7e63908c9834767adffad429ccac7892283d84fb8ea8a0428a2b0a103
User & Date: js on 2008-12-23 15:09:09
Other Links: manifest | tags
Context
2008-12-23
16:51
Add Win32 support to OFTCPSocket. Even IPv6 works! check-in: 839112196f user: js tags: trunk
15:09
New OFInitializationFailedException. check-in: 10be0cc7e6 user: js tags: trunk
13:42
Make it possible to build only a static library.
This way, it works on Windows.
check-in: d8736e1aa3 user: js tags: trunk
Changes

Modified src/OFExceptions.h from [f3d6211985] to [7922fd98d6].

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

/**
 * \return The object that caused the exception
 */
- (id)object;

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

/**
 * An OFException indicating there is not enough memory available.
 */







|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

/**
 * \return The object that caused the exception
 */
- (id)object;

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

/**
 * An OFException indicating there is not enough memory available.
 */
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 * \param size The size of the memory that couldn't be allocated
 * \return An initialized no memory exception
 */
- initWithObject: (id)obj
	 andSize: (size_t)size;

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

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







|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 * \param size The size of the memory that couldn't be allocated
 * \return An initialized no memory exception
 */
- initWithObject: (id)obj
	 andSize: (size_t)size;

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

/**
 * \return The size of the memoory that couldn't be allocated
 */
- (size_t)requestedSize;
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143



































144
145
146
147
148
149
150
 * \param ptr A pointer to the memory that is not part of the object
 * \return An initialized memory not part of object exception
 */
- initWithObject: (id)obj
      andPointer: (void*)ptr;

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

/**
 * \return A pointer to the memory which is not part of the object
 */
- (void*)pointer;
@end

/**
 * An OFException indicating the given value is out of range.
 */
@interface OFOutOfRangeException: OFException {}
/**
 * \return An error message for the exception as a C String
 */
- (const char*)cString;
@end

/**
 * An OFException indicating that the encoding is invalid for this object.
 */
@interface OFInvalidEncodingException: OFException {}
/**
 * \return An error message for the exception as a C String
 */
- (const char*)cString;



































@end

/**
 * An OFException indicating the file couldn't be opened.
 */
@interface OFOpenFileFailedException: OFException
{







|














|









|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
 * \param ptr A pointer to the memory that is not part of the object
 * \return An initialized memory not part of object exception
 */
- initWithObject: (id)obj
      andPointer: (void*)ptr;

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

/**
 * \return A pointer to the memory which is not part of the object
 */
- (void*)pointer;
@end

/**
 * An OFException indicating the given value is out of range.
 */
@interface OFOutOfRangeException: OFException {}
/**
 * \return An error message for the exception as a C string
 */
- (const char*)cString;
@end

/**
 * An OFException indicating that the encoding is invalid for this object.
 */
@interface OFInvalidEncodingException: OFException {}
/**
 * \return An error message for the exception as a C string
 */
- (const char*)cString;
@end

/**
 * An OFException indicating that initializing something failed.
 */
@interface OFInitializationFailedException: OFException
{
	Class class;
}

/**
 * Creates a new exception.
 *
 * \param class The class which caused the exception
 * \return A new exception
 */
+ newWithClass: (Class)class;

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

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

/**
 * \return The class which caused the exception
 */
- (Class)class;
@end

/**
 * An OFException indicating the file couldn't be opened.
 */
@interface OFOpenFileFailedException: OFException
{
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
- initWithObject: (id)obj
	 andPath: (const char*)path
	 andMode: (const char*)mode;

- free;

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

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;







|







209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
- initWithObject: (id)obj
	 andPath: (const char*)path
	 andMode: (const char*)mode;

- free;

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

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
@end

/**
 * An OFException indicating a read to the file failed.
 */
@interface OFReadFailedException: OFReadOrWriteFailedException {}
/**
 * \return An error message for the exception as a C String
 */
- (const char*)cString;
@end

/**
 * An OFException indicating a write to the file failed.
 */
@interface OFWriteFailedException: OFReadOrWriteFailedException {}
/**
 * \return An error message for the exception as a C String
 */
- (const char*)cString;
@end

/**
 * An OFException indicating that setting an option failed.
 */







|









|







306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
@end

/**
 * An OFException indicating a read to the file failed.
 */
@interface OFReadFailedException: OFReadOrWriteFailedException {}
/**
 * \return An error message for the exception as a C string
 */
- (const char*)cString;
@end

/**
 * An OFException indicating a write to the file failed.
 */
@interface OFWriteFailedException: OFReadOrWriteFailedException {}
/**
 * \return An error message for the exception as a C string
 */
- (const char*)cString;
@end

/**
 * An OFException indicating that setting an option failed.
 */

Modified src/OFExceptions.m from [8d853c6d4e] to [b883a225ce].

149
150
151
152
153
154
155

































156
157
158
159
160
161
162

	asprintf(&string, "The encoding is invalid for object of classs %s!",
	    [object name]);

	return string;
}
@end


































@implementation OFOpenFileFailedException
+ newWithObject: (id)obj
	andPath: (const char*)path_
	andMode: (const char*)mode_
{
	return [[self alloc] initWithObject: obj







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

	asprintf(&string, "The encoding is invalid for object of classs %s!",
	    [object name]);

	return string;
}
@end

@implementation OFInitializationFailedException
+ newWithClass: (Class)class_
{
	return [[self alloc] initWithClass: class_];
}

- initWithClass: (Class)class_
{
	if ((self = [super init])) {
		object = nil;
		string = NULL;
		class = class_;
	}

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Initialization failed for class %s!", [class name]);

	return string;
}

- (Class)class
{
	return class;
}
@end

@implementation OFOpenFileFailedException
+ newWithObject: (id)obj
	andPath: (const char*)path_
	andMode: (const char*)mode_
{
	return [[self alloc] initWithObject: obj