ObjFW
OFIRIHandler.h
1 /*
2  * Copyright (c) 2008-2026 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 OFIRIHandler;
31 @class OFStream;
32 
47 - (void)IRIHandler: (OFIRIHandler *)IRIHandler
48  didOpenItemAtIRI: (OFIRI *)IRI
49  stream: (nullable OF_KINDOF(OFStream *))stream
50  exception: (nullable id)exception;
51 @end
52 
59 {
60  OFString *_scheme;
61  OF_RESERVE_IVARS(OFIRIHandler, 4)
62 }
63 
67 @property (readonly, nonatomic) OFString *scheme;
68 
80 + (bool)registerClass: (Class)class_ forScheme: (OFString *)scheme;
81 
88 + (OFIRIHandler *)handlerForIRI: (OFIRI *)IRI;
89 
114 + (OF_KINDOF(OFStream *))openItemAtIRI: (OFIRI *)IRI mode: (OFString *)mode;
115 
140 + (void)asyncOpenItemAtIRI: (OFIRI *)IRI
141  mode: (OFString *)mode
142  delegate: (id <OFIRIHandlerDelegate>)delegate;
143 
144 - (instancetype)init OF_UNAVAILABLE;
145 
152 - (instancetype)initWithScheme: (OFString *)scheme OF_DESIGNATED_INITIALIZER;
153 
179 - (OF_KINDOF(OFStream *))openItemAtIRI: (OFIRI *)IRI mode: (OFString *)mode;
180 
205 - (void)asyncOpenItemAtIRI: (OFIRI *)IRI
206  mode: (OFString *)mode
207  delegate: (id <OFIRIHandlerDelegate>)delegate;
208 
220 - (OFFileAttributes)attributesOfItemAtIRI: (OFIRI *)IRI;
221 
237 - (void)setAttributes: (OFFileAttributes)attributes ofItemAtIRI: (OFIRI *)IRI;
238 
247 - (bool)fileExistsAtIRI: (OFIRI *)IRI;
248 
257 - (bool)directoryExistsAtIRI: (OFIRI *)IRI;
258 
267 - (void)createDirectoryAtIRI: (OFIRI *)IRI;
268 
282 - (OFArray OF_GENERIC(OFIRI *) *)contentsOfDirectoryAtIRI: (OFIRI *)IRI;
283 
294 - (void)removeItemAtIRI: (OFIRI *)IRI;
295 
312 - (void)linkItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
313 
331 - (void)createSymbolicLinkAtIRI: (OFIRI *)IRI
332  withDestinationPath: (OFString *)target;
333 
354 - (bool)copyItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
355 
375 - (bool)moveItemAtIRI: (OFIRI *)source toIRI: (OFIRI *)destination;
376 
397 - (OFData *)extendedAttributeDataForName: (OFString *)name
398  ofItemAtIRI: (OFIRI *)IRI
399  OF_DEPRECATED(ObjFW, 1, 1,
400  "Use -[getExtendedAttributeData:andType:forName:ofItemAtIRI:] instead");
401 
423 - (void)getExtendedAttributeData: (OFData *_Nonnull *_Nonnull)data
424  andType: (id _Nullable *_Nullable)type
425  forName: (OFString *)name
426  ofItemAtIRI: (OFIRI *)IRI;
427 
447 - (void)setExtendedAttributeData: (OFData *)data
448  forName: (OFString *)name
449  ofItemAtIRI: (OFIRI *)IRI
450  OF_DEPRECATED(ObjFW, 1, 1,
451  "Use -[setExtendedAttributeData:andType:forName:ofItemAtIRI:] instead");
452 
475 - (void)setExtendedAttributeData: (OFData *)data
476  andType: (nullable id)type
477  forName: (OFString *)name
478  ofItemAtIRI: (OFIRI *)IRI;
479 
495 - (void)removeExtendedAttributeForName: (OFString *)name
496  ofItemAtIRI: (OFIRI *)IRI;
497 @end
498 
499 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:108
A class for storing, accessing and comparing dates.
Definition: OFDate.h:33
The root class for all other classes inside ObjFW.
Definition: OFObject.h:954
A handler for an IRI scheme.
Definition: OFIRIHandler.h:58
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 delegate for OFIRIHandler operations.
Definition: OFIRIHandler.h:31
A class for storing arbitrary data in an array.
Definition: OFData.h:45