ObjFW  Check-in [91a4c53bb1]

Overview
Comment:Override -[compare:] with a more specific type
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 91a4c53bb1a784889c0b96197315f7657772aca3fb9fa3c19d76c587083e068f
User & Date: js on 2021-04-07 20:39:27
Other Links: manifest | tags
Context
2021-04-07
20:52
Override -[objectEnumerator] in some classes check-in: f0f38b0f42 user: js tags: trunk
20:39
Override -[compare:] with a more specific type check-in: 91a4c53bb1 user: js tags: trunk
19:22
OF{Data,String}+CryptoHashing: Rename methods check-in: b5a74319e1 user: js tags: trunk
Changes

Modified src/OFConstantString.m from [3252c9a3ca] to [415348861e].

174
175
176
177
178
179
180
181
182


183
184
185
186
187
188
189
174
175
176
177
178
179
180


181
182
183
184
185
186
187
188
189







-
-
+
+







/* From protocol OFMutableCopying */
- (id)mutableCopy
{
	[self finishInitialization];
	return [self mutableCopy];
}

/* From protocol OFComparing */
- (of_comparison_result_t)compare: (id <OFComparing>)object
/* From protocol OFComparing,  but overridden in OFString */
- (of_comparison_result_t)compare: (OFString *)object
{
	[self finishInitialization];
	return [self compare: object];
}

/* From OFObject, but reimplemented in OFString */
- (bool)isEqual: (id)object

Modified src/OFData.h from [538b8801b5] to [4a70713abd].

266
267
268
269
270
271
272








273
274
275
276
277
278
279
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287







+
+
+
+
+
+
+
+







 *	  containing the data of the Base64-encoded string.
 *
 * @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
 */
- (const void *)itemAtIndex: (size_t)index OF_RETURNS_INNER_POINTER;

Modified src/OFDate.h from [e9a1a4ba66] to [dff8b1eb37].

263
264
265
266
267
268
269








270
271
272
273
274
275
276
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284







+
+
+
+
+
+
+
+







 * @param string The string describing the date
 * @param format The format of the string describing the date
 * @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.
 *
 * @param format The format for the date string
 * @return A new, autoreleased OFString

Modified src/OFNumber.h from [428bdb0cc8] to [1390ca955e].

357
358
359
360
361
362
363








364
365
366
367
368
369
370
371
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379







+
+
+
+
+
+
+
+








/**
 * @brief Initializes an already allocated OFNumber with the specified `double`.
 *
 * @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

Modified src/OFObject.h from [7b6e5395a2] to [846f3a0425].

1214
1215
1216
1217
1218
1219
1220
1221

1222
1223
1224
1225

1226
1227
1228
1229
1230
1231
1232
1214
1215
1216
1217
1218
1219
1220

1221
1222
1223
1224

1225
1226
1227
1228
1229
1230
1231
1232







-
+



-
+







@end

/**
 * @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 <OFComparing>)object;
@end
#endif

Modified src/OFString.h from [d557fd2664] to [048f9d26ff].

880
881
882
883
884
885
886
887
888









889
890
891


892
893

894
895
896
897
898
899
900
880
881
882
883
884
885
886


887
888
889
890
891
892
893
894
895
896


897
898
899

900
901
902
903
904
905
906
907







-
-
+
+
+
+
+
+
+
+
+

-
-
+
+

-
+







 *
 * @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 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
 * @return The Unicode character at the specified index
 */

Modified src/OFTimer.h from [7ce735d772] to [4d79b8c7ef].

449
450
451
452
453
454
455








456
457
458
459
460
461
462
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470







+
+
+
+
+
+
+
+







 */
- (instancetype)initWithFireDate: (OFDate *)fireDate
			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;

/**