Overview
Comment: | Add -[typeEncodingForSelector] and +[typeEncodingForInstanceSelector:]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
477d06da143246ac524ca07147c93362 |
User & Date: | js on 2010-09-19 22:39:48 |
Other Links: | manifest | tags |
Context
2010-09-19
| ||
22:59 | Optimize handling of ASCII strings. check-in: f9ed4c1d11 user: js tags: trunk | |
22:39 | Add -[typeEncodingForSelector] and +[typeEncodingForInstanceSelector:]. check-in: 477d06da14 user: js tags: trunk | |
22:35 | Add -[unicodeString] to OFString. check-in: b5f0fc343d user: js tags: trunk | |
Changes
Modified src/OFObject.h from [acfaa1e5ed] to [0ecdb91882].
︙ | ︙ | |||
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /** * \param selector The selector for which the method should be returned * \return The implementation of the instance method for the specified selector * or nil if it isn't implemented */ + (IMP)instanceMethodForSelector: (SEL)selector; /** * Replaces a class method implementation with another implementation. * * \param newimp The new implementation for the class method * \param selector The selector of the class method to replace * \return The old implementation */ | > > > > > > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | /** * \param selector The selector for which the method should be returned * \return The implementation of the instance method for the specified selector * or nil if it isn't implemented */ + (IMP)instanceMethodForSelector: (SEL)selector; /** * \param selector The selector for which the type encoding should be returned * \return The type encoding of the instance method for the specified selector */ + (const char*)typeEncodingForInstanceSelector: (SEL)selector; /** * Replaces a class method implementation with another implementation. * * \param newimp The new implementation for the class method * \param selector The selector of the class method to replace * \return The old implementation */ |
︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | /** * \param selector The selector for which the method should be returned * * \return The implementation for the specified selector */ - (IMP)methodForSelector: (SEL)selector; /** * Checks two objects for equality. * * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * * \param obj The object which should be tested for equality | > > > > > > > | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | /** * \param selector The selector for which the method should be returned * * \return The implementation for the specified selector */ - (IMP)methodForSelector: (SEL)selector; /** * \param selector The selector for which the type encoding should be returned * * \return The type encoding for the specified selector */ - (const char*)typeEncodingForSelector: (SEL)selector; /** * Checks two objects for equality. * * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * * \param obj The object which should be tested for equality |
︙ | ︙ |
Modified src/OFObject.m from [4840601dc7] to [25a48a48d7].
︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 | return objc_get_instance_method(self, selector); #elif defined(OF_APPLE_RUNTIME) return class_getMethodImplementation(self, selector); #else return method_get_imp(class_get_instance_method(self, selector)); #endif } + (IMP)setImplementation: (IMP)newimp forClassMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newimp == (IMP)0 || !class_respondsToSelector(self->isa, selector)) @throw [OFInvalidArgumentException newWithClass: self | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | return objc_get_instance_method(self, selector); #elif defined(OF_APPLE_RUNTIME) return class_getMethodImplementation(self, selector); #else return method_get_imp(class_get_instance_method(self, selector)); #endif } + (const char*)typeEncodingForInstanceSelector: (SEL)selector { #if defined(OF_APPLE_RUNTIME) Method m; const char *ret; if ((m = class_getInstanceMethod(self, selector)) == NULL || (ret = method_getTypeEncoding(m)) == NULL) @throw [OFNotImplementedException newWithClass: self selector: selector]; return ret; #elif defined(OF_GNU_RUNTIME) Method_t m; if ((m = class_get_instance_method(self, selector)) == NULL || m->method_types == NULL) @throw [OFNotImplementedException newWithClass: self selector: selector]; return m->method_types; #elif defined(OF_OBJFW_RUNTIME) const char *ret; if ((ret = objc_get_type_encoding(self, selector)) == NULL) @throw [OFNotImplementedException newWithClass: self selector: selector]; return ret; #endif } + (IMP)setImplementation: (IMP)newimp forClassMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newimp == (IMP)0 || !class_respondsToSelector(self->isa, selector)) @throw [OFInvalidArgumentException newWithClass: self |
︙ | ︙ | |||
398 399 400 401 402 403 404 405 406 407 408 409 410 411 | { #ifdef OF_APPLE_RUNTIME return class_getMethodImplementation(isa, selector); #else return objc_msg_lookup(self, selector); #endif } - (BOOL)isEqual: (id)obj { /* Classes containing data should reimplement this! */ return (self == obj ? YES : NO); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | { #ifdef OF_APPLE_RUNTIME return class_getMethodImplementation(isa, selector); #else return objc_msg_lookup(self, selector); #endif } - (const char*)typeEncodingForSelector: (SEL)selector { #if defined(OF_APPLE_RUNTIME) Method m; const char *ret; if ((m = class_getInstanceMethod(isa, selector)) == NULL || (ret = method_getTypeEncoding(m)) == NULL) @throw [OFNotImplementedException newWithClass: isa selector: selector]; return ret; #elif defined(OF_GNU_RUNTIME) Method_t m; if ((m = class_get_instance_method(isa, selector)) == NULL || m->method_types == NULL) @throw [OFNotImplementedException newWithClass: isa selector: selector]; return m->method_types; #elif defined(OF_OBJFW_RUNTIME) const char *ret; if ((ret = objc_get_type_encoding(isa, selector)) == NULL) @throw [OFNotImplementedException newWithClass: isa selector: selector]; return ret; #endif } - (BOOL)isEqual: (id)obj { /* Classes containing data should reimplement this! */ return (self == obj ? YES : NO); } |
︙ | ︙ |