ObjFW
OFIRIHandler.h
1 /*
2  * Copyright (c) 2008-2024 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 OFData;
24 @class OFDate;
25 @class OFIRI;
26 @class OFStream;
27 
34 {
35  OFString *_scheme;
36  OF_RESERVE_IVARS(OFIRIHandler, 4)
37 }
38 
42 @property (readonly, nonatomic) OFString *scheme;
43 
55 + (bool)registerClass: (Class)class_ forScheme: (OFString *)scheme;
56 
63 + (OFIRIHandler *)handlerForIRI: (OFIRI *)IRI;
64 
89 + (OFStream *)openItemAtIRI: (OFIRI *)IRI mode: (OFString *)mode;
90 
91 - (instancetype)init OF_UNAVAILABLE;
92 
99 - (instancetype)initWithScheme: (OFString *)scheme OF_DESIGNATED_INITIALIZER;
100 
126 - (OFStream *)openItemAtIRI: (OFIRI *)IRI mode: (OFString *)mode;
127 
139 - (OFFileAttributes)attributesOfItemAtIRI: (OFIRI *)IRI;
140 
156 - (void)setAttributes: (OFFileAttributes)attributes ofItemAtIRI: (OFIRI *)IRI;
157 
166 - (bool)fileExistsAtIRI: (OFIRI *)IRI;
167 
176 - (bool)directoryExistsAtIRI: (OFIRI *)IRI;
177 
186 - (void)createDirectoryAtIRI: (OFIRI *)IRI;
187 
201 - (OFArray OF_GENERIC(OFIRI *) *)contentsOfDirectoryAtIRI: (OFIRI *)IRI;
202 
213 - (void)removeItemAtIRI: (OFIRI *)IRI;
214 
231 - (void)linkItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
232 
250 - (void)createSymbolicLinkAtIRI: (OFIRI *)IRI
251  withDestinationPath: (OFString *)target;
252 
273 - (bool)copyItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
274 
294 - (bool)moveItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
295 
311 - (OFData *)extendedAttributeDataForName: (OFString *)name
312  ofItemAtIRI: (OFIRI *)IRI;
313 
330 - (void)setExtendedAttributeData: (OFData *)data
331  forName: (OFString *)name
332  ofItemAtIRI: (OFIRI *)IRI;
333 
349 - (void)removeExtendedAttributeForName: (OFString *)name
350  ofItemAtIRI: (OFIRI *)IRI;
351 @end
352 
353 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:103
A class for storing, accessing and comparing dates.
Definition: OFDate.h:29
The root class for all other classes inside ObjFW.
Definition: OFObject.h:686
A handler for an IRI scheme.
Definition: OFIRIHandler.h:33
A base class for different types of streams.
Definition: OFStream.h:186
A class for handling strings.
Definition: OFString.h:134
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:78
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:35
A class for storing arbitrary data in an array.
Definition: OFData.h:41