ObjFW  Check-in [5ad7e24b78]

Overview
Comment:Better variable names for initialization of some exceptions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5ad7e24b78d52a736d8f2c68a69d4c68e7eb9dc8e36e4e9f469aa3407fe7610c
User & Date: js on 2008-12-19 22:30:45
Other Links: manifest | tags
Context
2008-12-19
23:15
Add errno in exceptions where it's useful. check-in: e668c03098 user: js tags: trunk
22:30
Better variable names for initialization of some exceptions. check-in: 5ad7e24b78 user: js tags: trunk
22:04
Add - setBlocking and - enableKeepAlives for OFTCPSocket. check-in: 2e6119eb42 user: js tags: trunk
Changes

Modified src/OFExceptions.h from [494e5c908d] to [4f1293951f].

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
{
	char *path;
	char *mode;
}

/**
 * \param obj The object which caused the exception
 * \param p A C string of the path to the file tried to open
 * \param m A C string of the mode in which the file should have been opened
 * \return A new open file failed exception
 */
+ newWithObject: (id)obj
	andPath: (const char*)p
	andMode: (const char*)m;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param obj The object which caused the exception
 * \param p A C string of the path to the file which couldn't be opened
 * \param m A C string of the mode in which the file should have been opened
 * \return An initialized open file failed exception
 */
- initWithObject: (id)obj
	 andPath: (const char*)p
	 andMode: (const char*)m;

- free;

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







|
|



|
|





|
|



|
|







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
{
	char *path;
	char *mode;
}

/**
 * \param obj The object which caused the exception
 * \param path A C string of the path to the file tried to open
 * \param mode A C string of the mode in which the file should have been opened
 * \return A new open file failed exception
 */
+ newWithObject: (id)obj
	andPath: (const char*)path
	andMode: (const char*)mode;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param obj The object which caused the exception
 * \param path A C string of the path to the file which couldn't be opened
 * \param mode A C string of the mode in which the file should have been opened
 * \return An initialized open file failed exception
 */
- 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;
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
{
	char *node;
	char *service;
}

/**
 * \param obj The object which caused the exception
 * \param n The node for which translation was requested
 * \param s The service of the node for which translation was requested
 * \return A new address translation failed exception
 */
+ newWithObject: (id)obj
	andNode: (const char*)n
     andService: (const char*)s;

/**
 * Initializes an already allocated address translation failed exception.
 *
 * \param obj The object which caused the exception
 * \param n The node for which translation was requested
 * \param s The service of the node for which translation was requested
 * \return An initialized address translation failed exception
 */
- initWithObject: (id)obj
	 andNode: (const char*)n
      andService: (const char*)s;

- free;

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







|
|



|
|





|
|



|
|







326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
{
	char *node;
	char *service;
}

/**
 * \param obj The object which caused the exception
 * \param node The node for which translation was requested
 * \param service The service of the node for which translation was requested
 * \return A new address translation failed exception
 */
+ newWithObject: (id)obj
	andNode: (const char*)node
     andService: (const char*)service;

/**
 * Initializes an already allocated address translation failed exception.
 *
 * \param obj The object which caused the exception
 * \param node The node for which translation was requested
 * \param service The service of the node for which translation was requested
 * \return An initialized address translation failed exception
 */
- initWithObject: (id)obj
	 andNode: (const char*)node
      andService: (const char*)service;

- free;

/**
 * \return An error message for the exception as a C string.
 */
- (const char*)cString;
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
{
	char *host;
	uint16_t port;
}

/**
 * \param obj The object which caused the exception
 * \param h The host to which the connection failed
 * \param p The port on the host to which the connection failed
 * \return A new connection failed exception
 */
+ newWithObject: (id)obj
	andHost: (const char*)h
	andPort: (uint16_t)p;

/**
 * Initializes an already allocated connection failed exception.
 *
 * \param obj The object which caused the exception
 * \param h The host to which the connection failed
 * \param p The port on the host to which the connection failed
 * \return An initialized connection failed exception
 */
- initWithObject: (id)obj
	 andHost: (const char*)h
	 andPort: (uint16_t)p;

- free;

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







|
|



|
|





|
|



|
|







375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
{
	char *host;
	uint16_t port;
}

/**
 * \param obj The object which caused the exception
 * \param host The host to which the connection failed
 * \param port The port on the host to which the connection failed
 * \return A new connection failed exception
 */
