ObjFW  Check-in [ca4a07a578]

Overview
Comment:Add OFNotImplementedException.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ca4a07a578148403afad49eba6bf9014b2619d737615ac52bfb48e96fc5b7695
User & Date: js on 2009-04-12 14:05:37
Other Links: manifest | tags
Context
2009-04-12
14:51
Get rid of the dependency on Object. check-in: cbdd534337 user: js tags: trunk
14:05
Add OFNotImplementedException. check-in: ca4a07a578 user: js tags: trunk
2009-04-10
01:40
Forgot to remove old workaround for a warning in OFConstString.h. check-in: 26a6fdf806 user: js tags: trunk
Changes

Modified configure.ac from [2a061b3274] to [7cf98941d7].

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
		size_max="((size_t)-1)"])
	AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])])

AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")

AC_CHECK_HEADER(objc/runtime.h,
	[AC_DEFINE(HAVE_OBJC_RUNTIME_H, 1, [Whether we have objc/runtime.h])])
AC_CHECK_LIB(objc, sel_get_name,
	[AC_DEFINE(HAVE_SEL_GET_NAME, 1, [Whether we have sel_get_name])])
AC_CHECK_LIB(objc, sel_getName,
	[AC_DEFINE(HAVE_SEL_GETNAME, 1, [Whether we have sel_getName])])

AC_CHECK_FUNC(asprintf, [
	have_asprintf="yes"
	AC_DEFINE(HAVE_ASPRINTF, 1, "Whether we have asprintf")], [
	have_asprintf="no"
	AC_SUBST(ASPRINTF_C, "asprintf.c")])








<
<
<
<







55
56
57
58
59
60
61




62
63
64
65
66
67
68
		size_max="((size_t)-1)"])
	AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])])

AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")

AC_CHECK_HEADER(objc/runtime.h,
	[AC_DEFINE(HAVE_OBJC_RUNTIME_H, 1, [Whether we have objc/runtime.h])])





AC_CHECK_FUNC(asprintf, [
	have_asprintf="yes"
	AC_DEFINE(HAVE_ASPRINTF, 1, "Whether we have asprintf")], [
	have_asprintf="no"
	AC_SUBST(ASPRINTF_C, "asprintf.c")])

Modified src/OFExceptions.h from [3a58ffe4f3] to [edbf4d480b].

109
110
111
112
113
114
115



























116
117
118
119
120
121
122

/**
 * \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 {}
@end

/**







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







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

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

/**
 * An OFException indicating that a method or part of it is not implemented.
 */
@interface OFNotImplementedException: OFException
{
	SEL selector;
}

/**
 * \param class The class of the object which caused the exception
 * \param selector The selector which is not or not fully implemented
 * \return A new not implemented exception
 */
+ newWithClass: (Class)class
   andSelector: (SEL)selector;

/**
 * Initializes an already allocated not implemented exception.
 *
 * \param class The class of the object which caused the exception
 * \param selector The selector which is not or not fully implemented
 * \return An initialized not implemented exception
 */
- initWithClass: (Class)class
    andSelector: (SEL)selector;
@end

/**
 * An OFException indicating the given value is out of range.
 */
@interface OFOutOfRangeException: OFException {}
@end

/**

Modified src/OFExceptions.m from [f4f4a8078d] to [6c6b7a9a76].

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
#define GET_ERR	     GetLastError()
#define GET_SOCK_ERR WSAGetLastError()
#define ERRFMT	     "Error code was: %d"
#define ERRPARAM     err
#endif

#import <objc/objc-api.h>
#ifdef HAVE_OBJC_RUNTIME_H


#import <objc/runtime.h>

#endif

#import "OFExceptions.h"

#if defined(HAVE_SEL_GET_NAME)
#define SEL_NAME(x) sel_get_name(x)
#elif defined(HAVE_SEL_GETNAME)
#define SEL_NAME(x) sel_getName(x)
#else
#error "You need either sel_get_name() or sel_getName()!"
#endif

#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

@implementation OFException
+ newWithClass: (Class)class_
{







|
>
>

>




<
<
<
<
<
<
<
<







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42








43
44
45
46
47
48
49
#define GET_ERR	     GetLastError()
#define GET_SOCK_ERR WSAGetLastError()
#define ERRFMT	     "Error code was: %d"
#define ERRPARAM     err
#endif

#import <objc/objc-api.h>
#ifdef __objc_INCLUDE_GNU
#define SEL_NAME(x) sel_get_name(x)
#else
#import <objc/runtime.h>
#define SEL_NAME(x) sel_getName(x)
#endif

#import "OFExceptions.h"









#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

@implementation OFException
+ newWithClass: (Class)class_
{
149
150
151
152
153
154
155





























156
157
158
159
160
161
162
}

- (void*)pointer
{
	return pointer;
}
@end






























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








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







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

- (void*)pointer
{
	return pointer;
}
@end

@implementation OFNotImplementedException
+ newWithClass: (Class)class_
   andSelector: (SEL)selector_
{
	return [[self alloc] initWithClass: class_
			       andSelector: selector_];
}

- initWithClass: (Class)class_
    andSelector: (SEL)selector_
{
	if ((self = [super initWithClass: class_]))
		selector = selector_;

	return self;
}

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

	asprintf(&string, "The method %s of class %s is not or not fully "
	    "implemented!", SEL_NAME(selector), [class name]);

	return string;
}
@end

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