ObjFW  Diff

Differences From Artifact [92dadecb01]:

To Artifact [8625e9c54a]:


116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132










133
134
135
136
137
138
139
140




141
142
143
144
145
146
147






148
149
150
151
152
153
154
116
117
118
119
120
121
122










123
124
125
126
127
128
129
130
131
132
133
134
135
136




137
138
139
140
141






142
143
144
145
146
147
148
149
150
151
152
153
154







-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+




-
-
-
-
+
+
+
+

-
-
-
-
-
-
+
+
+
+
+
+







 * @brief Provides a way to store a number in an object.
 */
@interface OFNumber: OFObject <OFCopying, OFComparing, OFSerialization,
    OFJSONRepresentation, OFMessagePackRepresentation>
{
	union of_number_value {
		bool		   bool_;
		signed char	   schar;
		signed short	   sshort;
		signed int	   sint;
		signed long	   slong;
		signed long long   slonglong;
		unsigned char	   uchar;
		unsigned short	   ushort;
		unsigned int	   uint;
		unsigned long	   ulong;
		unsigned long long ulonglong;
		signed char	   sChar;
		signed short	   sShort;
		signed int	   sInt;
		signed long	   sLong;
		signed long long   sLongLong;
		unsigned char	   uChar;
		unsigned short	   uShort;
		unsigned int	   uInt;
		unsigned long	   uLong;
		unsigned long long uLongLong;
		int8_t		   int8;
		int16_t		   int16;
		int32_t		   int32;
		int64_t		   int64;
		uint8_t		   uint8;
		uint16_t	   uint16;
		uint32_t	   uint32;
		uint64_t	   uint64;
		uint8_t		   uInt8;
		uint16_t	   uInt16;
		uint32_t	   uInt32;
		uint64_t	   uInt64;
		size_t		   size;
		ssize_t		   ssize;
		intmax_t	   intmax;
		uintmax_t	   uintmax;
		ptrdiff_t	   ptrdiff;
		intptr_t	   intptr;
		uintptr_t	   uintptr;
		ssize_t		   sSize;
		intmax_t	   intMax;
		uintmax_t	   uIntMax;
		ptrdiff_t	   ptrDiff;
		intptr_t	   intPtr;
		uintptr_t	   uIntPtr;
		float		   float_;
		double		   double_;
	} _value;
	of_number_type_t _type;
}

