Differences From Artifact [1b0dd75e24]:
- File src/OFExceptions.m — part of check-in [f1b749d113] at 2009-01-05 00:59:06 on branch trunk — Update copyright. (user: js, size: 11084) [annotate] [blame] [check-ins using]
To Artifact [24b883adc0]:
- File
src/OFExceptions.m
— part of check-in
[61a6ac873a]
at
2009-02-14 17:08:21
on branch trunk
— Big diff, see details.
* Add OFComparable protocol.
* Add OFInvalidArgument exception - needs that sel_getName vs.
sel_get_name stuff again, therefore reintroduce it.
* Implement proper copy method for OFString and OFArray.
* Add isEqual: and compare: for OFString and OFArray. (user: js, size: 11890) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #else #import <windows.h> #define GET_ERR GetLastError() #define GET_SOCK_ERR WSAGetLastError() #define ERRFMT "Error code was: %d" #define ERRPARAM err #endif #import "OFExceptions.h" #ifndef HAVE_ASPRINTF #import "asprintf.h" #endif @implementation OFException + newWithClass: (Class)class_ | > > > > > > > > > > > > | 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 | #else #import <windows.h> #define GET_ERR GetLastError() #define GET_SOCK_ERR WSAGetLastError() #define ERRFMT "Error code was: %d" #define ERRPARAM err #endif #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_ |
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | return string; asprintf(&string, "Value out of range in class %s!", [class name]); return string; } @end @implementation OFInvalidEncodingException - (const char*)cString { if (string != NULL) return string; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | return string; asprintf(&string, "Value out of range in class %s!", [class name]); return string; } @end @implementation OFInvalidArgumentException + 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 argument for method %s of class %s is invalid!", SEL_NAME(selector), [class name]); return string; } @end @implementation OFInvalidEncodingException - (const char*)cString { if (string != NULL) return string; asprintf(&string, "The encoding is invalid for class %s!", [class name]); return string; } @end @implementation OFInvalidFormatException - (const char*)cString { if (string != NULL) return string; asprintf(&string, "The format is invalid for class %s!", [class name]); return string; } @end @implementation OFInitializationFailedException - (const char*)cString |
︙ | ︙ |