+ newWithObject: (id)obj
	andHost: (const char*)host
	andPort: (uint16_t)port;

/**
 * Initializes an already allocated connection failed exception.
 *
 * \param obj The object which caused the exception
 * \param host The host to which the connection failed
 * \param port The port on the host to which the connection failed
 * \return An initialized connection failed exception
 */
- initWithObject: (id)obj
	 andHost: (const char*)host
	 andPort: (uint16_t)port;

- free;

/**
 * \return An error message for the exception as a C string.
 */
- (const char*)cString;
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
	char *host;
	uint16_t port;
	int family;
}

/**
 * \param obj The object which caused the exception
 * \param h The host on which binding failed
 * \param p The port on which binding failed
 * \param f The family for which binnding failed
 * \return A new bind failed exception
 */
+ newWithObject: (id)obj
	andHost: (const char*)h
	andPort: (uint16_t)p
      andFamily: (int)f;

/**
 * Initializes an already allocated bind failed exception.
 *
 * \param obj The object which caused the exception
 * \param h The host on which binding failed
 * \param p The port on which binding failed
 * \param f The family for which binnding failed
 * \return An initialized bind failed exception
 */
- initWithObject: (id)obj
	 andHost: (const char*)h
	 andPort: (uint16_t)p
       andFamily: (int)f;

- free;

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







|
|
|



|
|
|





|
|
|



|
|
|







425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
	char *host;
	uint16_t port;
	int family;
}

/**
 * \param obj The object which caused the exception
 * \param host The host on which binding failed
 * \param port The port on which binding failed
 * \param family The family for which binnding failed
 * \return A new bind failed exception
 */
+ newWithObject: (id)obj
	andHost: (const char*)host
	andPort: (uint16_t)port
      andFamily: (int)family;

/**
 * Initializes an already allocated bind failed exception.
 *
 * \param obj The object which caused the exception
 * \param host The host on which binding failed
 * \param port The port on which binding failed
 * \param family The family for which binnding failed
 * \return An initialized bind failed exception
 */
- initWithObject: (id)obj
	 andHost: (const char*)host
	 andPort: (uint16_t)port
       andFamily: (int)family;

- free;

/**
 * \return An error message for the exception as a C string.
 */
- (const char*)cString;
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
@interface OFListenFailedException: OFException
{
	int backlog;
}

/**
 * \param obj The object which caused the exception
 * \param b The requested size of the back log
 * \return A new listen failed exception
 */
+ newWithObject: (id)obj
     andBackLog: (int)b;

/**
 * Initializes an already allocated listen failed exception
 *
 * \param obj The object which caused the exception
 * \param b The requested size of the back log
 * \return An initialized listen failed exception
 */
- initWithObject: (id)obj
      andBackLog: (int)b;

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

/**







|



|





|



|







482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
@interface OFListenFailedException: OFException
{
	int backlog;
}

/**
 * \param obj The object which caused the exception
 * \param backlog The requested size of the back log
 * \return A new listen failed exception
 */
+ newWithObject: (id)obj
     andBackLog: (int)backlog;

/**
 * Initializes an already allocated listen failed exception
 *
 * \param obj The object which caused the exception
 * \param backlog The requested size of the back log
 * \return An initialized listen failed exception
 */
- initWithObject: (id)obj
      andBackLog: (int)backlog;

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