/*!
163
164
165
166
167
168
169
170

171
172
173

174
175
176
177
178

179
180
181

182
183
184
185
186

187
188
189

190
191
192
193
194

195
196
197

198
199
200
201
202

203
204
205

206
207
208
209
210

211
212
213

214
215
216
217
218

219
220
221

222
223
224
225
226

227
228
229

230
231
232
233
234

235
236
237

238
239
240
241
242

243
244
245

246
247
248
249
250
251
252
163
164
165
166
167
168
169

170
171
172

173
174
175
176
177

178
179
180

181
182
183
184
185

186
187
188

189
190
191
192
193

194
195
196

197
198
199
200
201

202
203
204

205
206
207
208
209

210
211
212

213
214
215
216
217

218
219
220

221
222
223
224
225

226
227
228

229
230
231
232
233

234
235
236

237
238
239
240
241

242
243
244

245
246
247
248
249
250
251
252







-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+







 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithBool: (bool)bool_;

/*!
 * @brief Creates a new OFNumber with the specified signed char.
 *
 * @param schar A signed char which the OFNumber should contain
 * @param sChar A signed char which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithChar: (signed char)schar;
+ (instancetype)numberWithChar: (signed char)sChar;

/*!
 * @brief Creates a new OFNumber with the specified signed short.
 *
 * @param sshort A signed short which the OFNumber should contain
 * @param sShort A signed short which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithShort: (signed short)sshort;
+ (instancetype)numberWithShort: (signed short)sShort;

/*!
 * @brief Creates a new OFNumber with the specified signed int.
 *
 * @param sint A signed int which the OFNumber should contain
 * @param sInt A signed int which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithInt: (signed int)sint;
+ (instancetype)numberWithInt: (signed int)sInt;

/*!
 * @brief Creates a new OFNumber with the specified signed long.
 *
 * @param slong A signed long which the OFNumber should contain
 * @param sLong A signed long which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithLong: (signed long)slong;
+ (instancetype)numberWithLong: (signed long)sLong;

/*!
 * @brief Creates a new OFNumber with the specified signed long long.
 *
 * @param slonglong A signed long long which the OFNumber should contain
 * @param sLongLong A signed long long which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithLongLong: (signed long long)slonglong;
+ (instancetype)numberWithLongLong: (signed long long)sLongLong;

/*!
 * @brief Creates a new OFNumber with the specified unsigned char.
 *
 * @param uchar An unsigned char which the OFNumber should contain
 * @param uChar An unsigned char which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUnsignedChar: (unsigned char)uchar;
+ (instancetype)numberWithUnsignedChar: (unsigned char)uChar;

/*!
 * @brief Creates a new OFNumber with the specified unsigned short.
 *
 * @param ushort An unsigned short which the OFNumber should contain
 * @param uShort An unsigned short which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUnsignedShort: (unsigned short)ushort;
+ (instancetype)numberWithUnsignedShort: (unsigned short)uShort;

/*!
 * @brief Creates a new OFNumber with the specified unsigned int.
 *
 * @param uint An unsigned int which the OFNumber should contain
 * @param uInt An unsigned int which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUnsignedInt: (unsigned int)uint;
+ (instancetype)numberWithUnsignedInt: (unsigned int)uInt;

/*!
 * @brief Creates a new OFNumber with the specified unsigned long.
 *
 * @param ulong An unsigned long which the OFNumber should contain
 * @param uLong An unsigned long which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUnsignedLong: (unsigned long)ulong;
+ (instancetype)numberWithUnsignedLong: (unsigned long)uLong;

/*!
 * @brief Creates a new OFNumber with the specified unsigned long long.
 *
 * @param ulonglong An unsigned long long which the OFNumber should contain
 * @param uLongLong An unsigned long long which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUnsignedLongLong: (unsigned long long)ulonglong;
+ (instancetype)numberWithUnsignedLongLong: (unsigned long long)uLongLong;

/*!
 * @brief Creates a new OFNumber with the specified int8_t.
 *
 * @param int8 An int8_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
275
276
277
278
279
280
281
282

283
284
285

286
287
288
289
290

291
292
293

294
295
296
297
298

299
300
301

302
303
304
305
306

307
308
309

310
311
312
313
314
315
316
317
318
319
320
321
322

323
324
325

326
327
328
329
330

331
332
333

334
335
336
337
338

339
340
341

342
343
344
345
346

347
348
349

350
351
352
353
354

355
356
357

358
359
360
361
362

363
364
365

366
367
368
369
370
371
372
275
276
277
278
279
280
281

282
283
284

285
286
287
288
289

290
291
292

293
294
295
296
297

298
299
300

301
302
303
304
305

306
307
308

309
310
311
312
313
314
315
316
317
318
319
320
321

322
323
324

325
326
327
328
329

330
331
332

333
334
335
336
337

338
339
340

341
342
343
344
345

346
347
348

349
350
351
352
353

354
355
356

357
358
359
360
361

362
363
364

365
366
367
368
369
370
371
372







-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+












-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+







 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithInt64: (int64_t)int64;

/*!
 * @brief Creates a new OFNumber with the specified uint8_t.
 *
 * @param uint8 A uint8_t which the OFNumber should contain
 * @param uInt8 A uint8_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUInt8: (uint8_t)uint8;
+ (instancetype)numberWithUInt8: (uint8_t)uInt8;

/*!
 * @brief Creates a new OFNumber with the specified uint16_t.
 *
 * @param uint16 A uint16_t which the OFNumber should contain
 * @param uInt16 A uint16_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUInt16: (uint16_t)uint16;
+ (instancetype)numberWithUInt16: (uint16_t)uInt16;

/*!
 * @brief Creates a new OFNumber with the specified uint32_t.
 *
 * @param uint32 A uint32_t which the OFNumber should contain
 * @param uInt32 A uint32_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUInt32: (uint32_t)uint32;
+ (instancetype)numberWithUInt32: (uint32_t)uInt32;

/*!
 * @brief Creates a new OFNumber with the specified uint64_t.
 *
 * @param uint64 A uint64_t which the OFNumber should contain
 * @param uInt64 A uint64_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUInt64: (uint64_t)uint64;
+ (instancetype)numberWithUInt64: (uint64_t)uInt64;

/*!
 * @brief Creates a new OFNumber with the specified size_t.
 *
 * @param size A size_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithSize: (size_t)size;

/*!
 * @brief Creates a new OFNumber with the specified ssize_t.
 *
 * @param ssize An ssize_t which the OFNumber should contain
 * @param sSize An ssize_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithSSize: (ssize_t)ssize;
+ (instancetype)numberWithSSize: (ssize_t)sSize;

/*!
 * @brief Creates a new OFNumber with the specified intmax_t.
 *
 * @param intmax An intmax_t which the OFNumber should contain
 * @param intMax An intmax_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithIntMax: (intmax_t)intmax;
+ (instancetype)numberWithIntMax: (intmax_t)intMax;

/*!
 * @brief Creates a new OFNumber with the specified uintmax_t.
 *
 * @param uintmax A uintmax_t which the OFNumber should contain
 * @param uIntMax A uintmax_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUIntMax: (uintmax_t)uintmax;
+ (instancetype)numberWithUIntMax: (uintmax_t)uIntMax;

/*!
 * @brief Creates a new OFNumber with the specified ptrdiff_t.
 *
 * @param ptrdiff A ptrdiff_t which the OFNumber should contain
 * @param ptrDiff A ptrdiff_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithPtrDiff: (ptrdiff_t)ptrdiff;
+ (instancetype)numberWithPtrDiff: (ptrdiff_t)ptrDiff;

/*!
 * @brief Creates a new OFNumber with the specified intptr_t.
 *
 * @param intptr An intptr_t which the OFNumber should contain
 * @param intPtr An intptr_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithIntPtr: (intptr_t)intptr;
+ (instancetype)numberWithIntPtr: (intptr_t)intPtr;

/*!
 * @brief Creates a new OFNumber with the specified uintptr_t.
 *
 * @param uintptr A uintptr_t which the OFNumber should contain
 * @param uIntPtr A uintptr_t which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithUIntPtr: (uintptr_t)uintptr;
+ (instancetype)numberWithUIntPtr: (uintptr_t)uIntPtr;

/*!
 * @brief Creates a new OFNumber with the specified float.
 *
 * @param float_ A float which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
390
391
392
393
394
395
396
397

398
399
400

401
402
403
404
405
406

407
408
409

410
411
412
413
414
415

416
417
418

419
420
421
422
423
424

425
426
427

428
429
430
431
432
433

434
435
436

437
438
439
440
441
442

443
444
445

446
447
448
449
450
451

452
453
454

455
456
457
458
459
460

461
462
463

464
465
466
467
468
469

470
471
472

473
474
475
476
477
478

479
480
481

482
483
484
485
486
487
488
390
391
392
393
394
395
396

397
398
399

400
401
402
403
404
405

406
407
408

409
410
411
412
413
414

415
416
417

418
419
420
421
422
423

424
425
426

427
428
429
430
431
432

433
434
435

436
437
438
439
440
441

442
443
444

445
446
447
448
449
450

451
452
453

454
455
456
457
458
459

460
461
462

463
464
465
466
467
468

469
470
471

472
473
474
475
476
477

478
479
480

481
482
483
484
485
486
487
488







-
+


-
+





-
+


-
+





-
+


-
+





-
+


-
+





-
+


-
+





-
+


-
+





-
+


-
+





-
+


-
+





-
+


-
+





-
+


-
+







 */
