Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -151,10 +151,16 @@ * The environment of the application. */ @property (readonly, nonatomic) OFDictionary OF_GENERIC(OFString *, OFString *) *environment; +/*! + * The delegate of the application. + */ +@property OF_NULLABLE_PROPERTY (assign, nonatomic) + id delegate; + /*! * @brief Returns the only OFApplication instance in the application. * * @return The only OFApplication instance in the application */ @@ -213,24 +219,10 @@ * @param argv A pointer where a pointer to argv should be stored */ - (void)getArgumentCount: (int *_Nonnull *_Nonnull)argc andArgumentValues: (char *_Nonnull *_Nonnull *_Nonnull[_Nonnull])argv; -/*! - * @brief Returns the delegate of the application. - * - * @return The delegate of the application - */ -- (nullable id )delegate; - -/*! - * @brief Sets the delegate of the application. - * - * @param delegate The delegate for the application - */ -- (void)setDelegate: (nullable id )delegate; - /*! * @brief Terminates the application. */ - (void)terminate OF_NO_RETURN; Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -133,10 +133,46 @@ */ + (instancetype) arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects count: (size_t)count; +/*! + * The objects of the array as a C array. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + */ +@property (readonly, nonatomic) + ObjectType const __unsafe_unretained _Nonnull *_Nonnull objects; + +/*! + * The first object of the array or `nil`. + * + * @warning The returned object is *not* retained and autoreleased for + * performance reasons! + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType firstObject; + +/*! + * The last object of the array or `nil`. + * + * @warning The returned object is *not* retained and autoreleased for + * performance reasons! + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType lastObject; + +/*! + * The array sorted in ascending order. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *sortedArray; + +/*! + * The array with the order reversed. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *reversedArray; + /*! * @brief Initializes an OFArray with the specified object. * * @param object An object * @return An initialized OFArray @@ -230,17 +266,10 @@ * @param range The range to copy */ - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer inRange: (of_range_t)range; -/*! - * @brief Returns the objects of the array as a C array. - * - * @return The objects of the array as a C array - */ -- (ObjectType const __unsafe_unretained _Nonnull *_Nonnull)objects; - /*! * @brief Returns the index of the first object that is equivalent to the * specified object or `OF_NOT_FOUND` if it was not found. * * @param object The object whose index is returned @@ -276,30 +305,10 @@ * @return A boolean whether the array contains an object with the specified * address */ - (bool)containsObjectIdenticalTo: (ObjectType)object; -/*! - * @brief Returns the first object of the array or `nil`. - * - * @warning The returned object is *not* retained and autoreleased for - * performance reasons! - * - * @return The first object of the array or `nil` - */ -- (nullable ObjectType)firstObject; - -/*! - * @brief Returns the last object of the array or `nil`. - * - * @warning The returned object is *not* retained and autoreleased for - * performance reasons! - * - * @return The last object of the array or `nil` - */ -- (nullable ObjectType)lastObject; - /*! * @brief Returns the objects in the specified range as a new OFArray. * * @param range The range for the subarray * @return The subarray as a new autoreleased OFArray @@ -372,17 +381,10 @@ * array */ - (void)makeObjectsPerformSelector: (SEL)selector withObject: (nullable id)object; -/*! - * @brief Returns a copy of the array sorted in ascending order. - * - * @return A sorted copy of the array - */ -- (OFArray OF_GENERIC(ObjectType) *)sortedArray; - /*! * @brief Returns a copy of the array sorted using the specified selector and * options. * * @param selector The selector to use to sort the array. It's signature @@ -413,17 +415,10 @@ - (OFArray OF_GENERIC(ObjectType) *) sortedArrayUsingComparator: (of_comparator_t)comparator options: (int)options; #endif -/*! - * @brief Returns a copy of the array with the order reversed. - * - * @return A copy of the array with the order reversed - */ -- (OFArray OF_GENERIC(ObjectType) *)reversedArray; - /*! * @brief Creates a new array with the specified object added. * * @param object The object to add * @return A new array with the specified object added @@ -445,18 +440,10 @@ * @param object The object to remove * @return A new array with the specified object removed */ - (OFArray OF_GENERIC(ObjectType) *)arrayByRemovingObject: (ObjectType)object; -/*! - * @brief Returns an OFEnumerator to enumerate through all objects of the - * array. - * - * @returns An OFEnumerator to enumerate through all objects of the array - */ -- (OFEnumerator OF_GENERIC(ObjectType) *)objectEnumerator; - #ifdef OF_HAVE_BLOCKS /*! * @brief Executes a block for each object. * * @param block The block to execute for each object Index: src/OFCollection.h ================================================================== --- src/OFCollection.h +++ src/OFCollection.h @@ -23,15 +23,13 @@ * * @brief A protocol with methods common for all collections. */ @protocol OFCollection /*! - * @brief Returns the number of objects in the collection. - * * @return The number of objects in the collection */ -- (size_t)count; +@property (readonly, nonatomic) size_t count; /*! * @brief Checks whether the collection contains an object equal to the * specified object. * Index: src/OFCryptoHash.h ================================================================== --- src/OFCryptoHash.h +++ src/OFCryptoHash.h @@ -31,10 +31,19 @@ /*! * A boolean whether the hash has already been calculated. */ @property (readonly, nonatomic, getter=isCalculated) bool calculated; +/*! + * A buffer containing the cryptographic hash. + * + * The size of the buffer depends on the hash used. The buffer is part of the + * receiver's memory pool. + */ +@property (readonly, nonatomic) const unsigned char *digest + OF_RETURNS_INNER_POINTER; + /*! * @brief Creates a new cryptographic hash. * * @return A new autoreleased OFCryptoHash */ @@ -61,20 +70,10 @@ * @param length The length of the buffer */ - (void)updateWithBuffer: (const void *)buffer length: (size_t)length; -/*! - * @brief Returns a buffer containing the cryptographic hash. - * - * The size of the buffer depends on the hash used. The buffer is part of the - * receiver's memory pool. - * - * @return A buffer containing the hash - */ -- (const unsigned char *)digest OF_RETURNS_INNER_POINTER; - /*! * @brief Resets all state so that a new hash can be calculated. * * @warning This invalidates any pointer previously returned by @ref digest. If * you are still interested in the previous digest, you need to memcpy Index: src/OFData+CryptoHashing.h ================================================================== --- src/OFData+CryptoHashing.h +++ src/OFData+CryptoHashing.h @@ -28,60 +28,41 @@ } #endif @interface OFData (CryptoHashing) /*! - * @brief Returns the MD5 hash of the data array as an autoreleased OFString. - * - * @return The MD5 hash of the data array as an autoreleased OFString - */ -- (OFString *)MD5Hash; - -/*! - * @brief Returns the RIPEMD-160 hash of the data array as an autoreleased - * OFString. - * - * @return The RIPEMD-160 hash of the data array as an autoreleased OFString - */ -- (OFString *)RIPEMD160Hash; - -/*! - * @brief Returns the SHA-1 hash of the data array as an autoreleased OFString. - * - * @return The SHA-1 hash of the data array as an autoreleased OFString - */ -- (OFString *)SHA1Hash; - -/*! - * @brief Returns the SHA-224 hash of the data array as an autoreleased - * OFString. - * - * @return The SHA-224 hash of the data array as an autoreleased OFString - */ -- (OFString *)SHA224Hash; - -/*! - * @brief Returns the SHA-256 hash of the data array as an autoreleased - * OFString. - * - * @return The SHA-256 hash of the data array as an autoreleased OFString - */ -- (OFString *)SHA256Hash; - -/*! - * @brief Returns the SHA-384 hash of the data array as an autoreleased - * OFString. - * - * @return The SHA-384 hash of the data array as an autoreleased OFString - */ -- (OFString *)SHA384Hash; - -/*! - * @brief Returns the SHA-512 hash of the data array as an autoreleased - * OFString. - * - * @return The SHA-512 hash of the data array as an autoreleased OFString - */ -- (OFString *)SHA512Hash; + * The MD5 hash of the data as a string. + */ +@property (readonly, nonatomic) OFString *MD5Hash; + +/*! + * The RIPEMD-160 hash of the data as a string. + */ +@property (readonly, nonatomic) OFString *RIPEMD160Hash; + +/*! + * The SHA-1 hash of the data as a string. + */ +@property (readonly, nonatomic) OFString *SHA1Hash; + +/*! + * The SHA-224 hash of the data as a string. + */ +@property (readonly, nonatomic) OFString *SHA224Hash; + +/*! + * The SHA-256 hash of the data as a string. + */ +@property (readonly, nonatomic) OFString *SHA256Hash; + +/*! + * The SHA-384 hash of the data as a string. + */ +@property (readonly, nonatomic) OFString *SHA384Hash; + +/*! + * @return The SHA-512 hash of the data as a string. + */ +@property (readonly, nonatomic) OFString *SHA512Hash; @end OF_ASSUME_NONNULL_END Index: src/OFData+MessagePackValue.h ================================================================== --- src/OFData+MessagePackValue.h +++ src/OFData+MessagePackValue.h @@ -26,15 +26,13 @@ } #endif @interface OFData (MessagePackValue) /*! - * @brief Parses the MessagePack representation and returns it as an object. - * - * @return The MessagePack representation as an object + * The data interpreted as MessagePack representation and parsed as an object. */ -- (id)messagePackValue; +@property (readonly, nonatomic) id messagePackValue; /*! * @brief Parses the MessagePack representation and returns it as an object. * * @param depthLimit The maximum depth the parser should accept (defaults to 32 Index: src/OFData.h ================================================================== --- src/OFData.h +++ src/OFData.h @@ -42,10 +42,48 @@ /*! * The size of a single item in the OFData in bytes. */ @property (readonly, nonatomic) size_t itemSize; +/*! + * The number of items in the OFData. + */ +@property (readonly, nonatomic) size_t count; + +/*! + * All elements of the OFData as a C array. + * + * @warning The pointer is only valid until the OFData is changed! + * + */ +@property (readonly, nonatomic) const void *items OF_RETURNS_INNER_POINTER; + +/*! + * The first item of the OFData or NULL. + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) const void *firstItem + OF_RETURNS_INNER_POINTER; + +/*! + * The last item of the OFData or NULL. + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) const void *lastItem + OF_RETURNS_INNER_POINTER; + +/*! + * The string representation of the data. + * + * The string representation is a hex dump of the data, grouped by itemSize + * bytes. + */ +@property (readonly, nonatomic) OFString *stringRepresentation; + +/*! + * A string containing the data in Base64 encoding. + */ +@property (readonly, nonatomic) OFString *stringByBase64Encoding; + /*! * @brief Creates a new OFData with the specified `count` items of size 1. * * @param items The items to store in the OFData * @param count The number of items @@ -233,65 +271,18 @@ * @param string The string with the Base64-encoded data * @return An initialized OFData */ - (instancetype)initWithBase64EncodedString: (OFString *)string; -/*! - * @brief Returns the number of items in the OFData. - * - * @return The number of items in the OFData - */ -- (size_t)count; - -/*! - * @brief Returns all items of the OFData as a C array. - * - * @warning The pointer is only valid until the OFData is changed! - * - * @return All elements of the OFData as a C array - */ -- (const void *)items OF_RETURNS_INNER_POINTER; - /*! * @brief Returns a specific item of the OFData. * * @param index The number of the item to return * @return The specified item of the OFData */ - (const void *)itemAtIndex: (size_t)index OF_RETURNS_INNER_POINTER; -/*! - * @brief Returns the first item of the OFData. - * - * @return The first item of the OFData or NULL - */ -- (nullable const void *)firstItem OF_RETURNS_INNER_POINTER; - -/*! - * @brief Returns the last item of the OFData. - * - * @return The last item of the OFData or NULL - */ -- (nullable const void *)lastItem OF_RETURNS_INNER_POINTER; - -/*! - * @brief Returns the string representation of the data. - * - * The string representation is a hex dump of the data, grouped by itemSize - * bytes. - * - * @return The string representation of the data. - */ -- (OFString *)stringRepresentation; - -/*! - * @brief Returns a string containing the data in Base64 encoding. - * - * @return A string containing the data in Base64 encoding - */ -- (OFString *)stringByBase64Encoding; - #ifdef OF_HAVE_FILES /*! * @brief Writes the OFData into the specified file. * * @param path The path of the file to write to Index: src/OFDate.h ================================================================== --- src/OFDate.h +++ src/OFDate.h @@ -30,10 +30,100 @@ @interface OFDate: OFObject { of_time_interval_t _seconds; } +/*! + * The microsecond of the date. + */ +@property (readonly, nonatomic) uint32_t microsecond; + +/*! + * The second of the date. + */ +@property (readonly, nonatomic) uint8_t second; + +/*! + * The minute of the date. + */ +@property (readonly, nonatomic) uint8_t minute; + +/*! + * The minute of the date in local time. + */ +@property (readonly, nonatomic) uint8_t localMinute; + +/*! + * The hour of the date. + */ +@property (readonly, nonatomic) uint8_t hour; + +/*! + * The hour of the date in local time. + */ +@property (readonly, nonatomic) uint8_t localHour; + +/*! + * The day of the month of the date. + */ +@property (readonly, nonatomic) uint8_t dayOfMonth; + +/*! + * The day of the month of the date in local time. + */ +@property (readonly, nonatomic) uint8_t localDayOfMonth; + +/*! + * The month of the year of the date. + */ +@property (readonly, nonatomic) uint8_t monthOfYear; + +/*! + * The month of the year of the date in local time. + */ +@property (readonly, nonatomic) uint8_t localMonthOfYear; + +/*! + * The year of the date. + */ +@property (readonly, nonatomic) uint16_t year; + +/*! + * The year of the date in local time. + */ +@property (readonly, nonatomic) uint16_t localYear; + +/*! + * The day of the week of the date. + */ +@property (readonly, nonatomic) uint8_t dayOfWeek; + +/*! + * The day of the week of the date in local time. + */ +@property (readonly, nonatomic) uint8_t localDayOfWeek; + +/*! + * The day of the year of the date. + */ +@property (readonly, nonatomic) uint16_t dayOfYear; + +/*! + * The day of the year of the date in local time. + */ +@property (readonly, nonatomic) uint16_t localDayOfYear; + +/*! + * The seconds since 1970-01-01T00:00:00Z. + */ +@property (readonly, nonatomic) of_time_interval_t timeIntervalSince1970; + +/*! + * The seconds the date is in the future. + */ +@property (readonly, nonatomic) of_time_interval_t timeIntervalSinceNow; + /*! * @brief Creates a new OFDate with the current date and time. * * @return A new, autoreleased OFDate with the current date and time */ @@ -165,122 +255,10 @@ * @return An initialized OFDate with the specified date and time */ - (instancetype)initWithLocalDateString: (OFString *)string format: (OFString *)format; -/*! - * @brief Returns the microsecond of the date. - * - * @return The microsecond of the date - */ -- (uint32_t)microsecond; - -/*! - * @brief Returns the second of the date. - * - * @return The second of the date - */ -- (uint8_t)second; - -/*! - * @brief Returns the minute of the date. - * - * @return The minute of the date - */ -- (uint8_t)minute; - -/*! - * @brief Returns the minute of the date in local time. - * - * @return The minute of the date in local time - */ -- (uint8_t)localMinute; - -/*! - * @brief Returns the hour of the date. - * - * @return The hour of the date - */ -- (uint8_t)hour; - -/*! - * @brief Returns the hour of the date in local time. - * - * @return The hour of the date in local time - */ -- (uint8_t)localHour; - -/*! - * @brief Returns the day of the month. - * - * @return The day of the month of the date - */ -- (uint8_t)dayOfMonth; - -/*! - * @brief Returns the day of the month of the date in local time. - * - * @return The day of the month of the date in local time - */ -- (uint8_t)localDayOfMonth; - -/*! - * @brief Returns the month of the year of the date. - * - * @return The month of the year of the date - */ -- (uint8_t)monthOfYear; - -/*! - * @brief Returns the month of the year of the date in local time. - * - * @return The month of the year of the date in local time - */ -- (uint8_t)localMonthOfYear; - -/*! - * @brief Returns the year of the date. - * - * @return The year of the date - */ -- (uint16_t)year; - -/*! - * @brief Returns the year of the date in local time. - * - * @return The year of the date in local time - */ -- (uint16_t)localYear; - -/*! - * @brief Returns the day of the week of the date. - * - * @return The day of the week of the date - */ -- (uint8_t)dayOfWeek; - -/*! - * @brief Returns the day of the week of the date in local time. - * - * @return The day of the week of the date in local time - */ -- (uint8_t)localDayOfWeek; - -/*! - * @brief Returns the day of the year of the date. - * - * @return The day of the year of the date - */ -- (uint16_t)dayOfYear; - -/*! - * @brief Returns the day of the year of the date in local time. - * - * @return The day of the year of the date in local time - */ -- (uint16_t)localDayOfYear; - /*! * @brief Creates a string of the date with the specified format. * * See the man page for `strftime` for information on the format. * @@ -317,32 +295,18 @@ * @param otherDate Another date * @return The later date of the two dates */ - (OFDate *)laterDate: (nullable OFDate *)otherDate; -/*! - * @brief Returns the seconds since 1970-01-01T00:00:00Z. - * - * @return The seconds since 1970-01-01T00:00:00Z - */ -- (of_time_interval_t)timeIntervalSince1970; - /*! * @brief Returns the seconds the receiver is after the date. * * @param otherDate Date date to generate the difference with receiver * @return The seconds the receiver is after the date. */ - (of_time_interval_t)timeIntervalSinceDate: (OFDate *)otherDate; -/*! - * @brief Returns the seconds the receiver is in the future. - * - * @return The seconds the receiver is in the future - */ -- (of_time_interval_t)timeIntervalSinceNow; - /*! * @brief Creates a new date with the specified time interval added. * * @param seconds The seconds after the date * @return A new, autoreleased OFDate Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -115,10 +115,25 @@ * @return A new autoreleased OFDictionary */ + (instancetype)dictionaryWithKeysAndObjects: (KeyType)firstKey, ... OF_SENTINEL; +/*! + * An array of all keys. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(KeyType) *allKeys; + +/*! + * An array of all objects. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *allObjects; + +/*! + * A URL-encoded string with the contents of the dictionary. + */ +@property (readonly, nonatomic) OFString *stringByURLEncoding; + /*! * @brief Initializes an already allocated OFDictionary with the specified * OFDictionary. * * @param dictionary An OFDictionary @@ -241,31 +256,10 @@ * @return A boolean whether the dictionary contains an object with the * specified address */ - (bool)containsObjectIdenticalTo: (ObjectType)object; -/*! - * @brief Returns an array of all keys. - * - * @return An array of all keys - */ -- (OFArray OF_GENERIC(KeyType) *)allKeys; - -/*! - * @brief Returns an array of all objects. - * - * @return An array of all objects - */ -- (OFArray OF_GENERIC(ObjectType) *)allObjects; - -/*! - * @brief Creates a string by URL-encoding the contents of the dictionary. - * - * @return A URL-encoded string with the contents of the dictionary - */ -- (OFString *)stringByURLEncoding; - /*! * @brief Returns an OFEnumerator to enumerate through the dictionary's keys. * * @return An OFEnumerator to enumerate through the dictionary's keys */ Index: src/OFEnumerator.h ================================================================== --- src/OFEnumerator.h +++ src/OFEnumerator.h @@ -29,11 +29,11 @@ @protocol OFEnumerating /*! * @brief Returns an OFEnumerator to enumerate through all objects of the * collection. * - * @returns An OFEnumerator to enumerate through all objects of the collection + * @return An OFEnumerator to enumerate through all objects of the collection */ - (OFEnumerator *)objectEnumerator; @end /*! @@ -44,23 +44,21 @@ @interface OFEnumerator OF_GENERIC(ObjectType): OFObject #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif /*! - * @brief Returns the next object or `nil` if there is none left. + * An array of all remaining objects in the collection. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *allObjects; + +/*! + * Returns the next object or `nil` if there is none left. * * @return The next object or `nil` if there is none left */ - (nullable ObjectType)nextObject; -/*! - * @brief Returns an array of all remaining objects in the collection. - * - * @return An array of all remaining objects in the collection - */ -- (OFArray OF_GENERIC(ObjectType) *)allObjects; - /*! * @brief Resets the enumerator, so the next call to nextObject returns the * first object again. */ - (void)reset; Index: src/OFFileManager.h ================================================================== --- src/OFFileManager.h +++ src/OFFileManager.h @@ -41,29 +41,25 @@ * * @brief A class which provides management for files, e.g. reading contents of * directories, deleting files, renaming files, etc. */ @interface OFFileManager: OFObject +/*! + * The path of the current working directory. + */ +@property (readonly, nonatomic) OFString *currentDirectoryPath; + +/*! + * The URL of the current working directory. + */ +@property (readonly, nonatomic) OFURL *currentDirectoryURL; + /*! * @brief Returns the default file manager. */ + (OFFileManager *)defaultManager; -/*! - * @brief Returns the path for the current working directory. - * - * @return The path of the current working directory - */ -- (OFString *)currentDirectoryPath; - -/*! - * @brief Returns the URL for the current working directory. - * - * @return The URL of the current working directory - */ -- (OFURL *)currentDirectoryURL; - /*! * @brief Checks whether a file exists at the specified path. * * @param path The path to check * @return A boolean whether there is a file at the specified path Index: src/OFHMAC.h ================================================================== --- src/OFHMAC.h +++ src/OFHMAC.h @@ -30,13 +30,29 @@ id _Nullable _outerHash, _innerHash; id _Nullable _outerHashCopy, _innerHashCopy; bool _calculated; } -/*! The class for the cryptographic hash used by the HMAC. */ +/*! + * The class for the cryptographic hash used by the HMAC. + */ @property (readonly, nonatomic) Class hashClass; +/*! + * A buffer containing the HMAC. + * + * The size of the buffer depends on the hash used. The buffer is part of the + * receiver's memory pool. + */ +@property (readonly, nonatomic) const unsigned char *digest + OF_RETURNS_INNER_POINTER; + +/*! + * The size of the digest. + */ +@property (readonly, nonatomic) size_t digestSize; + /*! * @brief Returns a new OFHMAC with the specified hashing algorithm. * * @param hashClass The class of the hashing algorithm * @return A new, autoreleased OFHMAC @@ -77,27 +93,10 @@ * @param length The length of the buffer */ - (void)updateWithBuffer: (const void *)buffer length: (size_t)length; -/*! - * @brief Returns a buffer containing the HMAC. - * - * The size of the buffer depends on the hash used. The buffer is part of the - * receiver's memory pool. - * - * @return A buffer containing the hash - */ -- (const unsigned char *)digest OF_RETURNS_INNER_POINTER; - -/*! - * @brief Returns the size of the digest. - * - * @return The size of the digest. - */ -- (size_t)digestSize; - /*! * @brief Resets the HMAC so that it can be calculated for a new message. * * @note This does not reset the key so that a new HMAC with the same key can * be calculated efficiently. If you want to reset both, use Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -79,10 +79,20 @@ /*! * The URL of the HTTP request. */ @property (copy, nonatomic) OFURL *URL; +/*! + * The protocol version of the HTTP request. + */ +@property (nonatomic) of_http_request_protocol_version_t protocolVersion; + +/*! + * The protocol version of the HTTP request as a string. + */ +@property (readonly, nonatomic) OFString *protocolVersionString; + /*! * The request method of the HTTP request. */ @property (nonatomic) of_http_request_method_t method; @@ -123,39 +133,18 @@ * @param URL The URL for the request * @return An initialized OFHTTPRequest */ - (instancetype)initWithURL: (OFURL *)URL; -/*! - * @brief Sets the protocol version of the HTTP request. - * - * @param protocolVersion The protocol version of the HTTP request - */ -- (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion; - -/*! - * @brief Returns the protocol version of the HTTP request. - * - * @return The protocol version of the HTTP request - */ -- (of_http_request_protocol_version_t)protocolVersion; - /*! * @brief Sets the protocol version of the HTTP request to the version * described by the specified string. * * @param string A string describing an HTTP version */ - (void)setProtocolVersionFromString: (OFString *)string; -/*! - * @brief Returns the protocol version of the HTTP request as a string. - * - * @return The protocol version of the HTTP request as a string - */ -- (OFString *)protocolVersionString; - /*! * @brief Sets the entity body of the HTTP request to the specified string * encoded in UTF-8. * * @param string The string to use for the entity body Index: src/OFHTTPResponse.h ================================================================== --- src/OFHTTPResponse.h +++ src/OFHTTPResponse.h @@ -32,10 +32,20 @@ of_http_request_protocol_version_t _protocolVersion; short _statusCode; OFDictionary OF_GENERIC(OFString *, OFString *) *_headers; } +/*! + * The protocol version of the HTTP request reply. + */ +@property (nonatomic) of_http_request_protocol_version_t protocolVersion; + +/*! + * The protocol version of the HTTP request reply as a string. + */ +@property (readonly, nonatomic) OFString *protocolVersionString; + /*! * The status code of the reply to the HTTP request. */ @property (nonatomic) short statusCode; @@ -44,45 +54,22 @@ */ @property (copy, nonatomic) OFDictionary OF_GENERIC(OFString *, OFString *) *headers; /*! - * @brief Sets the protocol version of the HTTP request reply. - * - * @param protocolVersion The protocol version of the HTTP request reply - */ -- (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion; - -/*! - * @brief Returns the protocol version of the HTTP request reply. - * - * @return The protocol version of the HTTP request reply - */ -- (of_http_request_protocol_version_t)protocolVersion; + * The reply as a string, trying to detect the encoding. + */ +@property (readonly, nonatomic) OFString *string; /*! * @brief Sets the protocol version of the HTTP request reply to the version * described by the specified string. * * @param string A string describing an HTTP version */ - (void)setProtocolVersionFromString: (OFString *)string; -/*! - * @brief Returns the protocol version of the HTTP request reply as a string. - * - * @return The protocol version of the HTTP request reply as a string - */ -- (OFString *)protocolVersionString; - -/*! - * @brief Returns the reply as a string, trying to detect the encoding. - * - * @return The reply as a string - */ -- (OFString *)string; - /*! * @brief Returns the reply as a string, trying to detect the encoding and * falling back to the specified encoding if not detectable. * * @return The reply as a string Index: src/OFIntrospection.h ================================================================== --- src/OFIntrospection.h +++ src/OFIntrospection.h @@ -71,11 +71,11 @@ * @brief A class for describing a property. */ @interface OFProperty: OFObject { OFString *_name; - unsigned _attributes; + unsigned int _attributes; OFString *_Nullable _getter, *_Nullable _setter; } /*! * The name of the property. @@ -97,11 +97,11 @@ * OF_PROPERTY_ATOMIC | The property is declared `atomic` * OF_PROPERTY_WEAK | The property is declared `weak` * OF_PROPERTY_SYNTHESIZED | The property is synthesized * OF_PROPERTY_DYNAMIC | The property is dynamic */ -@property (readonly, nonatomic) unsigned attributes; +@property (readonly, nonatomic) unsigned int attributes; /*! * The name of the getter. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *getter; Index: src/OFJSONRepresentation.h ================================================================== --- src/OFJSONRepresentation.h +++ src/OFJSONRepresentation.h @@ -35,15 +35,13 @@ * OFArray and OFDictionary, this will generate invalid JSON, as JSON * requires all data to be encapsulated in an array or a dictionary! */ @protocol OFJSONRepresentation /*! - * @brief Returns the JSON representation of the object as a string. - * - * @return The JSON representation of the object as a string + * The JSON representation of the object as a string. */ -- (OFString *)JSONRepresentation; +@property (readonly, nonatomic) OFString *JSONRepresentation; /*! * @brief Returns the JSON representation of the object as a string. * * @param options The options to use when creating a JSON representation.@n Index: src/OFKernelEventObserver.h ================================================================== --- src/OFKernelEventObserver.h +++ src/OFKernelEventObserver.h @@ -67,17 +67,14 @@ * @brief This protocol is implemented by classes which can be observed for * readiness for reading by OFKernelEventObserver. */ @protocol OFReadyForReadingObserving /*! - * @brief Returns the file descriptor for reading that should be checked by the - * OFKernelEventObserver. - * - * @return The file descriptor for reading that should be checked by the - * OFKernelEventObserver + * The file descriptor for reading that should be checked by the + * OFKernelEventObserver. */ -- (int)fileDescriptorForReading; +@property (readonly, nonatomic) int fileDescriptorForReading; @end /*! * @protocol OFReadyForWritingObserving * OFKernelEventObserver.h ObjFW/OFKernelEventObserver.h @@ -85,17 +82,14 @@ * @brief This protocol is implemented by classes which can be observed for * readiness for writing by OFKernelEventObserver. */ @protocol OFReadyForWritingObserving /*! - * @brief Returns the file descriptor for writing that should be checked by the - * OFKernelEventObserver. - * - * @return The file descriptor for writing that should be checked by the - * OFKernelEventObserver + * The file descriptor for writing that should be checked by the + * OFKernelEventObserver. */ -- (int)fileDescriptorForWriting; +@property (readonly, nonatomic) int fileDescriptorForWriting; @end /*! * @class OFKernelEventObserver * OFKernelEventObserver.h ObjFW/OFKernelEventObserver.h Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -60,16 +60,32 @@ * The first list object of the list. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) of_list_object_t *firstListObject; +/*! + * The first object of the list or `nil`. + * + * @warning The returned object is *not* retained and autoreleased for + * performance reasons! + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType firstObject; + /*! * The last list object of the list. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) of_list_object_t *lastListObject; +/*! + * The last object of the list or `nil`. + * + * @warning The returned object is *not* retained and autoreleased for + * performance reasons! + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType lastObject; + /*! * @brief Creates a new OFList. * * @return A new autoreleased OFList */ @@ -144,37 +160,10 @@ * @return A boolean whether the list contains an object with the specified * address */ - (bool)containsObjectIdenticalTo: (ObjectType)object; -/*! - * @brief Returns an OFEnumerator to enumerate through all objects of the list. - * - * @returns An OFEnumerator to enumerate through all objects of the list - */ -- (OFEnumerator OF_GENERIC(ObjectType) *)objectEnumerator; - -/*! - * @brief Returns the first object of the list or `nil`. - * - * @warning The returned object is *not* retained and autoreleased for - * performance reasons! - * - * @return The first object of the list or `nil` - */ -- (nullable ObjectType)firstObject; - -/*! - * @brief Returns the last object of the list or `nil`. - * - * @warning The returned object is *not* retained and autoreleased for - * performance reasons! - * - * @return The last object of the list or `nil` - */ -- (nullable ObjectType)lastObject; - /*! * @brief Removes all objects from the list. */ - (void)removeAllObjects; #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -86,10 +86,15 @@ /*! * The object functions used by the map table. */ @property (readonly, nonatomic) of_map_table_functions_t objectFunctions; +/*! + * The number of objects in the map table. + */ +@property (readonly, nonatomic) size_t count; + /*! * @brief Creates a new OFMapTable with the specified key and object functions. * * @param keyFunctions A structure of functions for handling keys * @param objectFunctions A structure of functions for handling objects @@ -140,17 +145,10 @@ - (instancetype)initWithKeyFunctions: (of_map_table_functions_t)keyFunctions objectFunctions: (of_map_table_functions_t)objectFunctions capacity: (size_t)capacity OF_DESIGNATED_INITIALIZER; -/*! - * @brief Returns the number of objects in the map table. - * - * @return The number of objects in the map table - */ -- (size_t)count; - /*! * @brief Returns the object for the given key or NULL if the key was not found. * * @param key The key whose object should be returned * @return The object for the given key or NULL if the key was not found Index: src/OFMessagePackRepresentation.h ================================================================== --- src/OFMessagePackRepresentation.h +++ src/OFMessagePackRepresentation.h @@ -27,13 +27,11 @@ * @brief A protocol implemented by classes that support encoding to a * MessagePack representation. */ @protocol OFMessagePackRepresentation /*! - * @brief Returns the MessagePack representation of the object as OFData. - * * @return The MessagePack representation of the object as OFData. */ -- (OFData *)messagePackRepresentation; +@property (readonly, nonatomic) OFData *messagePackRepresentation; @end OF_ASSUME_NONNULL_END Index: src/OFMutableData.h ================================================================== --- src/OFMutableData.h +++ src/OFMutableData.h @@ -195,20 +195,36 @@ - (void)makeImmutable; @end @interface OFMutableData (MutableRetrieving) /*! - * @brief Returns all items of the OFMutableData as a C array. + * All items of the OFMutableData as a C array. * * @warning The pointer is only valid until the OFMutableData is changed! * * Modifying the returned array directly is allowed and will change the contents * of the data array. + */ +@property (readonly, nonatomic) void *items OF_RETURNS_INNER_POINTER; + +/*! + * The first item of the OFMutableData or NULL. + * + * Modifying the returned item directly is allowed and will change the contents + * of the data array. + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *firstItem + OF_RETURNS_INNER_POINTER; + +/*! + * Last item of the OFMutableData or NULL. * - * @return All elements of the OFMutableData as a C array + * Modifying the returned item directly is allowed and will change the contents + * of the data array. */ -- (void *)items OF_RETURNS_INNER_POINTER; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *lastItem + OF_RETURNS_INNER_POINTER; /*! * @brief Returns a specific item of the OFMutableData. * * Modifying the returned item directly is allowed and will change the contents @@ -216,28 +232,8 @@ * * @param index The number of the item to return * @return The specified item of the OFMutableData */ - (void *)itemAtIndex: (size_t)index OF_RETURNS_INNER_POINTER; - -/*! - * @brief Returns the first item of the OFMutableData. - * - * Modifying the returned item directly is allowed and will change the contents - * of the data array. - * - * @return The first item of the OFMutableData or NULL - */ -- (nullable void *)firstItem OF_RETURNS_INNER_POINTER; - -/*! - * @brief Returns the last item of the OFMutableData. - * - * Modifying the returned item directly is allowed and will change the contents - * of the data array. - * - * @return The last item of the OFMutableData or NULL - */ -- (nullable void *)lastItem OF_RETURNS_INNER_POINTER; @end OF_ASSUME_NONNULL_END Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -154,10 +154,150 @@ /*! * The type of the number. */ @property (readonly, nonatomic) of_number_type_t type; +/*! + * Returns the OFNumber as a bool. + */ +@property (readonly, nonatomic) bool boolValue; + +/*! + * The OFNumber as a signed char. + */ +@property (readonly, nonatomic) signed char charValue; + +/*! + * The OFNumber as a signed short. + */ +@property (readonly, nonatomic) signed short shortValue; + +/*! + * The OFNumber as a signed int. + */ +@property (readonly, nonatomic) signed int intValue; + +/*! + * The OFNumber as a signed long. + */ +@property (readonly, nonatomic) signed long longValue; + +/*! + * The OFNumber as a signed long long. + */ +@property (readonly, nonatomic) signed long long longLongValue; + +/*! + * The OFNumber as an unsigned char. + */ +@property (readonly, nonatomic) unsigned char unsignedCharValue; + +/*! + * The OFNumber as an unsigned short. + */ +@property (readonly, nonatomic) unsigned short unsignedShortValue; + +/*! + * The OFNumber as an unsigned int. + */ +@property (readonly, nonatomic) unsigned int unsignedIntValue; + +/*! + * The OFNumber as an unsigned long. + */ +@property (readonly, nonatomic) unsigned long unsignedLongValue; + +/*! + * The OFNumber as an unsigned long long. + */ +@property (readonly, nonatomic) unsigned long long unsignedLongLongValue; + +/*! + * The OFNumber as an int8_t. + */ +@property (readonly, nonatomic) int8_t int8Value; + +/*! + * The OFNumber as an int16_t. + */ +@property (readonly, nonatomic) int16_t int16Value; + +/*! + * The OFNumber as an int32_t. + */ +@property (readonly, nonatomic) int32_t int32Value; + +/*! + * The OFNumber as an int64_t. + */ +@property (readonly, nonatomic) int64_t int64Value; + +/*! + * The OFNumber as a uint8_t. + */ +@property (readonly, nonatomic) uint8_t uInt8Value; + +/*! + * The OFNumber as a uint16_t. + */ +@property (readonly, nonatomic) uint16_t uInt16Value; + +/*! + * The OFNumber as a uint32_t. + */ +@property (readonly, nonatomic) uint32_t uInt32Value; + +/*! + * The OFNumber as a uint64_t. + */ +@property (readonly, nonatomic) uint64_t uInt64Value; + +/*! + * The OFNumber as a size_t. + */ +@property (readonly, nonatomic) size_t sizeValue; + +/*! + * The OFNumber as an ssize_t. + */ +@property (readonly, nonatomic) ssize_t sSizeValue; + +/*! + * The OFNumber as an intmax_t. + */ +@property (readonly, nonatomic) intmax_t intMaxValue; + +/*! + * The OFNumber as a uintmax_t. + */ +@property (readonly, nonatomic) uintmax_t uIntMaxValue; + +/*! + * The OFNumber as a ptrdiff_t. + */ +@property (readonly, nonatomic) ptrdiff_t ptrDiffValue; + +/*! + * The OFNumber as an intptr_t. + */ +@property (readonly, nonatomic) intptr_t intPtrValue; + +/*! + * The OFNumber as a uintptr_t. + */ +@property (readonly, nonatomic) uintptr_t uIntPtrValue; + +/*! + * The OFNumber as a float. + */ +@property (readonly, nonatomic) float floatValue; + +/*! + * The OFNumber as a double. + */ +@property (readonly, nonatomic) double doubleValue; + /*! * @brief Creates a new OFNumber with the specified bool. * * @param bool_ A bool which the OFNumber should contain * @return A new autoreleased OFNumber @@ -616,209 +756,13 @@ * * @param double_ A double which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithDouble: (double)double_; - -/*! - * @brief Returns the OFNumber as a bool. - * - * @return The OFNumber as a bool - */ -- (bool)boolValue; - -/*! - * @brief Returns the OFNumber as a signed char. - * - * @return The OFNumber as a signed char - */ -- (signed char)charValue; - -/*! - * @brief Returns the OFNumber as a signed short. - * - * @return The OFNumber as a signed short - */ -- (signed short)shortValue; - -/*! - * @brief Returns the OFNumber as a signed int. - * - * @return The OFNumber as a signed int - */ -- (signed int)intValue; - -/*! - * @brief Returns the OFNumber as a signed long. - * - * @return The OFNumber as a signed long - */ -- (signed long)longValue; - -/*! - * @brief Returns the OFNumber as a signed long long. - * - * @return The OFNumber as a signed long long - */ -- (signed long long)longLongValue; - -/*! - * @brief Returns the OFNumber as an unsigned char. - * - * @return The OFNumber as an unsigned char - */ -- (unsigned char)unsignedCharValue; - -/*! - * @brief Returns the OFNumber as an unsigned short. - * - * @return The OFNumber as an unsigned short - */ -- (unsigned short)unsignedShortValue; - -/*! - * @brief Returns the OFNumber as an unsigned int. - * - * @return The OFNumber as an unsigned int - */ -- (unsigned int)unsignedIntValue; - -/*! - * @brief Returns the OFNumber as an unsigned long. - * - * @return The OFNumber as an unsigned long - */ -- (unsigned long)unsignedLongValue; - -/*! - * @brief Returns the OFNumber as an unsigned long long. - * - * @return The OFNumber as an unsigned long long - */ -- (unsigned long long)unsignedLongLongValue; - -/*! - * @brief Returns the OFNumber as an int8_t. - * - * @return The OFNumber as an int8_t - */ -- (int8_t)int8Value; - -/*! - * @brief Returns the OFNumber as an int16_t. - * - * @return The OFNumber as an int16_t - */ -- (int16_t)int16Value; - -/*! - * @brief Returns the OFNumber as an int32_t. - * - * @return The OFNumber as an int32_t - */ -- (int32_t)int32Value; - -/*! - * @brief Returns the OFNumber as an int64_t. - * - * @return The OFNumber as an int64_t - */ -- (int64_t)int64Value; - -/*! - * @brief Returns the OFNumber as a uint8_t. - * - * @return The OFNumber as a uint8_t - */ -- (uint8_t)uInt8Value; - -/*! - * @brief Returns the OFNumber as a uint16_t. - * - * @return The OFNumber as a uint16_t - */ -- (uint16_t)uInt16Value; - -/*! - * @brief Returns the OFNumber as a uint32_t. - * - * @return The OFNumber as a uint32_t - */ -- (uint32_t)uInt32Value; - -/*! - * @brief Returns the OFNumber as a uint64_t. - * - * @return The OFNumber as a uint64_t - */ -- (uint64_t)uInt64Value; - -/*! - * @brief Returns the OFNumber as a size_t. - * - * @return The OFNumber as a size_t - */ -- (size_t)sizeValue; - -/*! - * @brief Returns the OFNumber as an ssize_t. - * - * @return The OFNumber as an ssize_t - */ -- (ssize_t)sSizeValue; - -/*! - * @brief Returns the OFNumber as an intmax_t. - * - * @return The OFNumber as an intmax_t - */ -- (intmax_t)intMaxValue; - -/*! - * @brief Returns the OFNumber as a uintmax_t. - * - * @return The OFNumber as a uintmax_t - */ -- (uintmax_t)uIntMaxValue; - -/*! - * @brief Returns the OFNumber as a ptrdiff_t. - * - * @return The OFNumber as a ptrdiff_t - */ -- (ptrdiff_t)ptrDiffValue; - -/*! - * @brief Returns the OFNumber as an intptr_t. - * - * @return The OFNumber as an intptr_t - */ -- (intptr_t)intPtrValue; - -/*! - * @brief Returns the OFNumber as a uintptr_t. - * - * @return The OFNumber as a uintptr_t - */ -- (uintptr_t)uIntPtrValue; - -/*! - * @brief Returns the OFNumber as a float. - * - * @return The OFNumber as a float - */ -- (float)floatValue; - -/*! - * @brief Returns the OFNumber as a double. - * - * @return The OFNumber as a double - */ -- (double)doubleValue; @end OF_ASSUME_NONNULL_END #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules) /* Required for number literals to work */ @compatibility_alias NSNumber OFNumber; #endif Index: src/OFObject+Serialization.h ================================================================== --- src/OFObject+Serialization.h +++ src/OFObject+Serialization.h @@ -28,13 +28,11 @@ } #endif @interface OFObject (OFSerialization) /*! - * @brief Creates a string by serializing the receiver. - * - * @return The object serialized as a string + * The object serialized as a string. */ -- (OFString *)stringBySerializing; +@property (readonly, nonatomic) OFString *stringBySerializing; @end OF_ASSUME_NONNULL_END Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -197,22 +197,45 @@ * * @brief The protocol which all root classes implement. */ @protocol OFObject /*! - * @brief Returns the class of the object. - * - * @return The class of the object + * The class of the object. */ -- (Class)class; +@property (readonly, nonatomic) Class class; /*! - * @brief Returns the superclass of the object. + * The superclass of the object. + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class superclass; + +/*! + * A 32 bit hash for the object. * - * @return The superclass of the object + * Classes containing data (like strings, arrays, lists etc.) should reimplement + * this! + * + * @warning If you reimplement this, you also need to reimplement @ref isEqual: + * to behave in a way compatible to your reimplementation of this + * method! */ -- (nullable Class)superclass; +@property (readonly, nonatomic) uint32_t hash; + +/*! + * The retain count. + */ +@property (readonly, nonatomic) unsigned int retainCount; + +/*! + * Whether the object is a proxy object. + */ +@property (readonly, nonatomic) bool isProxy; + +/*! + * Whether the object allows weak references. + */ +@property (readonly, nonatomic) bool allowsWeakReference; /*! * @brief Returns a boolean whether the object of the specified kind. * * @param class_ The class whose kind is checked @@ -336,39 +359,18 @@ * @param object The object which should be tested for equality * @return A boolean whether the object is equal to the specified object */ - (bool)isEqual: (nullable id)object; -/*! - * @brief Calculates a hash for the object. - * - * Classes containing data (like strings, arrays, lists etc.) should reimplement - * this! - * - * @warning If you reimplement this, you also need to reimplement @ref isEqual: - * to behave in a way compatible to your reimplementation of this - * method! - * - * @return A 32 bit hash for the object - */ -- (uint32_t)hash; - /*! * @brief Increases the retain count. * * Each time an object is released, the retain count gets decreased and the * object deallocated if it reaches 0. */ - (instancetype)retain; -/*! - * @brief Returns the retain count. - * - * @return The retain count - */ -- (unsigned int)retainCount; - /*! * @brief Decreases the retain count. * * Each time an object is released, the retain count gets decreased and the * object deallocated if it reaches 0. @@ -388,24 +390,10 @@ * * @return The receiver */ - (instancetype)self; -/*! - * @brief Returns whether the object is a proxy object. - * - * @return A boolean whether the object is a proxy object - */ -- (bool)isProxy; - -/*! - * @brief Returns whether the class allows weak references. - * - * @return Whether the class allows weak references - */ -- (bool)allowsWeakReference; - /*! * @brief Retain a weak reference to this object. * * @return Whether a weak reference to this object has been retained */ @@ -426,10 +414,23 @@ #else Class _isa __attribute__((__unused__)); #endif } +/*! + * The name of the object's class. + */ +@property (readonly, nonatomic) OFString *className; + +/*! + * A description for the object. + * + * This is used when the object is used in a format string and for debugging + * purposes. + */ +@property (readonly, nonatomic) OFString *description; + /*! * @brief A method which is called once when the class is loaded into the * runtime. * * Derived classes can override this to execute their own code when the class @@ -650,26 +651,10 @@ * returned * @return The method signature for the specified selector */ - (nullable OFMethodSignature *)methodSignatureForSelector: (SEL)selector; -/*! - * @brief Returns the name of the object's class. - * - * @return The name of the object's class - */ -- (OFString *)className; - -/*! - * @brief Returns a description for the object. - * - * This is mostly for debugging purposes. - * - * @return A description for the object - */ -- (OFString *)description; - /*! * @brief Allocates memory and stores it in the object's memory pool. * * It will be freed automatically when the object is deallocated. * Index: src/OFOptionsParser.h ================================================================== --- src/OFOptionsParser.h +++ src/OFOptionsParser.h @@ -107,10 +107,16 @@ * The argument for the last parsed option, or `nil` if the last parsed option * takes no argument. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *argument; +/*! + * The arguments following the last option. + */ +@property (readonly, nonatomic) + OFArray OF_GENERIC(OFString *) *remainingArguments; + /*! * @brief Creates a new OFOptionsParser which accepts the specified options. * * @param options An array of @ref of_options_parser_option_t specifying all * accepted options, terminated with an option whose short @@ -152,15 +158,8 @@ * optional pointers specified and don't do any parsing yourself. * * @return The next option */ - (of_unichar_t)nextOption; - -/*! - * @brief Returns the arguments following the last option. - * - * @return The arguments following the last option - */ -- (OFArray OF_GENERIC(OFString *) *)remainingArguments; @end OF_ASSUME_NONNULL_END Index: src/OFSerialization.h ================================================================== --- src/OFSerialization.h +++ src/OFSerialization.h @@ -26,22 +26,20 @@ * @protocol OFSerialization OFSerialization.h ObjFW/OFSerialization.h * * @brief A protocol for serializing objects. */ @protocol OFSerialization +/*! + * The object serialized into an XML element. + */ +@property (readonly, nonatomic) OFXMLElement *XMLElementBySerializing; + /*! * @brief Initializes the object with the specified XML element serialization. * * @param element An OFXMLElement with the serialized object * @return An initialized object */ - (instancetype)initWithSerialization: (OFXMLElement *)element; - -/*! - * @brief Serializes the object into an XML element. - * - * @return The object serialized into an XML element - */ -- (OFXMLElement *)XMLElementBySerializing; @end OF_ASSUME_NONNULL_END Index: src/OFSet.h ================================================================== --- src/OFSet.h +++ src/OFSet.h @@ -63,10 +63,20 @@ @interface OFSet OF_GENERIC(ObjectType): OFObject #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif +/*! + * An array of all objects in the set. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *allObjects; + +/*! + * @return An arbitrary object in the set. + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType anyObject; + /*! * @brief Creates a new set. * * @return A new, autoreleased set */ @@ -192,24 +202,10 @@ * @param set The set to create the union with */ - (OFSet OF_GENERIC(ObjectType) *)setByAddingSet: (OFSet OF_GENERIC(ObjectType) *)set; -/*! - * @brief Returns an array of all objects in the set. - * - * @return An array of all objects in the set - */ -- (OFArray OF_GENERIC(ObjectType) *)allObjects; - -/*! - * @brief Returns an arbitrary object in the set. - * - * @return An arbitrary object in the set - */ -- (nullable ObjectType)anyObject; - /*! * @brief Checks whether the set contains an object equal to the specified * object. * * @param object The object which is checked for being in the set @@ -246,17 +242,10 @@ * @param key The key of the value to set */ - (void)setValue: (id)value forKey: (OFString *)key; -/*! - * @brief Returns an OFEnumerator to enumerate through all objects of the set. - * - * @returns An OFEnumerator to enumerate through all objects of the set - */ -- (OFEnumerator OF_GENERIC(ObjectType) *)objectEnumerator; - #ifdef OF_HAVE_BLOCKS /*! * @brief Executes a block for each object in the set. * * @param block The block to execute for each object in the set Index: src/OFStdIOStream.h ================================================================== --- src/OFStdIOStream.h +++ src/OFStdIOStream.h @@ -44,27 +44,23 @@ bool _closable; #endif bool _atEndOfStream; } -- (instancetype)init OF_UNAVAILABLE; - -/*! - * @brief Query the underlying terminal for the number of columns. - * - * @return The number of columns, or -1 if there is no underlying terminal or - * the number of columns could not be queried - */ -- (int)columns; - -/*! - * @brief Query the underlying terminal for the number of rows. - * - * @return The number of rows, or -1 if there is no underlying terminal or the - * number of rows could not be queried - */ -- (int)rows; +/*! + * The number of columns, or -1 if there is no underlying terminal or the + * number of columns could not be queried. + */ +@property (readonly, nonatomic) int columns; + +/*! + * The number of rows, or -1 if there is no underlying terminal or the number + * of rows could not be queried + */ +@property (readonly, nonatomic) int rows; + +- (instancetype)init OF_UNAVAILABLE; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -120,15 +120,41 @@ @protected bool _blocking; } /*! - * @brief Returns a boolean whether the end of the stream has been reached. + * Whether the end of the stream has been reached. + */ +@property (readonly, nonatomic, getter=isAtEndOfStream) bool atEndOfStream; + +/*! + * Whether writes are buffered. + */ +@property (nonatomic, nonatomic, getter=isWriteBuffered) bool writeBuffered; + +/*! + * Whether data is present in the internal read buffer. + */ +@property (readonly, nonatomic) bool hasDataInReadBuffer; + +/*! + * Whether the stream is in blocking mode. * - * @return A boolean whether the end of the stream has been reached + * By default, a stream is in blocking mode. + * On Win32, setting this currently only works for sockets! */ -- (bool)isAtEndOfStream; +@property (readonly, nonatomic, getter=isBlocking) bool blocking; + +/*! + * The file descriptor for the read end of the stream. + */ +@property (readonly, nonatomic) int fileDescriptorForReading; + +/*! + * The file descriptor for the write end of the stream. + */ +@property (readonly, nonatomic) int fileDescriptorForWriting; /*! * @brief Reads *at most* size bytes from the stream into a buffer. * * On network streams, this might read less than the specified number of bytes. @@ -775,24 +801,10 @@ * stream has been reached. */ - (nullable OFString *)tryReadTillDelimiter: (OFString *)delimiter encoding: (of_string_encoding_t)encoding; -/*! - * @brief Returns a boolean whether writes are buffered. - * - * @return A boolean whether writes are buffered - */ -- (bool)isWriteBuffered; - -/*! - * @brief Enables or disables the write buffer. - * - * @param enable Whether the write buffer should be enabled or disabled - */ -- (void)setWriteBuffered: (bool)enable; - /*! * @brief Writes everything in the write buffer to the stream. */ - (void)flushWriteBuffer; @@ -1123,48 +1135,10 @@ * @return The number of bytes written */ - (size_t)writeFormat: (OFConstantString *)format arguments: (va_list)arguments; -/*! - * @brief Returns whether data is present in the internal read buffer. - * - * @return Whether data is present in the internal read buffer - */ -- (bool)hasDataInReadBuffer; - -/*! - * @brief Returns whether the stream is in blocking mode. - * - * @return Whether the stream is in blocking mode - */ -- (bool)isBlocking; - -/*! - * @brief Enables or disables non-blocking I/O. - * - * By default, a stream is in blocking mode. - * On Win32, this currently only works for sockets! - * - * @param enable Whether the stream should be blocking - */ -- (void)setBlocking: (bool)enable; - -/*! - * @brief Returns the file descriptor for the read end of the stream. - * - * @return The file descriptor for the read end of the stream - */ -- (int)fileDescriptorForReading; - -/*! - * @brief Returns the file descriptor for the write end of the stream. - * - * @return The file descriptor for the write end of the stream - */ -- (int)fileDescriptorForWriting; - #ifdef OF_HAVE_SOCKETS /*! * @brief Cancels all pending asynchronous requests on the stream. */ - (void)cancelAsyncRequests; Index: src/OFString+CryptoHashing.h ================================================================== --- src/OFString+CryptoHashing.h +++ src/OFString+CryptoHashing.h @@ -26,55 +26,41 @@ } #endif @interface OFString (CryptoHashing) /*! - * @brief Returns the MD5 hash of the string as an autoreleased OFString. - * - * @return The MD5 hash of the string as an autoreleased OFString - */ -- (OFString *)MD5Hash; - -/*! - * @brief Returns the RIPEMD-160 hash of the string as an autoreleased OFString. - * - * @return The RIPEMD-160 hash of the string as an autoreleased OFString - */ -- (OFString *)RIPEMD160Hash; - -/*! - * @brief Returns the SHA-1 hash of the string as an autoreleased OFString. - * - * @return The SHA-1 hash of the string as an autoreleased OFString - */ -- (OFString *)SHA1Hash; - -/*! - * @brief Returns the SHA-224 hash of the string as an autoreleased OFString. - * - * @return The SHA-224 hash of the string as an autoreleased OFString - */ -- (OFString *)SHA224Hash; - -/*! - * @brief Returns the SHA-256 hash of the string as an autoreleased OFString. - * - * @return The SHA-256 hash of the string as an autoreleased OFString - */ -- (OFString *)SHA256Hash; - -/*! - * @brief Returns the SHA-384 hash of the string as an autoreleased OFString. - * - * @return The SHA-384 hash of the string as an autoreleased OFString - */ -- (OFString *)SHA384Hash; - -/*! - * @brief Returns the SHA-512 hash of the string as an autoreleased OFString. - * - * @return The SHA-512 hash of the string as an autoreleased OFString - */ -- (OFString *)SHA512Hash; + * The MD5 hash of the string as a string. + */ +@property (readonly, nonatomic) OFString *MD5Hash; + +/*! + * The RIPEMD-160 hash of the string as a string. + */ +@property (readonly, nonatomic) OFString *RIPEMD160Hash; + +/*! + * The SHA-1 hash of the string as a string. + */ +@property (readonly, nonatomic) OFString *SHA1Hash; + +/*! + * The SHA-224 hash of the string as a string. + */ +@property (readonly, nonatomic) OFString *SHA224Hash; + +/*! + * The SHA-256 hash of the string as a string. + */ +@property (readonly, nonatomic) OFString *SHA256Hash; + +/*! + * The SHA-384 hash of the string as a string. + */ +@property (readonly, nonatomic) OFString *SHA384Hash; + +/*! + * The SHA-512 hash of the string as a string. + */ +@property (readonly, nonatomic) OFString *SHA512Hash; @end OF_ASSUME_NONNULL_END Index: src/OFString+JSONValue.h ================================================================== --- src/OFString+JSONValue.h +++ src/OFString+JSONValue.h @@ -26,11 +26,11 @@ } #endif @interface OFString (JSONValue) /*! - * @brief Creates an object from the JSON value of the string. + * The string interpreted as JSON and parsed as an object. * * @note This also allows parsing JSON5, an extension of JSON. See * http://json5.org/ for more details. * * @warning Although not specified by the JSON specification, this can also @@ -39,14 +39,12 @@ * single primitive, leading to real world JSON files sometimes only * consisting of a single primitive. Therefore, you should not make any * assumptions about the object returned by this method if you don't * want your program to terminate due to a message not understood, but * instead check the returned object using @ref isKindOfClass:. - * - * @return An object */ -- (id)JSONValue; +@property (readonly, nonatomic) id JSONValue; /*! * @brief Creates an object from the JSON value of the string. * * @note This also allows parsing JSON5, an extension of JSON. See Index: src/OFString+Serialization.h ================================================================== --- src/OFString+Serialization.h +++ src/OFString+Serialization.h @@ -26,13 +26,11 @@ } #endif @interface OFString (Serialization) /*! - * @brief Deserializes the receiver into an object. - * - * @return The deserialized object + * The string interpreted as serialization and parsed as an object. */ -- (id)objectByDeserializing; +@property (readonly, nonatomic) id objectByDeserializing; @end OF_ASSUME_NONNULL_END Index: src/OFString+URLEncoding.h ================================================================== --- src/OFString+URLEncoding.h +++ src/OFString+URLEncoding.h @@ -26,15 +26,18 @@ } #endif @interface OFString (URLEncoding) /*! - * @brief Encodes a string for use in a URL. - * - * @return A new autoreleased string + * The string as an URL encoded string for use in a URL. + */ +@property (readonly, nonatomic) OFString *stringByURLEncoding; + +/*! + * The string as an URL decoded string. */ -- (OFString *)stringByURLEncoding; +@property (readonly, nonatomic) OFString *stringByURLDecoding; /*! * @brief Encodes a string for use in a URL, but does not escape the specified * ignored characters. * @@ -41,15 +44,8 @@ * @param allowed A C string of characters that should not be escaped * * @return A new autoreleased string */ - (OFString *)stringByURLEncodingWithAllowedCharacters: (const char *)allowed; - -/*! - * @brief Decodes a string used in a URL. - * - * @return A new autoreleased string - */ -- (OFString *)stringByURLDecoding; @end OF_ASSUME_NONNULL_END Index: src/OFString+XMLEscaping.h ================================================================== --- src/OFString+XMLEscaping.h +++ src/OFString+XMLEscaping.h @@ -26,13 +26,11 @@ } #endif @interface OFString (XMLEscaping) /*! - * @brief Escapes a string for use in an XML document. - * - * @return A new autoreleased string + * The string in a form escaped for use in an XML document. */ -- (OFString *)stringByXMLEscaping; +@property (readonly, nonatomic) OFString *stringByXMLEscaping; @end OF_ASSUME_NONNULL_END Index: src/OFString+XMLUnescaping.h ================================================================== --- src/OFString+XMLUnescaping.h +++ src/OFString+XMLUnescaping.h @@ -64,13 +64,13 @@ containsUnknownEntityNamed: (OFString *)entity; @end @interface OFString (XMLUnescaping) /*! - * @brief Unescapes XML in the string. + * The string with XML entities unescapted. */ -- (OFString *)stringByXMLUnescaping; +@property (readonly, nonatomic) OFString *stringByXMLUnescaping; /*! * @brief Unescapes XML in the string and uses the specified delegate for * unknown entities. * Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -111,10 +111,205 @@ * * @brief A class for handling strings. */ @interface OFString: OFObject + +/*! + * The length of the string in Unicode codepoints. + */ +@property (readonly, nonatomic) size_t length; + +/*! + * The OFString as a UTF-8 encoded C string. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + */ +@property (readonly, nonatomic) const char *UTF8String OF_RETURNS_INNER_POINTER; + +/*! + * The number of bytes the string needs in UTF-8 encoding. + */ +@property (readonly, nonatomic) size_t UTF8StringLength; + +/*! + * The components of the string when interpreted as a path. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(OFString *) *pathComponents; + +/*! + * The last path component of the string when interpreted as a path. + */ +@property (readonly, nonatomic) OFString *lastPathComponent; + +/*! + * The file extension of string when interpreted as a path. + */ +@property (readonly, nonatomic) OFString *pathExtension; + +/*! + * The string in uppercase. + */ +@property (readonly, nonatomic) OFString *uppercaseString; + +/*! + * The string in lowercase. + */ +@property (readonly, nonatomic) OFString *lowercaseString; + +/*! + * The string in capitalized form. + * + * @note This only considers spaces, tabs and newlines to be word delimiters! + * Also note that this might change in the future to all word delimiters + * specified by Unicode! + */ +@property (readonly, nonatomic) OFString *capitalizedString; + +/*! + * The decimal value of the string as an `intmax_t`. + * + * Leading and trailing whitespaces are ignored. + * + * If the string contains any non-number characters, an + * @ref OFInvalidEncodingException is thrown. + * + * If the number is too big to fit into an `intmax_t`, an + * @ref OFOutOfRangeException is thrown. + */ +@property (readonly, nonatomic) intmax_t decimalValue; + +/*! + * The hexadecimal value of the string as an `uintmax_t`. + * + * Leading and trailing whitespaces are ignored. + * + * If the string contains any non-number characters, an + * @ref OFInvalidEncodingException is thrown. + * + * If the number is too big to fit into an `uintmax_t`, an + * @ref OFOutOfRangeException is thrown. + */ +@property (readonly, nonatomic) uintmax_t hexadecimalValue; + +/*! + * The octal value of the string as an `uintmax_t`. + * + * Leading and trailing whitespaces are ignored. + * + * If the string contains any non-number characters, an + * @ref OFInvalidEncodingException is thrown. + * + * If the number is too big to fit into an `uintmax_t`, an + * @ref OFOutOfRangeException is thrown. + */ +@property (readonly, nonatomic) uintmax_t octalValue; + +/*! + * The float value of the string as a float. + * + * If the string contains any non-number characters, an + * @ref OFInvalidEncodingException is thrown. + */ +@property (readonly, nonatomic) float floatValue; + +/*! + * The double value of the string as a double. + * + * If the string contains any non-number characters, an + * OFInvalidEncodingException is thrown. + */ +@property (readonly, nonatomic) double doubleValue; + +/*! + * The directory name of the string when interpreted as a path. + */ +@property (readonly, nonatomic) OFString *stringByDeletingLastPathComponent; + +/*! + * The string with the file extension of the path removed. + */ +@property (readonly, nonatomic) OFString *stringByDeletingPathExtension; + +/*! + * The string interpreted as a path with relative sub paths resolved. + */ +@property (readonly, nonatomic) OFString *stringByStandardizingPath; + +/*! + * The string interpreted as a URL path with relative sub paths resolved. + * + * This works similar to @ref stringByStandardizingPath, but is intended for + * standardization of paths that are part of a URL. + */ +@property (readonly, nonatomic) OFString *stringByStandardizingURLPath; + +/*! + * The string as an array of Unicode characters. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + */ +@property (readonly, nonatomic) const of_unichar_t *characters + OF_RETURNS_INNER_POINTER; + +/*! + * The string in UTF-16 encoding with native byte order. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + */ +@property (readonly, nonatomic) const char16_t *UTF16String + OF_RETURNS_INNER_POINTER; + +/*! + * The length of the string in UTF-16 characters. + */ +@property (readonly, nonatomic) size_t UTF16StringLength; + +/*! + * The string in UTF-32 encoding with native byte order. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + */ +@property (readonly, nonatomic) const char32_t *UTF32String + OF_RETURNS_INNER_POINTER; + +/*! + * The string with leading whitespaces deleted. + */ +@property (readonly, nonatomic) OFString *stringByDeletingLeadingWhitespaces; + +/*! + * The string with trailing whitespaces deleted. + */ +@property (readonly, nonatomic) OFString *stringByDeletingTrailingWhitespaces; + +/*! + * The string with leading and trailing whitespaces deleted. + */ +@property (readonly, nonatomic) OFString *stringByDeletingEnclosingWhitespaces; + +#ifdef OF_HAVE_UNICODE_TABLES +/*! + * The string in Unicode Normalization Form D (NFD). + */ +@property (readonly, nonatomic) OFString *decomposedStringWithCanonicalMapping; + +/*! + * The string in Unicode Normalization Form KD (NFKD). + */ +@property (readonly, nonatomic) + OFString *decomposedStringWithCompatibilityMapping; +#endif + /*! * @brief Creates a new OFString. * * @return A new, autoreleased OFString */ @@ -669,44 +864,19 @@ * @return The OFString as a C string in the specified encoding */ - (const char *)lossyCStringWithEncoding: (of_string_encoding_t)encoding OF_RETURNS_INNER_POINTER; -/*! - * @brief Returns the OFString as a UTF-8 encoded C string. - * - * The result is valid until the autorelease pool is released. If you want to - * use the result outside the scope of the current autorelease pool, you have to - * copy it. - * - * @return The OFString as a UTF-8 encoded C string - */ -- (const char *)UTF8String OF_RETURNS_INNER_POINTER; - -/*! - * @brief Returns the length of the string in Unicode codepoints. - * - * @return The length of the string in Unicode codepoints - */ -- (size_t)length; - /*! * @brief Returns the number of bytes the string needs in the specified * encoding. * * @param encoding The encoding for the string * @return The number of bytes the string needs in the specified encoding. */ - (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding; -/*! - * @brief Returns the number of bytes the string needs in UTF-8 encoding. - * - * @return The number of bytes the string needs in UTF-8 encoding. - */ -- (size_t)UTF8StringLength; - /*! * @brief Compares the OFString to another OFString without caring about the * case. * * @param otherString A string to compare with @@ -857,57 +1027,10 @@ - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options range: (of_range_t)range; -/*! - * @brief Returns the string in uppercase. - * - * @return The string in uppercase - */ -- (OFString *)uppercaseString; - -/*! - * @brief Returns the string in lowercase. - * - * @return The string in lowercase - */ -- (OFString *)lowercaseString; - -/*! - * @brief Returns the string capitalized. - * - * @note This only considers spaces, tabs and newlines to be word delimiters! - * Also note that this might change in the future to all word delimiters - * specified by Unicode! - * - * @return The capitalized string - */ -- (OFString *)capitalizedString; - -/*! - * @brief Creates a new string by deleting leading whitespaces. - * - * @return A new autoreleased OFString with leading whitespaces deleted - */ -- (OFString *)stringByDeletingLeadingWhitespaces; - -/*! - * @brief Creates a new string by deleting trailing whitespaces. - * - * @return A new autoreleased OFString with trailing whitespaces deleted - */ -- (OFString *)stringByDeletingTrailingWhitespaces; - -/*! - * @brief Creates a new string by deleting leading and trailing whitespaces. - * - * @return A new autoreleased OFString with leading and trailing whitespaces - * deleted - */ -- (OFString *)stringByDeletingEnclosingWhitespaces; - /*! * @brief Checks whether the string has the specified prefix. * * @param prefix The prefix to check for * @return A boolean whether the string has the specified prefix @@ -944,149 +1067,10 @@ */ - (OFArray OF_GENERIC(OFString *) *) componentsSeparatedByString: (OFString *)delimiter options: (int)options; -/*! - * @brief Returns the components of the path. - * - * @return The components of the path - */ -- (OFArray OF_GENERIC(OFString *) *)pathComponents; - -/*! - * @brief Returns the last component of the path. - * - * @return The last component of the path - */ -- (OFString *)lastPathComponent; - -/*! - * @brief Returns the file extension of the path. - * - * @return The file extension of the path - */ -- (OFString *)pathExtension; - -/*! - * @brief Returns the directory name of the path. - * - * @return The directory name of the path - */ -- (OFString *)stringByDeletingLastPathComponent; - -/*! - * @brief Returns a new string with the file extension of the path removed. - * - * @return A new string with the file extension of the path removed - */ -- (OFString *)stringByDeletingPathExtension; - -/*! - * @brief Returns the path with relative sub paths resolved. - * - * @return The path with relative sub paths resolved - */ -- (OFString *)stringByStandardizingPath; - -/*! - * @brief Returns the URL path with relative sub paths resolved. - * - * This works similar to @ref stringByStandardizingPath, but is intended for - * standardization of paths that are part of a URL. - * - * @return The URL path with relative sub paths resolved - */ -- (OFString *)stringByStandardizingURLPath; - -/*! - * @brief Returns the decimal value of the string as an `intmax_t`. - * - * Leading and trailing whitespaces are ignored. - * - * If the string contains any non-number characters, an - * @ref OFInvalidEncodingException is thrown. - * - * If the number is too big to fit into an `intmax_t`, an - * @ref OFOutOfRangeException is thrown. - * - * @return An `intmax_t` with the value of the string - */ -- (intmax_t)decimalValue; - -/*! - * @brief Returns the hexadecimal value of the string as an `uintmax_t`. - * - * Leading and trailing whitespaces are ignored. - * - * If the string contains any non-number characters, an - * @ref OFInvalidEncodingException is thrown. - * - * If the number is too big to fit into an `uintmax_t`, an - * @ref OFOutOfRangeException is thrown. - * - * @return A `uintmax_t` with the value of the string - */ -- (uintmax_t)hexadecimalValue; - -/*! - * @brief Returns the octal value of the string as an `uintmax_t`. - * - * Leading and trailing whitespaces are ignored. - * - * If the string contains any non-number characters, an - * @ref OFInvalidEncodingException is thrown. - * - * If the number is too big to fit into an `uintmax_t`, an - * @ref OFOutOfRangeException is thrown. - * - * @return A `uintmax_t` with the value of the string - */ -- (uintmax_t)octalValue; - -/*! - * @brief Returns the float value of the string as a float. - * - * If the string contains any non-number characters, an - * OFInvalidEncodingException is thrown. - * - * @return A float with the value of the string - */ -- (float)floatValue; - -/*! - * @brief Returns the double value of the string as a double. - * - * If the string contains any non-number characters, an - * OFInvalidEncodingException is thrown. - * - * @return A double with the value of the string - */ -- (double)doubleValue; - -/*! - * @brief Returns the string as an array of Unicode characters. - * - * The result is valid until the autorelease pool is released. If you want to - * use the result outside the scope of the current autorelease pool, you have to - * copy it. - * - * @return The string as an array of Unicode characters - */ -- (const of_unichar_t *)characters OF_RETURNS_INNER_POINTER; - -/*! - * @brief Returns the string in UTF-16 encoding with native byte order. - * - * The result is valid until the autorelease pool is released. If you want to - * use the result outside the scope of the current autorelease pool, you have to - * copy it. - * - * @return The string in UTF-16 encoding with native byte order - */ -- (const char16_t *)UTF16String OF_RETURNS_INNER_POINTER; - /*! * @brief Returns the string in UTF-16 encoding with the specified byte order. * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to @@ -1096,28 +1080,10 @@ * @return The string in UTF-16 encoding with the specified byte order */ - (const char16_t *)UTF16StringWithByteOrder: (of_byte_order_t)byteOrder OF_RETURNS_INNER_POINTER; -/*! - * @brief Returns the length of the string in UTF-16 characters. - * - * @return The length of string in UTF-16 characters - */ -- (size_t)UTF16StringLength; - -/*! - * @brief Returns the string in UTF-32 encoding with native byte order. - * - * The result is valid until the autorelease pool is released. If you want to - * use the result outside the scope of the current autorelease pool, you have to - * copy it. - * - * @return The string in UTF-32 encoding with native byte order - */ -- (const char32_t *)UTF32String OF_RETURNS_INNER_POINTER; - /*! * @brief Returns the string in UTF-32 encoding with the specified byte order. * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to @@ -1135,26 +1101,10 @@ * @param encoding The encoding to use for the returned OFData * @return The string as OFData with the specified encoding */ - (OFData *)dataWithEncoding: (of_string_encoding_t)encoding; -#ifdef OF_HAVE_UNICODE_TABLES -/*! - * @brief Returns the string in Unicode Normalization Form D (NFD). - * - * @return The string in Unicode Normalization Form D (NFD) - */ -- (OFString *)decomposedStringWithCanonicalMapping; - -/*! - * @brief Returns the string in Unicode Normalization Form KD (NFKD). - * - * @return The string in Unicode Normalization Form KD (NFKD) - */ -- (OFString *)decomposedStringWithCompatibilityMapping; -#endif - #ifdef OF_HAVE_FILES /*! * @brief Writes the string into the specified file using UTF-8 encoding. * * @param path The path of the file to write to Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -68,10 +68,40 @@ #ifdef OF_WII uint16_t _port; #endif } +/*! + * Whether the socket is a listening socket. + */ +@property (readonly, nonatomic, getter=isListening) bool listening; + +/*! + * The remote address as a string + * + * @note This only works for accepted sockets! + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *remoteAddress; + +#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) +/*! + * Whether keep alives are enabled for the connection. + * + * @warning This is not available on the Wii or Nintendo 3DS! + */ +@property (nonatomic, getter=isKeepAliveEnabled) bool keepAliveEnabled; +#endif + +#ifndef OF_WII +/*! + * Whether TCP_NODELAY is enabled for the connection + * + * @warning This is not available on the Wii! + */ +@property (nonatomic, getter=isTCPNoDelayEnabled) bool TCPNoDelayEnabled; +#endif + /*! * The host to use as a SOCKS5 proxy. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *SOCKS5Host; @@ -205,66 +235,10 @@ * Returns whether the next incoming connection should be accepted * by the specified block as well. */ - (void)asyncAcceptWithBlock: (of_tcp_socket_async_accept_block_t)block; #endif - -/*! - * @brief Returns the remote address of the socket. - * - * Only works with accepted sockets! - * - * @return The remote address as a string - */ -- (nullable OFString *)remoteAddress; - -/*! - * @brief Returns whether the socket is a listening socket. - * - * @return Whether the socket is a listening socket - */ -- (bool)isListening; - -#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) -/*! - * @brief Enable or disable keep alive for the connection. - * - * @warning This is not available on the Wii or Nintendo 3DS! - * - * @param enabled Whether to enable or disable keep alives for the connection - */ -- (void)setKeepAliveEnabled: (bool)enabled; - -/*! - * @brief Returns whether keep alive is enabled for the connection. - * - * @warning This is not available on the Wii or Nintendo 3DS! - * - * @return Whether keep alives are enabled for the connection - */ -- (bool)isKeepAliveEnabled; -#endif - -#ifndef OF_WII -/*! - * @brief Enable or disable TCP_NODELAY for the connection. - * - * @warning This is not available on the Wii! - * - * @param enabled Whether to enable or disable TCP_NODELAY for the connection - */ -- (void)setTCPNoDelayEnabled: (bool)enabled; - -/*! - * @brief Returns whether TCP_NODELAY is enabled for the connection. - * - * @warning This is not available on the Wii! - * - * @return Whether TCP_NODELAY is enabled for the connection - */ -- (bool)isTCPNoDelayEnabled; -#endif @end #ifdef __cplusplus extern "C" { #endif Index: src/OFTarArchive.h ================================================================== --- src/OFTarArchive.h +++ src/OFTarArchive.h @@ -36,10 +36,17 @@ OF_TAR_ARCHIVE_MODE_APPEND } _mode; OF_KINDOF(OFStream *) _Nullable _lastReturnedStream; } +/*! + * @return A stream for reading the current entry + * + * @note This is only available in read mode. + */ +@property (readonly, nonatomic) OFStream *streamForReadingCurrentEntry; + /*! * @brief Creates a new OFTarArchive object with the specified stream. * * @param stream A stream from which the tar archive will be read. * For append mode, this needs to be an OFSeekableStream. @@ -109,19 +116,10 @@ * @return The next entry from the tar archive or `nil` if all entries have * been read */ - (nullable OFTarArchiveEntry *)nextEntry; -/*! - * @brief Returns a stream for reading the current entry. - * - * @note This is only available in read mode. - * - * @return A stream for reading the current entry - */ -- (OFStream *)streamForReadingCurrentEntry; - /*! * @brief Returns a stream for writing the specified entry. * * @note This is only available in write and append mode. * Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -93,10 +93,33 @@ */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) of_thread_block_t threadBlock; # endif +/*! + * The run loop for the thread. + */ +@property (readonly, nonatomic) OFRunLoop *runLoop; + +/*! + * The priority of the thread. + * + * @note This has to be set before the thread is started! + * + * This is a value between -1.0 (meaning lowest priority that still schedules) + * and +1.0 (meaning highest priority that still allows getting preempted) + * with normal priority being 0.0 (meaning being the same as the main thread). + */ +@property (nonatomic) float priority; + +/*! + * The stack size of the thread. + * + * @note This has to be set before the thread is started! + */ +@property (nonatomic) size_t stackSize; + /*! * @brief Creates a new thread. * * @return A new, autoreleased thread */ @@ -220,58 +243,11 @@ * @brief Joins a thread. * * @return The object returned by the main method of the thread. */ - (id)join; - -/*! - * @brief Returns the run loop for the thread. - * - * @return The run loop for the thread - */ -- (OFRunLoop *)runLoop; - -/*! - * @brief Returns the priority of the thread. - * - * This is a value between -1.0 (meaning lowest priority that still schedules) - * and +1.0 (meaning highest priority that still allows getting preempted) - * with normal priority being 0.0 (meaning being the same as the main thread). - * - * @return The priority of the thread - */ -- (float)priority; - -/*! - * @brief Sets the priority of the thread. - * - * @note This has to be set before the thread is started! - * - * @param priority The priority of the thread. This is a value between -1.0 - * (meaning lowest priority that still schedules) and +1.0 - * (meaning highest priority that still allows getting - * preempted) with normal priority being 0.0 (meaning being - * the same as the main thread). - */ -- (void)setPriority: (float)priority; - -/*! - * @brief Returns the stack size of the thread. - * - * @return The stack size of the thread - */ -- (size_t)stackSize; - -/*! - * @brief Sets the stack size of the thread. - * - * @note This has to be set before the thread is started! - * - * @param stackSize The stack size for the thread - */ -- (void)setStackSize: (size_t)stackSize; #else - (instancetype)init OF_UNAVAILABLE; #endif @end OF_ASSUME_NONNULL_END Index: src/OFThreadPool.h ================================================================== --- src/OFThreadPool.h +++ src/OFThreadPool.h @@ -50,10 +50,15 @@ OFCondition *_queueCondition; volatile int _doneCount; OFCondition *_countCondition; } +/*! + * The size of the thread pool. + */ +@property (readonly, nonatomic) size_t size; + /*! * @brief Returns a new thread pool with one thread for each core in the system. * * @warning If for some reason the number of cores in the system could not be * determined, the pool will only have one thread! @@ -102,15 +107,8 @@ /*! * @brief Waits until all jobs are done. */ - (void)waitUntilDone; - -/*! - * @brief Returns the size of the thread pool. - * - * @return The size of the thread pool - */ -- (size_t)size; @end OF_ASSUME_NONNULL_END Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -75,10 +75,20 @@ /*! * Whether the timer is valid. */ @property (readonly, nonatomic, getter=isValid) bool valid; +/*! + * The next date at which the timer will fire. + * + * If the timer is already scheduled in a run loop, it will be rescheduled. + * Note that rescheduling is an expensive operation, though it still might be + * preferable to reschedule instead of invalidating the timer and creating a + * new one. + */ +@property (copy, nonatomic) OFDate *fireDate; + /*! * @brief Creates and schedules a new timer with the specified time interval. * * @param timeInterval The time interval after which the timer should be fired * @param target The target on which to call the selector @@ -446,29 +456,10 @@ * @brief Fires the timer, meaning it will execute the specified selector on the * target. */ - (void)fire; -/*! - * @brief Returns the next date at which the timer will fire. - * - * @return The next date at which the timer will fire - */ -- (OFDate *)fireDate; - -/*! - * @brief Sets the next date at which the timer will fire. - * - * If the timer is already scheduled in a run loop, it will be rescheduled. - * Note that rescheduling is an expensive operation, though it still might be - * preferable to reschedule instead of invalidating the timer and creating a - * new one. - * - * @param fireDate The next date at which the timer will fire - */ -- (void)setFireDate: (OFDate *)fireDate; - /*! * @brief Invalidates the timer, preventing it from firing. */ - (void)invalidate; Index: src/OFURL.h ================================================================== --- src/OFURL.h +++ src/OFURL.h @@ -96,10 +96,25 @@ /*! * The fragment part of the URL. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *fragment; +/*! + * The URL as a string. + */ +@property (readonly, nonatomic) OFString *string; + +/*! + * The local file system representation for a file URL. + * + * @note This only exists for URLs with the file scheme and throws an exception + * otherwise. + * + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) + OFString *fileSystemRepresentation; + /*! * @brief Creates a new URL with the specified string. * * @param string A string describing a URL * @return A new, autoreleased OFURL @@ -185,27 +200,10 @@ * @return An Initialized OFURL */ + (instancetype)fileURLWithPath: (OFString *)path isDirectory: (bool)isDirectory; #endif - -/*! - * @brief Returns the URL as a string. - * - * @return The URL as a string - */ -- (OFString *)string; - -/*! - * @brief Returns the local file system representation for a file URL. - * - * This only exists for URLs with the file scheme and throws an exception - * otherwise. - * - * @return The local file system representation for a file URL - */ -- (nullable OFString *)fileSystemRepresentation; @end OF_ASSUME_NONNULL_END #import "OFMutableURL.h" Index: src/OFXMLElement+Serialization.h ================================================================== --- src/OFXMLElement+Serialization.h +++ src/OFXMLElement+Serialization.h @@ -26,13 +26,11 @@ } #endif @interface OFXMLElement (OFSerialization) /*! - * @brief Deserializes the receiver into an object. - * - * @return The deserialized object + * The XML element interpreted as serialization and parsed into an object. */ -- (id)objectByDeserializing; +@property (readonly, nonatomic) id objectByDeserializing; @end OF_ASSUME_NONNULL_END Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -57,10 +57,27 @@ /*! * The default namespace for the element to be used if there is no parent. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *defaultNamespace; +/*! + * An array with the attributes of the element + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) + OFArray OF_GENERIC(OFXMLAttribute *) *attributes; + +/*! + * An array of OFXMLNodes with all children of the element. + */ +@property OF_NULLABLE_PROPERTY (nonatomic, copy) + OFArray OF_GENERIC(OFXMLNode *) *children; + +/*! + * All children that are elements. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(OFXMLElement *) *elements; + /*! * @brief Creates a new XML element with the specified name. * * @param name The name for the element * @return A new autoreleased OFXMLElement with the specified element name @@ -227,17 +244,10 @@ * @param namespace_ The namespace for which the prefix is bound */ - (void)bindPrefix: (OFString *)prefix forNamespace: (OFString *)namespace_; -/*! - * @brief Returns an OFArray with the attributes of the element. - * - * @return An OFArray with the attributes of the element - */ -- (nullable OFArray OF_GENERIC(OFXMLAttribute *) *)attributes; - /*! * @brief Adds the specified attribute. * * If an attribute with the same name and namespace already exists, it is not * added. @@ -305,24 +315,10 @@ * @param attributeNS The namespace of the attribute */ - (void)removeAttributeForName: (OFString *)attributeName namespace: (nullable OFString *)attributeNS; -/*! - * @brief Removes all children and adds the children from the specified array. - * - * @param children The new children to add - */ -- (void)setChildren: (nullable OFArray OF_GENERIC(OFXMLNode *) *)children; - -/*! - * @brief Returns an array of OFXMLNodes with all children of the element. - * - * @return An array of OFXMLNodes with all children of the element - */ -- (nullable OFArray OF_GENERIC(OFXMLNode *) *)children; - /*! * @brief Adds a child to the OFXMLElement. * * @param child An OFXMLNode which is added as a child */ @@ -377,17 +373,10 @@ * @param node The node to replace the child with */ - (void)replaceChildAtIndex: (size_t)index withNode: (OFXMLNode *)node; -/*! - * @brief Returns all children that are elements. - * - * @return All children that are elements - */ -- (OFArray OF_GENERIC(OFXMLElement *) *)elements; - /*! * @brief Returns all children that have the specified namespace. * * @return All children that have the specified namespace */ Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -379,11 +379,11 @@ } - (void)setChildren: (OFArray *)children { OFArray *old = _children; - _children = [children copy]; + _children = [children mutableCopy]; [old release]; } - (OFArray *)children { Index: src/OFXMLNode.h ================================================================== --- src/OFXMLNode.h +++ src/OFXMLNode.h @@ -25,64 +25,45 @@ * @class OFXMLNode OFXMLNode.h ObjFW/OFXMLNode.h * * @brief A class which stores an XML element. */ @interface OFXMLNode: OFObject -- (instancetype)init OF_UNAVAILABLE; -- (instancetype)initWithSerialization: (OFXMLElement *)element OF_UNAVAILABLE; - -/*! - * @brief Returns the contents of the receiver as a string value. - * - * @return A string with the string value - */ -- (OFString *)stringValue; - -/*! - * @brief Sets the string value of the receiver to the specified string. - * - * For an @ref OFXMLElement, it removes all children and creates a single child - * with the specified string value. - * - * @param stringValue The new string value for the node - */ -- (void)setStringValue: (OFString *)stringValue; - -/*! - * @brief Returns the contents of the receiver as a decimal value. - * - * @return An integer with the decimal value - */ -- (intmax_t)decimalValue; - -/*! - * @brief Returns the contents of the receiver as a hexadecimal value. - * - * @return An integer with the hexadecimal value - */ -- (uintmax_t)hexadecimalValue; - -/*! - * @brief Returns the contents of the receiver as a float value. - * - * @return A float with the float value - */ -- (float)floatValue; - -/*! - * @brief Returns the contents of the receiver as a double value. - * - * @return A double with the double value - */ -- (double)doubleValue; - -/*! - * @brief Returns an OFString representing the OFXMLNode as an XML string. - * - * @return An OFString representing the OFXMLNode as an XML string - */ -- (OFString *)XMLString; +/*! + * The contents of the node as a string value. + * + * For an @ref OFXMLElement, setting it removes all children and creates a + * single child with the specified string value. + */ +@property (nonatomic, copy) OFString *stringValue; + +/*! + * The contents of the receiver as a decimal value. + */ +@property (readonly, nonatomic) intmax_t decimalValue; + +/*! + * The contents of the receiver as a hexadecimal value. + */ +@property (readonly, nonatomic) uintmax_t hexadecimalValue; + +/*! + * The contents of the receiver as a float value. + */ +@property (readonly, nonatomic) float floatValue; + +/*! + * The contents of the receiver as a double value. + */ +@property (readonly, nonatomic) double doubleValue; + +/*! + * A string representing the node as an XML string. + */ +@property (readonly, nonatomic) OFString *XMLString; + +- (instancetype)init OF_UNAVAILABLE; +- (instancetype)initWithSerialization: (OFXMLElement *)element OF_UNAVAILABLE; /*! * @brief Returns an OFString representing the OFXMLNode as an XML string with * indentation. * Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -177,10 +177,20 @@ * The delegate that is used by the XML parser. */ @property OF_NULLABLE_PROPERTY (assign, nonatomic) id delegate; +/*! + * The current line number. + */ +@property (readonly, nonatomic) size_t lineNumber; + +/*! + * @return Whether the XML parser has finished parsing. + */ +@property (readonly, nonatomic) bool hasFinishedParsing; + /*! * The depth limit for the XML parser. * * If the depth limit is exceeded, an OFMalformedXMLException is thrown. * @@ -224,22 +234,8 @@ * * @param path The path to the file to parse */ - (void)parseFile: (OFString *)path; #endif - -/*! - * @brief Returns the current line number. - * - * @return The current line number - */ -- (size_t)lineNumber; - -/*! - * @brief Returns whether the XML parser has finished parsing. - * - * @return Whether the XML parser has finished parsing - */ -- (bool)hasFinishedParsing; @end OF_ASSUME_NONNULL_END Index: src/OFZIPArchive.h ================================================================== --- src/OFZIPArchive.h +++ src/OFZIPArchive.h @@ -53,10 +53,21 @@ /*! * The archive comment. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *archiveComment; +/*! + * The entries in the central directory of the archive as an array of objects + * of class @ref OFZIPArchiveEntry. + * + * The objects of the array have the same order as the entries in the central + * directory, which does not need to be the order in which the actual files are + * stored. + */ +@property (readonly, nonatomic) + OFArray OF_GENERIC(OFZIPArchiveEntry *) *entries; + /*! * @brief Creates a new OFZIPArchive object with the specified stream. * * @param stream A stream from which the ZIP archive will be read. * For read and append mode, this needs to be an OFSeekableStream. @@ -111,22 +122,10 @@ */ - (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode; #endif -/*! - * @brief Returns the entries of the central directory of the archive as an - * array of objects of class @ref OFZIPArchiveEntry. - * - * The objects of the array have the same order as the entries in the central - * directory, which does not need to be the order in which the actual files are - * stored. - * - * @return The entries of the central directory of the archive as an array - */ -- (OFArray OF_GENERIC(OFZIPArchiveEntry *) *)entries; - /*! * @brief Returns a stream for reading the specified file from the archive. * * @note This method is only available in read mode. *