ObjFW
|
A handler for an IRI scheme. More...
#include <ObjFW/ObjFW.h>
Instance Methods | |
(instancetype) | - initWithScheme: |
Initializes the handler for the specified scheme. | |
(OFStream *) | - openItemAtIRI:mode: |
Opens the item at the specified IRI. | |
(OFFileAttributes) | - attributesOfItemAtIRI: |
Returns the attributes for the item at the specified IRI. | |
(void) | - setAttributes:ofItemAtIRI: |
Sets the attributes for the item at the specified IRI. | |
(bool) | - fileExistsAtIRI: |
Checks whether a file exists at the specified IRI. | |
(bool) | - directoryExistsAtIRI: |
Checks whether a directory exists at the specified IRI. | |
(void) | - createDirectoryAtIRI: |
Creates a directory at the specified IRI. | |
(OFArray *) | - contentsOfDirectoryAtIRI: |
Returns an array with the IRIs of the items in the specified directory. | |
(void) | - removeItemAtIRI: |
Removes the item at the specified IRI. | |
(void) | - linkItemAtIRI:toIRI: |
Creates a hard link for the specified item. | |
(void) | - createSymbolicLinkAtIRI:withDestinationPath: |
Creates a symbolic link for an item. | |
(bool) | - copyItemAtIRI:toIRI: |
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. | |
(bool) | - moveItemAtIRI:toIRI: |
Tries to efficiently move an item. If a move would only be possible by copying the source and deleting it, it returns false. | |
(OFData *) | - extendedAttributeDataForName:ofItemAtIRI: |
Returns the extended attribute data for the specified name of the item at the specified IRI. | |
(void) | - getExtendedAttributeData:andType:forName:ofItemAtIRI: |
Gets the extended attribute data and type for the specified name of the item at the specified IRI. | |
(void) | - setExtendedAttributeData:forName:ofItemAtIRI: |
Sets the extended attribute data for the specified name of the item at the specified IRI. | |
(void) | - setExtendedAttributeData:andType:forName:ofItemAtIRI: |
Sets the extended attribute data and type for the specified name of the item at the specified IRI. | |
(void) | - removeExtendedAttributeForName:ofItemAtIRI: |
Removes the extended attribute for the specified name of the item at the specified IRI. | |
Instance Methods inherited from OFObject | |
(instancetype) | - init |
Initializes an already allocated object. | |
(nullable OFMethodSignature *) | - methodSignatureForSelector: |
Returns the method signature for the specified selector. | |
(void) | - dealloc |
Deallocates the object. | |
(void) | - performSelector:afterDelay: |
Performs the specified selector after the specified delay. | |
(void) | - performSelector:withObject:afterDelay: |
Performs the specified selector with the specified object after the specified delay. | |
(void) | - performSelector:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. | |
(void) | - performSelector:withObject:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. | |
(void) | - performSelector:withObject:withObject:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. | |
(void) | - performSelector:onThread:waitUntilDone: |
Performs the specified selector on the specified thread. | |
(void) | - performSelector:onThread:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified object. | |
(void) | - performSelector:onThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. | |
(void) | - performSelector:onThread:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. | |
(void) | - performSelector:onThread:withObject:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. | |
(void) | - performSelectorOnMainThread:waitUntilDone: |
Performs the specified selector on the main thread. | |
(void) | - performSelectorOnMainThread:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified object. | |
(void) | - performSelectorOnMainThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. | |
(void) | - performSelectorOnMainThread:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. | |
(void) | - performSelectorOnMainThread:withObject:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. | |
(void) | - performSelector:onThread:afterDelay: |
Performs the specified selector on the specified thread after the specified delay. | |
(void) | - performSelector:onThread:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified object after the specified delay. | |
(void) | - performSelector:onThread:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. | |
(void) | - performSelector:onThread:withObject:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. | |
(void) | - performSelector:onThread:withObject:withObject:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. | |
(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. | |
(void) | - doesNotRecognizeSelector: |
Handles messages which are not understood by the receiver. | |
Instance Methods inherited from <OFObject> | |
(unsigned long) | - hash |
Returns a hash for the object. | |
(unsigned int) | - retainCount |
Returns the retain count. | |
(bool) | - isProxy |
Returns whether the object is a proxy object. | |
(bool) | - isKindOfClass: |
Returns a boolean whether the object is of the specified kind. | |
(bool) | - isMemberOfClass: |
Returns a boolean whether the object is a member of the specified class. | |
(bool) | - respondsToSelector: |
Returns a boolean whether the object responds to the specified selector. | |
(nullable IMP) | - methodForSelector: |
Returns the implementation for the specified selector. | |
(nullable id) | - performSelector: |
Performs the specified selector. | |
(nullable id) | - performSelector:withObject: |
Performs the specified selector with the specified object. | |
(nullable id) | - performSelector:withObject:withObject: |
Performs the specified selector with the specified objects. | |
(nullable id) | - performSelector:withObject:withObject:withObject: |
Performs the specified selector with the specified objects. | |
(nullable id) | - performSelector:withObject:withObject:withObject:withObject: |
Performs the specified selector with the specified objects. | |
(bool) | - isEqual: |
Checks two objects for equality. | |
(instancetype) | - retain |
Increases the retain count. | |
(void) | - release |
Decreases the retain count. | |
(instancetype) | - autorelease |
Adds the object to the topmost autorelease pool of the thread's autorelease pool stack. | |
(instancetype) | - self |
Returns the receiver. | |
(bool) | - allowsWeakReference |
Returns whether the object allows a weak reference. | |
(bool) | - retainWeakReference |
Retain a weak reference to this object. | |
Class Methods | |
(bool) | + registerClass:forScheme: |
Registers the specified class as the handler for the specified scheme. | |
(OFIRIHandler *) | + handlerForIRI: |
Returns the handler for the specified IRI. | |
(OFStream *) | + openItemAtIRI:mode: |
Opens the item at the specified IRI. | |
Class Methods inherited from OFObject | |
(void) | + load |
A method which is called once when the class is loaded into the runtime. | |
(void) | + unload |
A method which is called when the class is unloaded from the runtime. | |
(void) | + initialize |
A method which is called the moment before the first call to the class is being made. | |
(instancetype) | + alloc |
Allocates memory for an instance of the class and sets up the memory pool for the object. | |
(Class) | + class |
Returns the class. | |
(OFString *) | + className |
Returns the name of the class as a string. | |
(bool) | + isSubclassOfClass: |
Returns a boolean whether the class is a subclass of the specified class. | |
(nullable Class) | + superclass |
Returns the superclass of the class. | |
(bool) | + instancesRespondToSelector: |
Checks whether instances of the class respond to a given selector. | |
(bool) | + conformsToProtocol: |
Checks whether the class conforms to a given protocol. | |
(nullable IMP) | + instanceMethodForSelector: |
Returns the implementation of the instance method for the specified selector. | |
(nullable OFMethodSignature *) | + instanceMethodSignatureForSelector: |
Returns the method signature of the instance method for the specified selector. | |
(OFString *) | + description |
Returns a description for the class, which is usually the class name. | |
(nullable IMP) | + replaceClassMethod:withMethodFromClass: |
Replaces a class method with a class method from another class. | |
(nullable IMP) | + replaceInstanceMethod:withMethodFromClass: |
Replaces an instance method with an instance method from another class. | |
(void) | + inheritMethodsFromClass: |
Adds all methods from the specified class to the class that is the receiver. | |
(bool) | + resolveClassMethod: |
Try to resolve the specified class method. | |
(bool) | + resolveInstanceMethod: |
Try to resolve the specified instance method. | |
(id) | + copy |
Returns the class. | |
Properties | |
OFString * | scheme |
The scheme this OFIRIHandler handles. | |
Properties inherited from OFObject | |
OFString * | className |
The name of the object's class. | |
OFString * | description |
A description for the object. | |
A handler for an IRI scheme.
- (OFFileAttributes) attributesOfItemAtIRI: | (OFIRI *) | IRI |
Returns the attributes for the item at the specified IRI.
IRI | The IRI to return the attributes for |
OFGetItemAttributesFailedException | Failed to get the attributes of the item |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
Returns an array with the IRIs of the items in the specified directory.
.
and ..
are not part of the returned array.IRI | The IRI to the directory whose items should be returned |
OFOpenItemFailedException | Opening the directory failed |
OFReadFailedException | Reading from the directory failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
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 IRI 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 IRI |
OFCopyItemFailedException | Copying failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
- (void) createDirectoryAtIRI: | (OFIRI *) | IRI |
Creates a directory at the specified IRI.
IRI | The IRI of the directory to create |
OFCreateDirectoryFailedException | Creating the directory failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
Creates a symbolic link for an item.
The destination IRI must have a full path, which means it must include the name of the item.
This method is not available for all IRIs.
IRI | The IRI to the item which should symbolically link to the target |
target | The target of the symbolic link |
OFCreateSymbolicLinkFailed | Creating a symbolic link failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
- (bool) directoryExistsAtIRI: | (OFIRI *) | IRI |
Checks whether a directory exists at the specified IRI.
IRI | The IRI to check |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
Returns the extended attribute data for the specified name of the item at the specified IRI.
This method is not available for all IRIs.
name | The name of the extended attribute |
IRI | The IRI of the item to return the extended attribute from |
OFGetItemAttributesFailedException | Getting the extended attribute failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
OFNotImplementedException | Getting extended attributes is not implemented for the specified item |
- (bool) fileExistsAtIRI: | (OFIRI *) | IRI |
Checks whether a file exists at the specified IRI.
IRI | The IRI to check |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
- (void) getExtendedAttributeData: | (OFData * *) | data | |
andType: | (id *) | type | |
forName: | (OFString *) | name | |
ofItemAtIRI: | (OFIRI *) | IRI |
Gets the extended attribute data and type for the specified name of the item at the specified IRI.
This method is not available for all IRIs.
data | A pointer to OFData * that gets set to the data of the extended attribute |
type | A pointer to id that gets set to the type of the extended attribute, if not NULL . Gets set to nil if the extended attribute has no type. The type of the type depends on the IRI handler. |
name | The name of the extended attribute |
IRI | The IRI of the item to return the extended attribute from |
OFGetItemAttributesFailedException | Getting the extended attribute failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
OFNotImplementedException | Getting extended attributes is not implemented for the specified item |
+ (OFIRIHandler *) handlerForIRI: | (OFIRI *) | IRI |
Returns the handler for the specified IRI.
OFUnsupportedProtocolException | The specified IRI is not supported |
- (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 IRI must have a full path, which means it must include the name of the item.
This method is not available for all IRIs.
source | The IRI to the item for which a link should be created |
destination | The IRI to the item which should link to the source |
OFLinkItemFailedException | Linking the item failed |
OFUnsupportedProtocolException | The handler cannot handle the scheme of one of the IRIs |
OFNotImplementedException | Hardlinks are not implemented for the specified IRI |
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 IRI 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 |
OFMoveItemFailedException | Moving failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
Opens the item at the specified IRI.
IRI | The IRI 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. |
OFOpenItemFailedException | Opening the item failed |
OFUnsupportedProtocolException | The specified IRI is not supported |
Opens the item at the specified IRI.
IRI | The IRI 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. |
OFOpenItemFailedException | Opening the item failed |
OFUnsupportedProtocolException | The specified IRI is not supported by the handler |
+ (bool) registerClass: | (Class) | class_ | |
forScheme: | (OFString *) | scheme |
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 |
Removes the extended attribute for the specified name of the item at the specified IRI.
This method is not available for all IRIs.
name | The name of the extended attribute to remove |
IRI | The IRI of the item to remove the extended attribute from |
OFSetItemAttributesFailedException | Removing the extended attribute failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
OFNotImplementedException | Removing extended attributes is not implemented for the specified item |
- (void) removeItemAtIRI: | (OFIRI *) | IRI |
Removes the item at the specified IRI.
If the item at the specified IRI is a directory, it is removed recursively.
IRI | The IRI to the item which should be removed |
OFRemoveItemFailedException | Removing the item failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
- (void) setAttributes: | (OFFileAttributes) | attributes | |
ofItemAtIRI: | (OFIRI *) | IRI |
Sets the attributes for the item at the specified IRI.
All attributes not part of the dictionary are left unchanged.
attributes | The attributes to set for the specified IRI |
IRI | The IRI of the item to set the attributes for @throw OFSetItemAttributesFailedException Failed to set the attributes of the item |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
OFNotImplementedException | Setting one or more of the specified attributes is not implemented for the specified item |
- (void) setExtendedAttributeData: | (OFData *) | data | |
andType: | (nullable id) | type | |
forName: | (OFString *) | name | |
ofItemAtIRI: | (OFIRI *) | IRI |
Sets the extended attribute data and type for the specified name of the item at the specified IRI.
This method is not available for all IRIs. Not all IRIs support a non-nil type.
data | The data for the extended attribute |
type | The type for the extended attribute. nil does not mean to keep the existing type, but to set it to no type. The type of the type depends on the IRI handler. |
name | The name of the extended attribute |
IRI | The IRI of the item to set the extended attribute on |
OFSetItemAttributesFailedException | Setting the extended attribute failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
OFNotImplementedException | Setting extended attributes is not implemented for the specified item or a type was specified and typed extended attributes are not supported |
- (void) setExtendedAttributeData: | (OFData *) | data | |
forName: | (OFString *) | name | |
ofItemAtIRI: | (OFIRI *) | IRI |
Sets the extended attribute data for the specified name of the item at the specified IRI.
This method is not available for all IRIs.
data | The data for the extended attribute |
name | The name of the extended attribute |
IRI | The IRI of the item to set the extended attribute on |
OFSetItemAttributesFailedException | Setting the extended attribute failed |
OFUnsupportedProtocolException | The handler cannot handle the IRI's scheme |
OFNotImplementedException | Setting extended attributes is not implemented for the specified item |