- (instancetype)initWithBool: (bool)bool_;

/*!
 * @brief Initializes an already allocated OFNumber with the specified signed
 *	  char.
 *
 * @param schar A signed char which the OFNumber should contain
 * @param sChar A signed char which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithChar: (signed char)schar;
- (instancetype)initWithChar: (signed char)sChar;

/*!
 * @brief Initializes an already allocated OFNumber with the specified signed
 *	  short.
 *
 * @param sshort A signed short which the OFNumber should contain
 * @param sShort A signed short which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithShort: (signed short)sshort;
- (instancetype)initWithShort: (signed short)sShort;

/*!
 * @brief Initializes an already allocated OFNumber with the specified signed
 *	  int.
 *
 * @param sint A signed int which the OFNumber should contain
 * @param sInt A signed int which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithInt: (signed int)sint;
- (instancetype)initWithInt: (signed int)sInt;

/*!
 * @brief Initializes an already allocated OFNumber with the specified signed
 *	  long.
 *
 * @param slong A signed long which the OFNumber should contain
 * @param sLong A signed long which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithLong: (signed long)slong;
- (instancetype)initWithLong: (signed long)sLong;

/*!
 * @brief Initializes an already allocated OFNumber with the specified signed
 *	  long long.
 *
 * @param slonglong A signed long long which the OFNumber should contain
 * @param sLongLong A signed long long which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithLongLong: (signed long long)slonglong;
- (instancetype)initWithLongLong: (signed long long)sLongLong;

/*!
 * @brief Initializes an already allocated OFNumber with the specified unsigned
 *	  char.
 *
 * @param uchar An unsigned char which the OFNumber should contain
 * @param uChar An unsigned char which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUnsignedChar: (unsigned char)uchar;
- (instancetype)initWithUnsignedChar: (unsigned char)uChar;

/*!
 * @brief Initializes an already allocated OFNumber with the specified unsigned
 *	  short.
 *
 * @param ushort An unsigned short which the OFNumber should contain
 * @param uShort An unsigned short which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUnsignedShort: (unsigned short)ushort;
- (instancetype)initWithUnsignedShort: (unsigned short)uShort;

/*!
 * @brief Initializes an already allocated OFNumber with the specified unsigned
 *	  int.
 *
 * @param uint An unsigned int which the OFNumber should contain
 * @param uInt An unsigned int which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUnsignedInt: (unsigned int)uint;
- (instancetype)initWithUnsignedInt: (unsigned int)uInt;

/*!
 * @brief Initializes an already allocated OFNumber with the specified unsigned
 *	  long.
 *
 * @param ulong An unsigned long which the OFNumber should contain
 * @param uLong An unsigned long which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUnsignedLong: (unsigned long)ulong;
- (instancetype)initWithUnsignedLong: (unsigned long)uLong;

/*!
 * @brief Initializes an already allocated OFNumber with the specified unsigned
 *	  long long.
 *
 * @param ulonglong An unsigned long long which the OFNumber should contain
 * @param uLongLong An unsigned long long which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUnsignedLongLong: (unsigned long long)ulonglong;
- (instancetype)initWithUnsignedLongLong: (unsigned long long)uLongLong;

/*!
 * @brief Initializes an already allocated OFNumber with the specified int8_t.
 *
 * @param int8 An int8_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
511
512
513
514
515
516
517
518

519
520
521

522
523
524
525
526

527
528
529

530
531
532
533
534

535
536
537

538
539
540
541
542

543
544
545

546
547
548
549
550
551
552
553
554
555
556
557
558

559
560
561

562
563
564
565
566

567
568
569

570
571
572
573
574
575

576
577
578

579
580
581
582
583
584

585
586
587

588
589
590
591
592

593
594
595

596
597
598
599
600
601

602
603
604

605
606
607
608
609
610
611
511
512
513
514
515
516
517

518
519
520

521
522
523
524
525

526
527
528

529
530
531
532
533

534
535
536

537
538
539
540
541

542
543
544

545
546
547
548
549
550
551
552
553
554
555
556
557

558
559
560

561
562
563
564
565

566
567
568

569
570
571
572
573
574

575
576
577

578
579
580
581
582
583

584
585
586

587
588
589
590
591

592
593
594

595
596
597
598
599
600

601
602
603

604
605
606
607
608
609
610
611







-
+


-
+




-
+


-
+




-
+


-
+




-
+


-
+












-
+


-
+




-
+


-
+





-
+


-
+





-
+


-
+




-
+


-
+





-
+


-
+







 * @return An initialized OFNumber
 */