/**

Modified src/OFExceptions.m from [e0a392a175] to [735948244b].

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

	return string;
}
@end

@implementation OFOpenFileFailedException
+ newWithObject: (id)obj
	andPath: (const char*)p
	andMode: (const char*)m
{
	return [[self alloc] initWithObject: obj
				    andPath: p
				    andMode: m];
}

- initWithObject: (id)obj
	 andPath: (const char*)p
	 andMode: (const char*)m
{
	if ((self = [super initWithObject: obj])) {
		path = (p != NULL ? strdup(p) : NULL);
		mode = (m != NULL ? strdup(m) : NULL);
	}

	return self;
}

- free
{







|
|


|
|



|
|


|
|







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

	return string;
}
@end

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

- initWithObject: (id)obj
	 andPath: (const char*)path_
	 andMode: (const char*)mode_
{
	if ((self = [super initWithObject: obj])) {
		path = (path_ != NULL ? strdup(path_) : NULL);
		mode = (mode_ != NULL ? strdup(mode_) : NULL);
	}

	return self;
}

- free
{
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

	return string;
}
@end

@implementation OFAddressTranslationFailedException
+ newWithObject: (id)obj
	andNode: (const char*)n
     andService: (const char*)s
{
	return [self newWithObject: obj
			   andNode: n
			andService: s];
}

- initWithObject: (id)obj
	 andNode: (const char*)n
      andService: (const char*)s
{
	if ((self = [super initWithObject: obj])) {
		node = (n != NULL ? strdup(n) : NULL);
		service = (s != NULL ? strdup(s) : NULL);
	}

	return self;
}

- free
{







|
|


|
|



|
|


|
|







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

	return string;
}
@end

@implementation OFAddressTranslationFailedException
+ newWithObject: (id)obj
	andNode: (const char*)node_
     andService: (const char*)service_
{
	return [self newWithObject: obj
			   andNode: node_
			andService: service_];
}

- initWithObject: (id)obj
	 andNode: (const char*)node_
      andService: (const char*)service_
{
	if ((self = [super initWithObject: obj])) {
		node = (node_ != NULL ? strdup(node_) : NULL);
		service = (service_ != NULL ? strdup(service_) : NULL);
	}

	return self;
}

- free
{
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
{
	return service;
}
@end

@implementation OFConnectionFailedException
+ newWithObject: (id)obj
	andHost: (const char*)h
	andPort: (uint16_t)p
{
	return [self newWithObject: obj
			   andHost: h
			   andPort: p];
}

- initWithObject: (id)obj
	 andHost: (const char*)h
	 andPort: (uint16_t)p
{
	if ((self = [super initWithObject: obj])) {
		host = (h != NULL ? strdup(h) : NULL);
		port = p;
	}

	return self;
}

- free
{







|
|


|
|



|
|


|
|







408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
{
	return service;
}
@end

@implementation OFConnectionFailedException
+ newWithObject: (id)obj
	andHost: (const char*)host_
	andPort: (uint16_t)port_
{
	return [self newWithObject: obj
			   andHost: host_
			   andPort: port_];
}

- initWithObject: (id)obj
	 andHost: (const char*)host_
	 andPort: (uint16_t)port_
{
	if ((self = [super initWithObject: obj])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
	}

	return self;
}

- free
{
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
{
	return port;
}
@end

@implementation OFBindFailedException
+ newWithObject: (id)obj
	andHost: (const char*)h
	andPort: (uint16_t)p
      andFamily: (int)f
{
	return [self newWithObject: obj
			   andHost: h
			   andPort: p
			 andFamily: f];
}

- initWithObject: (id)obj
	 andHost: (const char*)h
	 andPort: (uint16_t)p
       andFamily: (int)f
{
	if ((self = [super initWithObject: obj])) {
		host = (h != NULL ? strdup(h) : NULL);
		port = p;
		family = f;
	}

	return self;
}

- free
{







|
|
|


|
|
|



|
|
|


|
|
|







460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
{
	return port;
}
@end

@implementation OFBindFailedException
+ newWithObject: (id)obj
	andHost: (const char*)host_
	andPort: (uint16_t)port_
      andFamily: (int)family_
{
	return [self newWithObject: obj
			   andHost: host_
			   andPort: port_
			 andFamily: family_];
}

- initWithObject: (id)obj
	 andHost: (const char*)host_
	 andPort: (uint16_t)port_
       andFamily: (int)family_
{
	if ((self = [super initWithObject: obj])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
		family = family_;
	}

	return self;
}

- free
{
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
{
	return family;
}
@end

@implementation OFListenFailedException
+ newWithObject: (id)obj
     andBackLog: (int)b
{
	return [[self alloc] initWithObject: obj
				 andBackLog: b];
}

- initWithObject: (id)obj
      andBackLog: (int)b
{
	if ((self = [super initWithObject: obj]))
		backlog = b;

	return self;
}

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







|


|



|


|







521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
{
	return family;
}
@end

@implementation OFListenFailedException
+ newWithObject: (id)obj
     andBackLog: (int)backlog_
{
	return [[self alloc] initWithObject: obj
				 andBackLog: backlog_];
}

- initWithObject: (id)obj
      andBackLog: (int)backlog_
{
	if ((self = [super initWithObject: obj]))
		backlog = backlog_;

	return self;
}

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