ObjFW
OFURLHandler.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFFileManager.h"
17 #import "OFObject.h"
18 #import "OFString.h"
19 
20 OF_ASSUME_NONNULL_BEGIN
21 
22 @class OFArray OF_GENERIC(ObjectType);
23 @class OFDate;
24 @class OFStream;
25 @class OFURL;
26 
33 {
34  OFString *_scheme;
35  OF_RESERVE_IVARS(OFURLHandler, 4)
36 }
37 
41 @property (readonly, nonatomic) OFString *scheme;
42 
54 + (bool)registerClass: (Class)class_ forScheme: (OFString *)scheme;
55 
61 + (nullable OF_KINDOF(OFURLHandler *))handlerForURL: (OFURL *)URL;
62 
63 - (instancetype)init OF_UNAVAILABLE;
64 
71 - (instancetype)initWithScheme: (OFString *)scheme OF_DESIGNATED_INITIALIZER;
72 
94 - (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode;
95 
103 - (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL;
104 
113 - (void)setAttributes: (of_file_attributes_t)attributes
114  ofItemAtURL: (OFURL *)URL;
115 
122 - (bool)fileExistsAtURL: (OFURL *)URL;
123 
130 - (bool)directoryExistsAtURL: (OFURL *)URL;
131 
137 - (void)createDirectoryAtURL: (OFURL *)URL;
138 
147 - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtURL: (OFURL *)URL;
148 
156 - (void)removeItemAtURL: (OFURL *)URL;
157 
169 - (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination;
170 
185 - (void)createSymbolicLinkAtURL: (OFURL *)URL
186  withDestinationPath: (OFString *)target;
187 
205 - (bool)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination;
206 
223 - (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination;
224 @end
225 
226 OF_ASSUME_NONNULL_END
struct objc_class * Class
A pointer to a class.
Definition: ObjFWRT.h:85
An abstract class for storing objects in an array.
Definition: OFArray.h:92
A class for storing, accessing and comparing dates.
Definition: OFDate.h:36
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:58
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
A base class for different types of streams.
Definition: OFStream.h:191
A class for handling strings.
Definition: OFString.h:132
A handler for a URL scheme.
Definition: OFURLHandler.h:33
A class for parsing URLs and accessing parts of it.
Definition: OFURL.h:34