The root class for all other classes inside ObjFW.
More...
#import <ObjFW/OFObject.h>
Inherits <OFObject>.
Inherited by OFASN1BitString, OFASN1Boolean, OFASN1Enumerated, OFASN1IA5String, OFASN1Integer, OFASN1NumericString, OFASN1ObjectIdentifier, OFASN1OctetString, OFASN1PrintableString, OFASN1UTF8String, OFASN1Value, OFAllocFailedException, OFApplication, OFArray, OFBlock, OFCharacterSet, OFColor, OFDNSQuery, OFDNSResolver, OFDNSResolverContext, OFDNSResolverSettings, OFDNSResourceRecord, OFDNSResponse, OFData, OFDatagramSocket, OFDate, OFDictionary, OFEnumerator, OFException, OFFileManager, OFHMAC, OFHTTPClient, OFHTTPClientRequestHandler, OFHTTPClientSyncPerformer, OFHTTPCookie, OFHTTPCookieManager, OFHTTPRequest, OFHTTPServer, OFHTTPServerConnection, OFHostAddressResolver, OFHostAddressResolverDelegate, OFINICategory, OFINICategoryComment, OFINICategoryPair, OFINIFile, OFIPSocketAsyncConnector, OFInvocation, OFKernelEventObserver, OFLHAArchive, OFLHAArchiveEntry, OFList, OFLocale, OFMD5Hash, OFMapTable, OFMapTableEnumerator, OFMessagePackExtension, OFMethodSignature, OFMutex, OFNull, OFOptionsParser, OFPair, OFPlugin, OFRIPEMD160Hash, OFRecursiveMutex, OFRunLoop, OFRunLoopQueueItem, OFRunLoopState, OFSCTPSocketConnectDelegate, OFSHA1Hash, OFSHA224Or256Hash, OFSHA384Or512Hash, OFSPXSocketAsyncConnectDelegate, OFSPXStreamSocketAsyncConnectDelegate, OFSandbox, OFSequencedPacketSocket, OFSet, OFSettings, OFStream, OFString, OFSystemInfo, OFTCPSocketConnectDelegate, OFTCPSocketSOCKS5Connector, OFTarArchive, OFTarArchiveEntry, OFThread, OFThreadPool, OFThreadPoolJob, OFTimer, OFTriple, OFURL, OFURLHandler, OFValue, OFWindowsRegistryKey, OFXMLElementBuilder, OFXMLElementElementBuilderDelegate, OFXMLNode, OFXMLParser, OFZIPArchive, OFZIPArchiveEntry, and OFZIPArchiveLocalFileHeader.
The root class for all other classes inside ObjFW.
◆ alloc
Allocates memory for an instance of the class and sets up the memory pool for the object.
This method will never return nil
, instead, it will throw an OFAllocFailedException.
- Returns
- The allocated object
◆ class
Returns the class.
- Returns
- The class
Reimplemented from <OFObject>.
◆ className
Returns the name of the class as a string.
- Returns
- The name of the class as a string
◆ conformsToProtocol:
+ (bool) conformsToProtocol: |
|
(Protocol *) |
protocol |
|
Checks whether the class conforms to a given protocol.
- Parameters
-
protocol | The protocol which should be checked for conformance |
- Returns
- A boolean whether the class conforms to the specified protocol
Reimplemented from <OFObject>.
◆ copy
Returns the class.
This method exists so that classes can be used in collections requiring conformance to the OFCopying protocol.
- Returns
- The class of the object
◆ dealloc
Deallocates the object.
It is automatically called when the retain count reaches zero.
This also frees all memory in its memory pool.
◆ description
Returns a description for the class, which is usually the class name.
This is mostly for debugging purposes.
- Returns
- A description for the class, which is usually the class name
Reimplemented in OFException, and OFAllocFailedException.
◆ doesNotRecognizeSelector:
- (void) doesNotRecognizeSelector: |
|
(SEL) |
selector |
|
Handles messages which are not understood by the receiver.
- Warning
- If you override this method, you must make sure that it never returns!
- Parameters
-
selector | The selector not understood by the receiver |
◆ forwardingTargetForSelector:
- (id) forwardingTargetForSelector: |
|
(SEL) |
selector |
|
This method is called when resolveClassMethod: or resolveInstanceMethod: returned false. It should return a target to which the message should be forwarded.
- Note
- When the message should not be forwarded, you should not return
nil
, but instead return the result of [super forwardingTargetForSelector: selector]
.
- Returns
- The target to forward the message to
◆ inheritMethodsFromClass:
+ (void) inheritMethodsFromClass: |
|
(Class) |
class_ |
|
Adds all methods from the specified class to the class that is the receiver.
Methods implemented by the receiving class itself will not be overridden, however methods implemented by its superclass will. Therefore it behaves similar as if the specified class is the superclass of the receiver.
All methods from the superclasses of the specified class will also be added.
If the specified class is a superclass of the receiving class, nothing is done.
The methods which will be added from the specified class are not allowed to use super or access instance variables, instead they have to use accessors.
- Parameters
-
class_ | The class from which the instance methods should be inherited |
◆ init
Initializes an already allocated object.
Derived classes may override this, but need to use the following pattern:
@try {
} @catch (id e) {
@throw e;
}
return self;
instancetype init()
Initializes an already allocated object.
Definition: OFObject.m:547
void release()
Decreases the retain count.
With ARC enabled, the following pattern needs to be used instead:
init may never return nil
, instead an exception (for example OFInitializationFailedException) should be thrown.
- Returns
- An initialized object
Reimplemented in OFMutableData, OFLocale, and OFDNSResolver.
◆ initialize
A method which is called the moment before the first call to the class is being made.
Derived classes can override this to execute their own code on initialization. They should make sure to not execute any code if self is not the class itself, as it might happen that the method was called for a subclass which did not override this method.
◆ instanceMethodForSelector:
+ (IMP) instanceMethodForSelector: |
|
(SEL) |
selector |
|
Returns the implementation of the instance method for the specified selector.
- Parameters
-
selector | The selector for which the method should be returned |
- Returns
- The implementation of the instance method for the specified selector or
nil
if it isn't implemented
◆ instanceMethodSignatureForSelector:
Returns the method signature of the instance method for the specified selector.
- Parameters
-
selector | The selector for which the method signature should be returned |
- Returns
- The method signature of the instance method for the specified selector
◆ instancesRespondToSelector:
+ (bool) instancesRespondToSelector: |
|
(SEL) |
selector |
|
Checks whether instances of the class respond to a given selector.
- Parameters
-
selector | The selector which should be checked for respondence |
- Returns
- A boolean whether instances of the class respond to the specified selector
◆ isSubclassOfClass:
+ (bool) isSubclassOfClass: |
|
(Class) |
class_ |
|
Returns a boolean whether the class is a subclass of the specified class.
- Parameters
-
class_ | The class which is checked for being a superclass |
- Returns
- A boolean whether the class is a subclass of the specified class
◆ load
A method which is called once when the class is loaded into the runtime.
Derived classes can override this to execute their own code when the class is loaded.
◆ methodSignatureForSelector:
Returns the method signature for the specified selector.
- Parameters
-
selector | The selector for which the method signature should be returned |
- Returns
- The method signature for the specified selector
◆ new
Calls alloc on self
and then init
on the returned object.
- Returns
- An allocated and initialized object
◆ performSelector:afterDelay:
Performs the specified selector after the specified delay.
- Parameters
-
selector | The selector to perform |
delay | The delay after which the selector will be performed |
◆ performSelector:onThread:afterDelay:
Performs the specified selector on the specified thread after the specified delay.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:onThread:waitUntilDone:
Performs the specified selector on the specified thread.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelector:onThread:withObject:afterDelay:
Performs the specified selector on the specified thread with the specified object after the specified delay.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object | The object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:onThread:withObject:waitUntilDone:
Performs the specified selector on the specified thread with the specified object.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object | The object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelector:onThread:withObject:withObject:afterDelay:
Performs the specified selector on the specified thread with the specified objects after the specified delay.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:onThread:withObject:withObject:waitUntilDone:
- (void) performSelector: |
|
(SEL) |
selector |
onThread: |
|
(OFThread *) |
thread |
withObject: |
|
(nullable id) |
object1 |
withObject: |
|
(nullable id) |
object2 |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the specified thread with the specified objects.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelector:onThread:withObject:withObject:withObject:afterDelay:
Performs the specified selector on the specified thread with the specified objects after the specified delay.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:onThread:withObject:withObject:withObject:waitUntilDone:
- (void) performSelector: |
|
(SEL) |
selector |
onThread: |
|
(OFThread *) |
thread |
withObject: |
|
(nullable id) |
object1 |
withObject: |
|
(nullable id) |
object2 |
withObject: |
|
(nullable id) |
object3 |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the specified thread with the specified objects.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelector:onThread:withObject:withObject:withObject:withObject:afterDelay:
Performs the specified selector on the specified thread with the specified objects after the specified delay.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
object4 | The fourth object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:onThread:withObject:withObject:withObject:withObject:waitUntilDone:
- (void) performSelector: |
|
(SEL) |
selector |
onThread: |
|
(OFThread *) |
thread |
withObject: |
|
(nullable id) |
object1 |
withObject: |
|
(nullable id) |
object2 |
withObject: |
|
(nullable id) |
object3 |
withObject: |
|
(nullable id) |
object4 |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the specified thread with the specified objects.
- Parameters
-
selector | The selector to perform |
thread | The thread on which to perform the selector |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
object4 | The fourth object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelector:withObject:afterDelay:
Performs the specified selector with the specified object after the specified delay.
- Parameters
-
selector | The selector to perform |
object | The object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:withObject:withObject:afterDelay:
Performs the specified selector with the specified objects after the specified delay.
- Parameters
-
selector | The selector to perform |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:withObject:withObject:withObject:afterDelay:
Performs the specified selector with the specified objects after the specified delay.
- Parameters
-
selector | The selector to perform |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelector:withObject:withObject:withObject:withObject:afterDelay:
Performs the specified selector with the specified objects after the specified delay.
- Parameters
-
selector | The selector to perform |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
object4 | The fourth object that is passed to the method specified by the selector |
delay | The delay after which the selector will be performed |
◆ performSelectorOnMainThread:waitUntilDone:
- (void) performSelectorOnMainThread: |
|
(SEL) |
selector |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the main thread.
- Parameters
-
selector | The selector to perform |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelectorOnMainThread:withObject:waitUntilDone:
- (void) performSelectorOnMainThread: |
|
(SEL) |
selector |
withObject: |
|
(nullable id) |
object |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the main thread with the specified object.
- Parameters
-
selector | The selector to perform |
object | The object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelectorOnMainThread:withObject:withObject:waitUntilDone:
- (void) performSelectorOnMainThread: |
|
(SEL) |
selector |
withObject: |
|
(nullable id) |
object1 |
withObject: |
|
(nullable id) |
object2 |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the main thread with the specified objects.
- Parameters
-
selector | The selector to perform |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelectorOnMainThread:withObject:withObject:withObject:waitUntilDone:
- (void) performSelectorOnMainThread: |
|
(SEL) |
selector |
withObject: |
|
(nullable id) |
object1 |
withObject: |
|
(nullable id) |
object2 |
withObject: |
|
(nullable id) |
object3 |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the main thread with the specified objects.
- Parameters
-
selector | The selector to perform |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ performSelectorOnMainThread:withObject:withObject:withObject:withObject:waitUntilDone:
- (void) performSelectorOnMainThread: |
|
(SEL) |
selector |
withObject: |
|
(nullable id) |
object1 |
withObject: |
|
(nullable id) |
object2 |
withObject: |
|
(nullable id) |
object3 |
withObject: |
|
(nullable id) |
object4 |
waitUntilDone: |
|
(bool) |
waitUntilDone |
|
|
| |
Performs the specified selector on the main thread with the specified objects.
- Parameters
-
selector | The selector to perform |
object1 | The first object that is passed to the method specified by the selector |
object2 | The second object that is passed to the method specified by the selector |
object3 | The third object that is passed to the method specified by the selector |
object4 | The fourth object that is passed to the method specified by the selector |
waitUntilDone | Whether to wait until the perform finished |
◆ replaceClassMethod:withMethodFromClass:
+ (IMP) replaceClassMethod: |
|
(SEL) |
selector |
withMethodFromClass: |
|
(Class) |
class_ |
|
|
| |
Replaces a class method with a class method from another class.
- Parameters
-
selector | The selector of the class method to replace |
class_ | The class from which the new class method should be taken |
- Returns
- The old implementation
◆ replaceInstanceMethod:withMethodFromClass:
+ (IMP) replaceInstanceMethod: |
|
(SEL) |
selector |
withMethodFromClass: |
|
(Class) |
class_ |
|
|
| |
Replaces an instance method with an instance method from another class.
- Parameters
-
selector | The selector of the instance method to replace |
class_ | The class from which the new instance method should be taken |
- Returns
- The old implementation
◆ resolveClassMethod:
+ (bool) resolveClassMethod: |
|
(SEL) |
selector |
|
Try to resolve the specified class method.
This method is called if a class method was not found, so that an implementation can be provided at runtime.
- Returns
- Whether the method has been added to the class
◆ resolveInstanceMethod:
+ (bool) resolveInstanceMethod: |
|
(SEL) |
selector |
|
Try to resolve the specified instance method.
This method is called if an instance method was not found, so that an implementation can be provided at runtime.
- Returns
- Whether the method has been added to the class
◆ superclass
+ (nullable Class) superclass |
|
|
|
Returns the superclass of the class.
- Returns
- The superclass of the class
Reimplemented from <OFObject>.
◆ unload
A method which is called when the class is unloaded from the runtime.
Derived classes can override this to execute their own code when the class is unloaded.
- Warning
- This is not supported by the Apple runtime and currently only called by the ObjFW runtime when objc_unregister_class() or objc_exit() has been called! In the future, this might also be called by the ObjFW runtime when the class is part of a plugin that has been unloaded.
◆ description
A description for the object.
This is used when the object is used in a format string and for debugging purposes.
The documentation for this class was generated from the following files: