Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -176,12 +176,12 @@ { [self finishInitialization]; return [self mutableCopy]; } -/* From protocol OFComparing */ -- (of_comparison_result_t)compare: (id )object +/* From protocol OFComparing, but overridden in OFString */ +- (of_comparison_result_t)compare: (OFString *)object { [self finishInitialization]; return [self compare: object]; } Index: src/OFData.h ================================================================== --- src/OFData.h +++ src/OFData.h @@ -268,10 +268,18 @@ * @param string The string with the Base64-encoded data * @return An initialized OFData */ - (instancetype)initWithBase64EncodedString: (OFString *)string; +/** + * @brief Compares the data to other data. + * + * @param data Data to compare the data to + * @return The result of the comparison + */ +- (of_comparison_result_t)compare: (OFData *)data; + /** * @brief Returns a specific item of the OFData. * * @param index The number of the item to return * @return The specified item of the OFData Index: src/OFDate.h ================================================================== --- src/OFDate.h +++ src/OFDate.h @@ -265,10 +265,18 @@ * @return An initialized OFDate with the specified date and time */ - (instancetype)initWithLocalDateString: (OFString *)string format: (OFString *)format; +/** + * @brief Compares the date to another date. + * + * @param date The date to compare the date to + * @return The result of the comparison + */ +- (of_comparison_result_t)compare: (OFDate *)date; + /** * @brief Creates a string of the date with the specified format. * * See the man page for `strftime` for information on the format. * Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -359,13 +359,21 @@ * * @param value The `double` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithDouble: (double)value; + +/** + * @brief Compares the number to another number. + * + * @param number The number to compare the number to + * @return The result of the comparison + */ +- (of_comparison_result_t)compare: (OFNumber *)number; @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.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -1216,15 +1216,15 @@ /** * @protocol OFComparing OFObject.h ObjFW/OFObject.h * * @brief A protocol for comparing objects. * - * This protocol is implemented by objects that can be compared. + * This protocol is implemented by objects that can be compared. Its only method, @ref compare:, should be overridden with a stronger type. */ @protocol OFComparing /** - * @brief Compares the object with another object. + * @brief Compares the object to another object. * * @param object An object to compare the object to * @return The result of the comparison */ - (of_comparison_result_t)compare: (id )object; Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -882,17 +882,24 @@ * @return The number of bytes the string needs in the specified encoding. */ - (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding; /** - * @brief Compares the OFString to another OFString without caring about the - * case. + * @brief Compares the string to another string. + * + * @param string The string to compare the string to + * @return The result of the comparison + */ +- (of_comparison_result_t)compare: (OFString *)string; + +/** + * @brief Compares the string to another string without caring about the case. * - * @param otherString A string to compare with - * @return An of_comparison_result_t + * @param string The string to compare the string to + * @return The result of the comparison */ -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)otherString; +- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string; /** * @brief Returns the Unicode character at the specified index. * * @param index The index of the Unicode character to return Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -451,10 +451,18 @@ interval: (of_time_interval_t)interval repeats: (bool)repeats block: (of_timer_block_t)block; #endif +/** + * @brief Compares the timer to another timer. + * + * @param timer The timer to compare the string to + * @return The result of the comparison + */ +- (of_comparison_result_t)compare: (OFTimer *)timer; + /** * @brief Fires the timer, meaning it will execute the specified selector on the * target. */ - (void)fire;