ObjFW
OFIRIHandler.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFFileManager.h"
21 #import "OFObject.h"
22 #import "OFString.h"
23 
24 OF_ASSUME_NONNULL_BEGIN
25 
26 @class OFArray OF_GENERIC(ObjectType);
27 @class OFData;
28 @class OFDate;
29 @class OFIRI;
30 @class OFStream;
31 
38 {
39  OFString *_scheme;
40  OF_RESERVE_IVARS(OFIRIHandler, 4)
41 }
42 
46 @property (readonly, nonatomic) OFString *scheme;
47 
59 + (bool)registerClass: (Class)class_ forScheme: (OFString *)scheme;
60 
67 + (OFIRIHandler *)handlerForIRI: (OFIRI *)IRI;
68 
93 + (OFStream *)openItemAtIRI: (OFIRI *)IRI mode: (OFString *)mode;
94 
95 - (instancetype)init OF_UNAVAILABLE;
96 
103 - (instancetype)initWithScheme: (OFString *)scheme OF_DESIGNATED_INITIALIZER;
104 
130 - (OFStream *)openItemAtIRI: (OFIRI *)IRI mode: (OFString *)mode;
131 
143 - (OFFileAttributes)attributesOfItemAtIRI: (OFIRI *)IRI;
144 
160 - (void)setAttributes: (OFFileAttributes)attributes ofItemAtIRI: (OFIRI *)IRI;
161 
170 - (bool)fileExistsAtIRI: (OFIRI *)IRI;
171 
180 - (bool)directoryExistsAtIRI: (OFIRI *)IRI;
181 
190 - (void)createDirectoryAtIRI: (OFIRI *)IRI;
191 
205 - (OFArray OF_GENERIC(OFIRI *) *)contentsOfDirectoryAtIRI: (OFIRI *)IRI;
206 
217 - (void)removeItemAtIRI: (OFIRI *)IRI;
218 
235 - (void)linkItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
236 
254 - (void)createSymbolicLinkAtIRI: (OFIRI *)IRI
255  withDestinationPath: (OFString *)target;
256 
277 - (bool)copyItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
278 
298 - (bool)moveItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
299 
320 - (OFData *)extendedAttributeDataForName: (OFString *)name
321  ofItemAtIRI: (OFIRI *)IRI
322  OF_DEPRECATED(ObjFW, 1, 1,
323  "Use -[getExtendedAttributeData:andType:forName:ofItemAtIRI:] instead");
324 
346 - (void)getExtendedAttributeData: (OFData *_Nonnull *_Nonnull)data
347  andType: (id _Nullable *_Nullable)type
348  forName: (OFString *)name
349  ofItemAtIRI: (OFIRI *)IRI;
350 
370 - (void)setExtendedAttributeData: (OFData *)data
371  forName: (OFString *)name
372  ofItemAtIRI: (OFIRI *)IRI
373  OF_DEPRECATED(ObjFW, 1, 1,
374  "Use -[setExtendedAttributeData:andType:forName:ofItemAtIRI:] instead");
375 
398 - (void)setExtendedAttributeData: (OFData *)data
399  andType: (nullable id)type
400  forName: (OFString *)name
401  ofItemAtIRI: (OFIRI *)IRI;
402 
418 - (void)removeExtendedAttributeForName: (OFString *)name
419  ofItemAtIRI: (OFIRI *)IRI;
420 @end
421 
422 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:107
A class for storing, accessing and comparing dates.
Definition: OFDate.h:33
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
A handler for an IRI scheme.
Definition: OFIRIHandler.h:37
A base class for different types of streams.
Definition: OFStream.h:278
A class for handling strings.
Definition: OFString.h:142
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:82
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:39
A class for storing arbitrary data in an array.
Definition: OFData.h:45