- (instancetype)initWithInt64: (int64_t)int64;

/*!
 * @brief Initializes an already allocated OFNumber with the specified uint8_t.
 *
 * @param uint8 A uint8_t which the OFNumber should contain
 * @param uInt8 A uint8_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUInt8: (uint8_t)uint8;
- (instancetype)initWithUInt8: (uint8_t)uInt8;

/*!
 * @brief Initializes an already allocated OFNumber with the specified uint16_t.
 *
 * @param uint16 A uint16_t which the OFNumber should contain
 * @param uInt16 A uint16_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUInt16: (uint16_t)uint16;
- (instancetype)initWithUInt16: (uint16_t)uInt16;

/*!
 * @brief Initializes an already allocated OFNumber with the specified uint32_t.
 *
 * @param uint32 A uint32_t which the OFNumber should contain
 * @param uInt32 A uint32_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUInt32: (uint32_t)uint32;
- (instancetype)initWithUInt32: (uint32_t)uInt32;

/*!
 * @brief Initializes an already allocated OFNumber with the specified uint64_t.
 *
 * @param uint64 A uint64_t which the OFNumber should contain
 * @param uInt64 A uint64_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUInt64: (uint64_t)uint64;
- (instancetype)initWithUInt64: (uint64_t)uInt64;

/*!
 * @brief Initializes an already allocated OFNumber with the specified size_t.
 *
 * @param size A size_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithSize: (size_t)size;

/*!
 * @brief Initializes an already allocated OFNumber with the specified ssize_t.
 *
 * @param ssize An ssize_t which the OFNumber should contain
 * @param sSize An ssize_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithSSize: (ssize_t)ssize;
- (instancetype)initWithSSize: (ssize_t)sSize;

/*!
 * @brief Initializes an already allocated OFNumber with the specified intmax_t.
 *
 * @param intmax An intmax_t which the OFNumber should contain
 * @param intMax An intmax_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithIntMax: (intmax_t)intmax;
- (instancetype)initWithIntMax: (intmax_t)intMax;

/*!
 * @brief Initializes an already allocated OFNumber with the specified
 *	  uintmax_t.
 *
 * @param uintmax A uintmax_t which the OFNumber should contain
 * @param uIntMax A uintmax_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUIntMax: (uintmax_t)uintmax;
- (instancetype)initWithUIntMax: (uintmax_t)uIntMax;

/*!
 * @brief Initializes an already allocated OFNumber with the specified
 *	  ptrdiff_t.
 *
 * @param ptrdiff A ptrdiff_t which the OFNumber should contain
 * @param ptrDiff A ptrdiff_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrdiff;
- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrDiff;

/*!
 * @brief Initializes an already allocated OFNumber with the specified intptr_t.
 *
 * @param intptr An intptr_t which the OFNumber should contain
 * @param intPtr An intptr_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithIntPtr: (intptr_t)intptr;
- (instancetype)initWithIntPtr: (intptr_t)intPtr;

/*!
 * @brief Initializes an already allocated OFNumber with the specified
 *	  uintptr_t.
 *
 * @param uintptr A uintptr_t which the OFNumber should contain
 * @param uIntPtr A uintptr_t which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithUIntPtr: (uintptr_t)uintptr;
- (instancetype)initWithUIntPtr: (uintptr_t)uIntPtr;

/*!
 * @brief Initializes an already allocated OFNumber with the specified float.
 *
 * @param float_ A float which the OFNumber should contain
 * @return An initialized OFNumber
 */