ObjFW
|
A handler for a URL scheme. More...
#import <ObjFW/OFURLHandler.h>
Instance Methods | |
(instancetype) | - initWithScheme: |
Initializes the handler for the specified scheme. More... | |
(OFStream *) | - openItemAtURL:mode: |
Opens the item at the specified URL. More... | |
(of_file_attributes_t) | - attributesOfItemAtURL: |
Returns the attributes for the item at the specified URL. More... | |
(void) | - setAttributes:ofItemAtURL: |
Sets the attributes for the item at the specified URL. More... | |
(bool) | - fileExistsAtURL: |
Checks whether a file exists at the specified URL. More... | |
(bool) | - directoryExistsAtURL: |
Checks whether a directory exists at the specified URL. More... | |
(void) | - createDirectoryAtURL: |
Creates a directory at the specified URL. More... | |
(OFArray *) | - contentsOfDirectoryAtURL: |
Returns an array with the items in the specified directory. More... | |
(void) | - removeItemAtURL: |
Removes the item at the specified URL. More... | |
(void) | - linkItemAtURL:toURL: |
Creates a hard link for the specified item. More... | |
(void) | - createSymbolicLinkAtURL:withDestinationPath: |
Creates a symbolic link for an item. More... | |
(bool) | - copyItemAtURL:toURL: |
Tries to efficiently copy an item. If a copy would only be possible by reading the entire item and then writing it, it returns false. More... | |
(bool) | - moveItemAtURL:toURL: |
Tries to efficiently move an item. If a move would only be possible by copying the source and deleting it, it returns false. More... | |
![]() | |
(instancetype) | - init |
Initializes an already allocated object. More... | |
(nullable OFMethodSignature *) | - methodSignatureForSelector: |
Returns the method signature for the specified selector. More... | |
(void) | - dealloc |
Deallocates the object. More... | |
(void) | - performSelector:afterDelay: |
Performs the specified selector after the specified delay. More... | |
(void) | - performSelector:withObject:afterDelay: |
Performs the specified selector with the specified object after the specified delay. More... | |
(void) | - performSelector:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. More... | |
(void) | - performSelector:withObject:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. More... | |
(void) | - performSelector:withObject:withObject:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. More... | |
(void) | - performSelector:onThread:waitUntilDone: |
Performs the specified selector on the specified thread. More... | |
(void) | - performSelector:onThread:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified object. More... | |
(void) | - performSelector:onThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. More... | |
(void) | - performSelectorOnMainThread:waitUntilDone: |
Performs the specified selector on the main thread. More... | |
(void) | - performSelectorOnMainThread:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified object. More... | |
(void) | - performSelectorOnMainThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. More... | |
(void) | - performSelectorOnMainThread:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. More... | |
(void) | - performSelectorOnMainThread:withObject:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. More... | |
(void) | - performSelector:onThread:afterDelay: |
Performs the specified selector on the specified thread after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified object after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. More... | |
(nullable id) | - forwardingTargetForSelector: |
This method is called when resolveClassMethod: or resolveInstanceMethod: returned false. It should return a target to which the message should be forwarded. More... | |
(void) | - doesNotRecognizeSelector: |
Handles messages which are not understood by the receiver. More... | |
![]() | |
(unsigned long) | - hash |
Returns a 32 bit hash for the object. More... | |
(unsigned int) | - retainCount |
Returns the retain count. More... | |
(bool) | - isProxy |
Returns whether the object is a proxy object. More... | |
(bool) | - allowsWeakReference |
Returns whether the object allows weak references. More... | |
(bool) | - isKindOfClass: |
Returns a boolean whether the object of the specified kind. More... | |
(bool) | - isMemberOfClass: |
Returns a boolean whether the object is a member of the specified class. More... | |
(bool) | - respondsToSelector: |
Returns a boolean whether the object responds to the specified selector. More... | |
(nullable IMP) | - methodForSelector: |
Returns the implementation for the specified selector. More... | |
(nullable id) | - performSelector: |
Performs the specified selector. More... | |
(nullable id) | - performSelector:withObject: |
Performs the specified selector with the specified object. More... | |
(nullable id) | - performSelector:withObject:withObject: |
Performs the specified selector with the specified objects. More... | |
(nullable id) | - performSelector:withObject:withObject:withObject: |
Performs the specified selector with the specified objects. More... | |
(nullable id) | - performSelector:withObject:withObject:withObject:withObject: |
Performs the specified selector with the specified objects. More... | |
(bool) | - isEqual: |
Checks two objects for equality. More... | |
(instancetype) | - retain |
Increases the retain count. More... | |
(void) | - release |
Decreases the retain count. More... | |
(instancetype) | - autorelease |
Adds the object to the topmost autorelease pool of the thread's autorelease pool stack. More... | |
(instancetype) | - self |
Returns the receiver. More... | |
(bool) | - retainWeakReference |
Retain a weak reference to this object. More... | |
Class Methods | |
(bool) | + registerClass:forScheme: |
Registers the specified class as the handler for the specified scheme. More... | |
(nullable) | + handlerForURL: |
Returns the handler for the specified URL. More... | |
![]() | |
(void) | + load |
A method which is called once when the class is loaded into the runtime. More... | |
(void) | + unload |
A method which is called when the class is unloaded from the runtime. More... | |
(void) | + initialize |
A method which is called the moment before the first call to the class is being made. More... | |
(instancetype) | + alloc |
Allocates memory for an instance of the class and sets up the memory pool for the object. More... | |
(instancetype) | + new |
Calls alloc on self and then init on the returned object. More... | |
(Class) | + class |
Returns the class. More... | |
(OFString *) | + className |
Returns the name of the class as a string. More... | |
(bool) | + isSubclassOfClass: |
Returns a boolean whether the class is a subclass of the specified class. More... | |
(nullable Class) | + superclass |
Returns the superclass of the class. More... | |
(bool) | + instancesRespondToSelector: |
Checks whether instances of the class respond to a given selector. More... | |
(bool) | + conformsToProtocol: |
Checks whether the class conforms to a given protocol. More... | |
(nullable IMP) | + instanceMethodForSelector: |
Returns the implementation of the instance method for the specified selector. More... | |
(nullable OFMethodSignature *) | + instanceMethodSignatureForSelector: |
Returns the method signature of the instance method for the specified selector. More... | |
(OFString *) | + description |
Returns a description for the class, which is usually the class name. More... | |
(nullable IMP) | + replaceClassMethod:withMethodFromClass: |
Replaces a class method with a class method from another class. More... | |
(nullable IMP) | + replaceInstanceMethod:withMethodFromClass: |
Replaces an instance method with an instance method from another class. More... | |
(void) | + inheritMethodsFromClass: |
Adds all methods from the specified class to the class that is the receiver. More... | |
(bool) | + resolveClassMethod: |
Try to resolve the specified class method. More... | |
(bool) | + resolveInstanceMethod: |
Try to resolve the specified instance method. More... | |
(id) | + copy |
Returns the class. More... | |
Properties | |
OFString * | scheme |
The scheme this OFURLHandler handles. | |
![]() | |
OFString * | className |
The name of the object's class. | |
OFString * | description |
A description for the object. More... | |
OFString * | stringBySerializing |
The object serialized as a string. | |
A handler for a URL scheme.
- (of_file_attributes_t) attributesOfItemAtURL: | (OFURL *) | URL |
Returns the attributes for the item at the specified URL.
URL | The URL to return the attributes for |
Returns an array with the items in the specified directory.
.
and ..
are not part of the returned array.URL | The URL to the directory whose items should be returned |
Tries to efficiently copy an item. If a copy would only be possible by reading the entire item and then writing it, it returns false.
The destination URL must have a full path, which means it must include the name of the item.
If an item already exists, the copy operation fails. This is also the case if a directory is copied and an item already exists in the destination directory.
source | The file, directory or symbolic link to copy |
destination | The destination URL |
- (void) createDirectoryAtURL: | (OFURL *) | URL |
Creates a directory at the specified URL.
URL | The URL of the directory to create |
Creates a symbolic link for an item.
The destination uRL must have a full path, which means it must include the name of the item.
This method is not available for all URLs.
URL | The URL to the item which should symbolically link to the target |
target | The target of the symbolic link |
- (bool) directoryExistsAtURL: | (OFURL *) | URL |
Checks whether a directory exists at the specified URL.
URL | The URL to check |
- (bool) fileExistsAtURL: | (OFURL *) | URL |
Checks whether a file exists at the specified URL.
URL | The URL to check |
Returns the handler for the specified URL.
- (instancetype) initWithScheme: | (OFString *) | scheme |
Initializes the handler for the specified scheme.
scheme | The scheme to initialize for |
Creates a hard link for the specified item.
The destination URL must have a full path, which means it must include the name of the item.
This method is not available for all URLs.
source | The URL to the item for which a link should be created |
destination | The URL to the item which should link to the source |
Tries to efficiently move an item. If a move would only be possible by copying the source and deleting it, it returns false.
The destination URL must have a full path, which means it must include the name of the item.
If the destination is on a different logical device or uses a different scheme, an efficient move is not possible and false is returned.
source | The item to rename |
destination | The new name for the item |
Opens the item at the specified URL.
URL | The URL of the item which should be opened | ||||||||||||||||||
mode | The mode in which the file should be opened. Possible modes are:
The handler is allowed to not implement all modes and is also allowed to implement additional, scheme-specific modes. |
Registers the specified class as the handler for the specified scheme.
If the same class is specified for two schemes, one instance of it is created per scheme.
class_ | The class to register as the handler for the specified scheme |
scheme | The scheme for which to register the handler |
- (void) removeItemAtURL: | (OFURL *) | URL |
Removes the item at the specified URL.
If the item at the specified URL is a directory, it is removed recursively.
URL | The URL to the item which should be removed |
- (void) setAttributes: | (of_file_attributes_t) | attributes | |
ofItemAtURL: | (OFURL *) | URL | |
Sets the attributes for the item at the specified URL.
All attributes not part of the dictionary are left unchanged.
attributes | The attributes to set for the specified URL |
URL | The URL of the item to set the attributes for |