ObjFW  Check-in [32efb8025f]

Overview
Comment:Add OFUnsupportedVersionException.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 32efb8025ffb0914c4e8058efb7201e7fa5942f5b478f988dfc4dc15466a48fc
User & Date: js on 2012-07-31 11:25:46
Other Links: manifest | tags
Context
2012-07-31
11:26
runtime: Export structs for properties. check-in: 8a366ec6f7 user: js tags: trunk
11:25
Add OFUnsupportedVersionException. check-in: 32efb8025f user: js tags: trunk
2012-07-29
15:23
objfw-config: Always add -g to the flags. check-in: 0869b36536 user: js tags: trunk
Changes

Modified src/exceptions/Makefile from [9c19595da9] to [c7632543f8].

50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
       OFSymlinkFailedException.m		\
       OFThreadJoinFailedException.m		\
       OFThreadStartFailedException.m		\
       OFThreadStillRunningException.m		\
       OFTruncatedDataException.m		\
       OFUnboundNamespaceException.m		\
       OFUnsupportedProtocolException.m		\

       OFWriteFailedException.m

INCLUDES = ${SRCS:.m=.h}

include ../../buildsys.mk

CPPFLAGS += -I. -I.. -I../.. -I../runtime
LD = ${OBJC}







>








50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
       OFSymlinkFailedException.m		\
       OFThreadJoinFailedException.m		\
       OFThreadStartFailedException.m		\
       OFThreadStillRunningException.m		\
       OFTruncatedDataException.m		\
       OFUnboundNamespaceException.m		\
       OFUnsupportedProtocolException.m		\
       OFUnsupportedVersionException.m		\
       OFWriteFailedException.m

INCLUDES = ${SRCS:.m=.h}

include ../../buildsys.mk

CPPFLAGS += -I. -I.. -I../.. -I../runtime
LD = ${OBJC}

Added src/exceptions/OFUnsupportedVersionException.h version [16fdf7d893].













































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"

/**
 * \brief An exception indicating that the specified version of the format or
 *	  protocol is not supported.
 */
@interface OFUnsupportedVersionException: OFException
{
	OFString *version;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, assign) OFString *version;
#endif

/**
 * \param class_ The class of the object which caused the exception
 * \param version The version which is unsupported
 * \return A new unsupported version exception
 */
+ exceptionWithClass: (Class)class_
	     version: (OFString*)version;

/**
 * Initializes an already allocated unsupported protocol exception
 *
 * \param class_ The class of the object which caused the exception
 * \param version The version which is unsupported
 * \return An initialized unsupported version exception
 */
- initWithClass: (Class)class_
	version: (OFString*)version;

/**
 * \return The version which is unsupported
 */
- (OFString*)version;
@end

Added src/exceptions/OFUnsupportedVersionException.m version [3fa276f5bb].





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFUnsupportedVersionException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

@implementation OFUnsupportedVersionException
+ exceptionWithClass: (Class)class_
	     version: (OFString*)version
{
	return [[[self alloc] initWithClass: class_
				    version: version] autorelease];
}

- initWithClass: (Class)class_
{
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

- initWithClass: (Class)class_
	version: (OFString*)version_
{
	self = [super initWithClass: class_];

	@try {
		version = [version_ copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[version release];

	[super dealloc];
}

- (OFString*)description
{
	if (description != nil)
		return description;

	description = [[OFString alloc] initWithFormat:
	    @"Version %@ of the format or protocol is not supported by class "
	    @"%@", version, inClass];

	return description;
}

- (OFString*)version
{
	return version;
}
@end