ObjFW
OFString+PathAdditions.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 "OFString.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
20 #ifdef OF_AMIGAOS
21 # define OF_PATH_CURRENT_DIRECTORY @""
22 #else
23 # define OF_PATH_CURRENT_DIRECTORY @"."
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 extern int _OFString_PathAdditions_reference;
30 #ifdef __cplusplus
31 }
32 #endif
33 
34 @interface OFString (PathAdditions)
38 @property (readonly, nonatomic, getter=isAbsolutePath) bool absolutePath;
39 
43 @property (readonly, nonatomic) OFArray OF_GENERIC(OFString *) *pathComponents;
44 
48 @property (readonly, nonatomic) OFString *lastPathComponent;
49 
53 @property (readonly, nonatomic) OFString *pathExtension;
54 
58 @property (readonly, nonatomic) OFString *stringByDeletingLastPathComponent;
59 
63 @property (readonly, nonatomic) OFString *stringByDeletingPathExtension;
64 
68 @property (readonly, nonatomic) OFString *stringByStandardizingPath;
69 
76 + (OFString *)pathWithComponents: (OFArray OF_GENERIC(OFString *) *)components;
77 
84 - (OFString *)stringByAppendingPathComponent: (OFString *)component;
85 
86 - (bool)of_isDirectoryPath;
87 - (OFString *)of_pathToURLPathWithURLEncodedHost:
88  (OFString *__autoreleasing _Nullable *_Nonnull)URLEncodedHost;
89 - (OFString *)of_URLPathToPathWithURLEncodedHost:
90  (nullable OFString *)URLEncodedHost;
91 - (OFString *)of_pathComponentToURLPathComponent;
92 @end
93 
94 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:92
A class for handling strings.
Definition: OFString.h:132
OFArray * pathComponents
Definition: OFString+PathAdditions.h:43