ObjFW  Diff

Differences From Artifact [f7f55d0f21]:

To Artifact [dfa33f4cd7]:


67
68
69
70
71
72
73
74

75
76
77

78
79
80

81
82
83

84
85
86
87
88
89
90
67
68
69
70
71
72
73

74
75
76

77
78
79

80
81
82

83
84
85
86
87
88
89
90







-
+


-
+


-
+


-
+







	OF_NUMBER_TYPE_UINTPTR		= 0x0C,
	/*! `uintmax_t` */
	OF_NUMBER_TYPE_UINTMAX		= 0x0D,
	OF_NUMBER_TYPE_SIGNED		= 0x10,
	/*! `signed char` */
	OF_NUMBER_TYPE_CHAR		= OF_NUMBER_TYPE_UCHAR |
					      OF_NUMBER_TYPE_SIGNED,
	/*! `signed short` */
	/*! `short` */
	OF_NUMBER_TYPE_SHORT		= OF_NUMBER_TYPE_USHORT |
					      OF_NUMBER_TYPE_SIGNED,
	/*! `signed int` */
	/*! `int` */
	OF_NUMBER_TYPE_INT		= OF_NUMBER_TYPE_UINT |
					      OF_NUMBER_TYPE_SIGNED,
	/*! `signed long` */
	/*! `long` */
	OF_NUMBER_TYPE_LONG		= OF_NUMBER_TYPE_ULONG |
					      OF_NUMBER_TYPE_SIGNED,
	/*! `signed long long` */
	/*! `long long` */
	OF_NUMBER_TYPE_LONGLONG		= OF_NUMBER_TYPE_ULONGLONG |
					      OF_NUMBER_TYPE_SIGNED,
	/*! `int8_t` */
	OF_NUMBER_TYPE_INT8		= OF_NUMBER_TYPE_UINT8 |
					      OF_NUMBER_TYPE_SIGNED,
	/*! `int16_t` */
	OF_NUMBER_TYPE_INT16		= OF_NUMBER_TYPE_UINT16 |
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
155
156
157
158
159
160
161
162
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
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
155
156
157
158
159
160
161
162
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







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

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




















-
+

-
+


-
+

-
+


-
+

-
+


-
+

-
+







#ifndef OF_NUMBER_M
OF_SUBCLASSING_RESTRICTED
#endif
@interface OFNumber: OFValue <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;
		bool               bool_;
		signed char        sChar;
		short              sShort;
		int                sInt;
		long               sLong;
		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;
		size_t		   size;
		ssize_t		   sSize;
		intmax_t	   intMax;
		uintmax_t	   uIntMax;
		ptrdiff_t	   ptrDiff;
		intptr_t	   intPtr;
		uintptr_t	   uIntPtr;
		float		   float_;
		double		   double_;
		int8_t             int8;
		int16_t            int16;
		int32_t            int32;
		int64_t            int64;
		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;
		float              float_;
		double             double_;
	} _value;
	of_number_type_t _type;
}

/*!
 * @brief The type of the number.
 */
@property (readonly, nonatomic) of_number_type_t type;

/*!
 * @brief The OFNumber as a `bool`.
 */
@property (readonly, nonatomic) bool boolValue;

/*!
 * @brief The OFNumber as a `signed char`.
 */
@property (readonly, nonatomic) signed char charValue;

/*!
 * @brief The OFNumber as a `signed short`.
 * @brief The OFNumber as a `short`.
 */
@property (readonly, nonatomic) signed short shortValue;
@property (readonly, nonatomic) short shortValue;

/*!
 * @brief The OFNumber as a `signed int`.
 * @brief The OFNumber as an `int`.
 */
@property (readonly, nonatomic) signed int intValue;
@property (readonly, nonatomic) int intValue;

/*!
 * @brief The OFNumber as a `signed long`.
 * @brief The OFNumber as a `long`.
 */
@property (readonly, nonatomic) signed long longValue;
@property (readonly, nonatomic) long longValue;

/*!
 * @brief The OFNumber as a `signed long long`.
 * @brief The OFNumber as a `long long`.
 */
@property (readonly, nonatomic) signed long long longLongValue;
@property (readonly, nonatomic) long long longLongValue;

/*!
 * @brief The OFNumber as an `unsigned char`.
 */
@property (readonly, nonatomic) unsigned char unsignedCharValue;

/*!
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
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







-
+

-
+


-
+


-
+

-
+


-
+


-
+

-
+


-
+


-
+

-
+


-
+







 *
 * @param sChar A `signed char` which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithChar: (signed char)sChar;

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

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

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

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

/*!
 * @brief Creates a new OFNumber with the specified `unsigned char`.
 *
 * @param uChar An `unsigned char` which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
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
612
613
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







-
+
-

-
+


-
+


-
+
-

-
+


-
+


-
+
-

-
+


-
+



-
+

-
+


-
+







 *
 * @param sChar A `signed char` which the OFNumber should contain
 * @return An initialized OFNumber
 */
- (instancetype)initWithChar: (signed char)sChar;

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

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

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

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

/*!
 * @brief Initializes an already allocated OFNumber with the specified
 *	  `unsigned char`.
 *
 * @param uChar An `unsigned char` which the OFNumber should contain
 * @return An initialized OFNumber