Differences From Artifact [cf84e1efee]:
- File src/OFMutableURL.h — part of check-in [1a86b8175b] at 2022-02-12 07:46:07 on branch trunk — Update copyright (user: js, size: 5207) [annotate] [blame] [check-ins using] [more...]
To Artifact [9400cfdc05]:
- File
src/OFMutableURI.h
— part of check-in
[3e455c4839]
at
2022-10-11 19:27:09
on branch trunk
— OFURI: Make scheme and path nonnull
This is as per the RFC, which says the scheme and path can never be
missing, while the path can be empty. (user: js, size: 6330) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
9 10 11 12 13 14 15 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ | | | | > | | | < < | < | | < < | < | | > > > | | | | > > > | | | | > > > | | | | | > > > | | | | | | > > > | < | > > > | | | | | > > > | | | | | | | > > | | | | | > > > | | > | | > > > > > > > > > | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFURI.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFMutableURI OFMutableURI.h ObjFW/OFMutableURI.h * * @brief A class for parsing URIs as per RFC 3986 and accessing and modifying * parts of it. */ @interface OFMutableURI: OFURI { OF_RESERVE_IVARS(OFMutableURI, 4) } /** * @brief The scheme part of the URI. * * @throw OFInvalidFormatException The scheme being set is not in the correct * format */ @property (readwrite, copy, nonatomic) OFString *scheme; /** * @brief The host part of the URI. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *host; /** * @brief The host part of the URI in percent-encoded form. * * Setting this retains the original percent-encoding used - if more characters * than necessary are percent-encoded, it is kept this way. * * @throw OFInvalidFormatException The host being set is not in the correct * format */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *percentEncodedHost; /** * @brief The port part of the URI. * * @throw OFInvalidArgumentException The port is not valid (e.g. negative or * too big) */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFNumber *port; /** * @brief The user part of the URI. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *user; /** * @brief The user part of the URI in percent-encoded form. * * Setting this retains the original percent-encoding used - if more characters * than necessary are percent-encoded, it is kept this way. * * @throw OFInvalidFormatException The user being set is not in the correct * format */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *percentEncodedUser; /** * @brief The password part of the URI. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *password; /** * @brief The password part of the URI in URI-encoded form. * * Setting this retains the original percent-encoding used - if more characters * than necessary are percent-encoded, it is kept this way. * * @throw OFInvalidFormatException The password being set is not in the correct * format */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *percentEncodedPassword; /** * @brief The path part of the URI. */ @property (readwrite, copy, nonatomic) OFString *path; /** * @brief The path part of the URI in percent-encoded form. * * Setting this retains the original percent-encoding used - if more characters * than necessary are percent-encoded, it is kept this way. * * @throw OFInvalidFormatException The path being set is not in the correct * format */ @property (readwrite, copy, nonatomic) OFString *percentEncodedPath; /** * @brief The path of the URI split into components. * * The first component must always be empty to designate the root. * * @throw OFInvalidFormatException The path components being set are not in the * correct format */ @property (readwrite, copy, nonatomic) OFArray OF_GENERIC(OFString *) *pathComponents; /** * @brief The query part of the URI. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *query; /** * @brief The query part of the URI in percent-encoded form. * * Setting this retains the original percent-encoding used - if more characters * than necessary are percent-encoded, it is kept this way. * * @throw OFInvalidFormatException The query being set is not in the correct * format */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *percentEncodedQuery; /** * @brief The query part of the URI as an array. * * For example, a query like `key1=value1&key2=value2` would correspond to the * following array: * * @[ * [OFPair pairWithFirstObject: @"key1" secondObject: @"value1"], * [OFPair pairWithFirstObject: @"key2" secondObject: @"value2"], * ] * * @throw OFInvalidFormatException The query is not in the correct format */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, OFString *) *) *queryItems; /** * @brief The fragment part of the URI. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *fragment; /** * @brief The fragment part of the URI in percent-encoded form. * * Setting this retains the original percent-encoding used - if more characters * than necessary are percent-encoded, it is kept this way. * * @throw OFInvalidFormatException The fragment being set is not in the correct * format */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *percentEncodedFragment; /** * @brief Creates a new mutable URI with the specified schemed. * * @param scheme The scheme for the URI * @return A new, autoreleased OFMutableURI */ + (instancetype)URIWithScheme: (OFString *)scheme; /** * @brief Initializes an already allocated mutable URI with the specified * schemed. * * @param scheme The scheme for the URI * @return An initialized OFMutableURI */ - (instancetype)initWithScheme: (OFString *)scheme; /** * @brief Appends the specified path component. * * @param component The component to append */ - (void)appendPathComponent: (OFString *)component; /** * @brief Appends the specified path component. * * @param component The component to append * @param isDirectory Whether the path is a directory, in which case a slash is * appened if there is no slash yet */ - (void)appendPathComponent: (OFString *)component isDirectory: (bool)isDirectory; /** * @brief Resolves relative subpaths. */ - (void)standardizePath; /** * @brief Converts the mutable URI to an immutable URI. */ - (void)makeImmutable; @end OF_ASSUME_NONNULL_END |