Representation of a class method.
More...
#import <SCRuntimeMethod.h>
Representation of a class method.
- SDK
- macOS 10.6+, iOS 7.0+, GNUstep
- Since
- version 1.2.6
Provides access to runtime class methods:
- can be used both to obtain information about existing methods of classes, and to create new methods that can be added to classes and protocols directly during execution of application;
- supports both methods of instances and methods of class objects (class methods);
- provides a method call by sending messaged to instances of classes and class objects.
Class instances can thrown the following exceptions:
| - (BOOL) addToClass: |
|
(Class) |
class |
| instance: |
|
(BOOL) |
instance |
|
|
| |
Adds a receiving method to a given existing class.
- Parameters
-
| class | - existing class |
| instance | - YES for adding an instance method, NO for adding a class method |
- Returns
- YES if a method was successfully added, otherwise NO
- Exceptions
-
Adds a receiving method to a given unregistered protocol.
- Parameters
-
| protocol | - an unregistered protocol |
| required | - YES for a required protocol method, NO for an optional protocol method |
| instance | - YES for adding an instance method, NO for adding a class method |
- Exceptions
-
Adds a receiving method to a given unregistered class.
- Parameters
-
| class | - an unregistered class |
| instance | - YES for adding an instance method, NO for adding a class method |
- Returns
- YES if a method was successfully added, otherwise NO
- Exceptions
-
| - (BOOL) availableInClass: |
|
(Class) |
class |
| instance: |
|
(BOOL) |
instance |
|
|
| |
Returns a boolean value that indicates whether a receiving method is present in a given class.
- Parameters
-
| class | - an existing class |
| instance | - YES for an instance method, NO for a class method |
- Returns
- YES if a receving method is present in a given class, otherwise NO
| - (BOOL) availableInProtocol: |
|
(SCRuntimeProtocol *) |
protocol |
| required: |
|
(BOOL) |
required |
| instance: |
|
(BOOL) |
instance |
|
|
| |
Returns a boolean value that indicates whether a receiving method is present in a given protocol.
- Parameters
-
| protocol | - an existing protocol |
| required | - YES for a required protocol method, NO for an optional protocol method |
| instance | - YES for an instance method, NO for a class method |
- Returns
- YES if a receving method is present in a given protocol, otherwise NO
| - (BOOL) availableInProtocolWithName: |
|
(NSString *) |
name |
| required: |
|
(BOOL) |
required |
| instance: |
|
(BOOL) |
instance |
|
|
| |
Returns a boolean value that indicates whether a receiving method is present in a protocol with a given name.
- Parameters
-
| name | - a protocol name |
| required | - YES for a required protocol method, NO for an optional protocol method |
| instance | - YES for an instance method, NO for a class method |
- Returns
- YES if a receving method is present in a protocol with a given name, otherwise NO
Returns a boolean value that indicates whether a receiving method is present in a given unregistered class.
- Parameters
-
| class | - an unregistered class |
| instance | - YES for an instance method, NO for a class method |
- Returns
- YES if a receving method is present in a given class, otherwise NO
| + (instancetype) classMethodWithClass: |
|
(Class) |
class |
| name: |
|
(NSString *) |
name |
|
|
| |
Returns a class method created by using the specified class and method name.
- Parameters
-
| class | - a class |
| name | - a method name |
- Returns
- A created method
- Exceptions
-
| + (instancetype) classMethodWithClass: |
|
(Class) |
class |
| selector: |
|
(SEL) |
selector |
|
|
| |
Returns a class method created by using the specified class and selector.
- Parameters
-
| class | - a class |
| selector | - a selector |
- Returns
- A created method
- Exceptions
-
| - (instancetype) initWithClass: |
|
(Class) |
class |
| instance: |
|
(BOOL) |
instance |
| name: |
|
(NSString *) |
name |
|
|
| |
Initializes a method using the specified class, instance flag and method name.
- Parameters
-
| class | - a class |
| instance | - YES for instance method and NO for class method |
| name | - a name |
- Returns
- A newly initialized method
- Exceptions
-
| - (instancetype) initWithClass: |
|
(Class) |
class |
| instance: |
|
(BOOL) |
instance |
| selector: |
|
(SEL) |
selector |
|
|
| |
Initializes a method using the specified class, instance flag and selector.
- Parameters
-
| class | - a class |
| instance | - YES for instance method and NO for class method |
| selector | - a selector |
- Returns
- A newly initialized method
- Exceptions
-
| - (instancetype) initWithObjCMethod: |
|
(Method) |
method |
|
Initializes a method using a given pointer to existing runtime method.
- Parameters
-
| method | - a pointer to runtime method |
- Returns
- A newly initialized method
| - (instancetype) initWithSelector: |
|
(SEL) |
selector |
| implementation: |
|
(IMP) |
implementation |
| signature: |
|
(NSString *) |
signature |
|
|
| |
Initializes a method using the specified selector, implementation and signature.
- Parameters
-
| selector | - a method selector |
| implementation | - a pointer to a method implementation |
| signature | - a method signature |
- Returns
- A newly initialized method
| - (BOOL) isEqual: |
|
(id) |
object |
|
Returns a boolean value that indicates whether the receiving method is equals to a given object.
- Parameters
-
| object | - an object with which to compare the receiving method |
- Returns
- YES if a given object is equals to the receiving method, otherwise NO
Reimplemented from SCObject.
Returns a boolean value that indicates whether the receiving method is equals to an another given method.
- Parameters
-
| method | - the method with which to compare the receiving method |
- Returns
- YES if the other method is equals to the receiving method, otherwise NO
| - (BOOL) isEqualToName: |
|
(NSString *) |
name |
|
Returns a boolean value that indicates whether the receiving method is equals to a method with a given name.
- Parameters
-
| name | - a name of method with which to compare the receiving method |
- Returns
- YES if the method with a given name is equals to the receiving method, otherwise NO
| - (BOOL) isEqualToObjCMethod: |
|
(Method) |
method |
|
Returns a boolean value that indicates whether the receiving method is equals to a pointer to runtime method.
- Parameters
-
| method | - a pointer to runtime method with which to compare the receiving method |
- Returns
- YES if a method with a given runtime pointer is equals to the receiving method, otherwise NO
| - (BOOL) isEqualToSelector: |
|
(SEL) |
selector |
|
Returns a boolean value that indicates whether the receiving method is equals to a method with a given selector.
- Parameters
-
| selector | - a selector of method with which to compare the receiving method |
- Returns
- YES if the method of a given selector is equals to the receiving method, otherwise NO
| + (instancetype) methodWithClass: |
|
(Class) |
class |
| name: |
|
(NSString *) |
name |
|
|
| |
Returns an instance method created by using the specified class and method name.
- Parameters
-
| class | - a class |
| name | - a method name |
- Returns
- A created method
- Exceptions
-
| + (instancetype) methodWithClass: |
|
(Class) |
class |
| selector: |
|
(SEL) |
selector |
|
|
| |
Returns an instance method created by using the specified class and selector.
- Parameters
-
| class | - a class |
| selector | - a selector |
- Returns
- A created method
- Exceptions
-
| + (instancetype) methodWithObjCMethod: |
|
(Method) |
method |
|
Returns a method created by using a given pointer to existing runtime method.
- Parameters
-
| method | - a pointer to runtime method |
- Returns
- A created method
| + (instancetype) methodWithSelector: |
|
(SEL) |
selector |
| implementation: |
|
(IMP) |
implementation |
| signature: |
|
(NSString *) |
signature |
|
|
| |
Returns a method created by using the specified selector, implementation and signature.
- Parameters
-
| selector | - a method selector |
| implementation | - a pointer to a method implementation |
| signature | - a method signature |
- Returns
- A created method
| - (id) objectFromTarget: |
|
(id) |
target |
| , |
|
|
... |
|
|
| |
Sends a message and returns an object using a given message receiver and comma-separated list of arguments.
- Parameters
-
| target | - a message receiver (class instance or class object) |
| ... | - a comma-separated list of method arguments (for each argument, You must use a macros SC_ARG) |
- Returns
- An object from a method
- Exceptions
-
Sends a message and returns an object using a given message receiver and list of arguments.
- Parameters
-
| target | - a message receiver (class instance or class object) |
| arguments | - a list of method arguments |
- Returns
- An object from a method
- Exceptions
-
| - (void) sendToTarget: |
|
(id) |
target |
| , |
|
|
... |
|
|
| |
Sends a message using a given message receiver and comma-separated list of arguments.
- Parameters
-
| target | - a message receiver (class instance or class object) |
| ... | - a comma-separated list of method arguments (for each argument, You must use a macros SC_ARG) |
- Exceptions
-
| - (void) sendToTarget: |
|
(id) |
target |
| arguments: |
|
(va_list) |
arguments |
|
|
| |
Sends a message using a given message receiver and list of arguments.
- Parameters
-
| target | - a message receiver (class instance or class object) |
| arguments | - a list of method arguments |
- Exceptions
-
| - (void) sendWithValue: |
|
(void *) |
value |
| target: |
|
(id) |
target |
| , |
|
|
... |
|
|
| |
Sends a message using a given buffer for a returning value, message receiver and comma-separated list of arguments.
- Parameters
-
| value | - a pointer to a buffer for returning value |
| target | - a message receiver (class instance or class object) |
| ... | - a comma-separated list of method arguments (for each argument, You must use a macros SC_ARG) |
- Exceptions
-
| - (void) sendWithValue: |
|
(void *) |
value |
| target: |
|
(id) |
target |
| arguments: |
|
(va_list) |
arguments |
|
|
| |
Sends a message using a given buffer for a returning value, message receiver and list of arguments.
- Parameters
-
| value | - a pointer to a buffer for returning value |
| target | - a message receiver (class instance or class object) |
| arguments | - a list of method arguments |
- Exceptions
-
A pointer to a method implementation
The documentation for this class was generated from the following files: