@@ -20,10 +20,11 @@ #import "OFSerialization.h" OF_ASSUME_NONNULL_BEGIN @class OFArray OF_GENERIC(ObjectType); +@class OFDictionary OF_GENERIC(KeyType, ObjectType); @class OFNumber; @class OFString; /** * @class OFURL OFURL.h ObjFW/OFURL.h @@ -125,10 +126,24 @@ * @brief The query part of the URL in URL-encoded form. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *URLEncodedQuery; +/** + * @brief The query part of the URL as a dictionary. + * + * For example, a query like `key1=value1&key2=value2` would correspond to the + * following dictionary: + * + * @{ + * @"key1": "value1", + * @"key2": "value2" + * } + */ +@property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) + OFDictionary OF_GENERIC(OFString *, OFString *) *queryDictionary; + /** * @brief The fragment part of the URL. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *fragment; @@ -288,10 +303,12 @@ @property (class, readonly, nonatomic) OFCharacterSet *URLPathAllowedCharacterSet; @property (class, readonly, nonatomic) OFCharacterSet *URLQueryAllowedCharacterSet; @property (class, readonly, nonatomic) + OFCharacterSet *URLQueryKeyValueAllowedCharacterSet; +@property (class, readonly, nonatomic) OFCharacterSet *URLFragmentAllowedCharacterSet; #endif /** * @brief Returns the characters allowed in the scheme part of a URL. @@ -333,10 +350,18 @@ * * @return The characters allowed in the query part of a URL. */ + (OFCharacterSet *)URLQueryAllowedCharacterSet; +/** + * @brief Returns the characters allowed in a key/value in the query part of a + * URL. + * + * @return The characters allowed in a key/value in the query part of a URL. + */ ++ (OFCharacterSet *)URLQueryKeyValueAllowedCharacterSet; + /** * @brief Returns the characters allowed in the fragment part of a URL. * * @return The characters allowed in the fragment part of a URL. */