92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
* @brief Provides a way to store a number in an object.
*/
@interface OFNumber: OFObject <OFCopying, OFComparing, OFSerialization,
OFJSONRepresentation>
{
union of_number_value {
BOOL bool_;
signed char char_;
signed short short_;
signed int int_;
signed long long_;
unsigned char uchar;
unsigned short ushort;
unsigned int uint;
unsigned long ulong;
int8_t int8;
int16_t int16;
int32_t int32;
|
|
|
|
|
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
* @brief Provides a way to store a number in an object.
*/
@interface OFNumber: OFObject <OFCopying, OFComparing, OFSerialization,
OFJSONRepresentation>
{
union of_number_value {
BOOL bool_;
signed char schar;
signed short sshort;
signed int sint;
signed long slong;
unsigned char uchar;
unsigned short ushort;
unsigned int uint;
unsigned long ulong;
int8_t int8;
int16_t int16;
int32_t int32;
|
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
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;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly) of_number_type_t type;
#endif
/*!
* @brief Creates a new OFNumber with the specified BOOL.
*
* @param bool_ A BOOL which the OFNumber should contain
* @return A new autoreleased OFNumber
*/
+ (instancetype)numberWithBool: (BOOL)bool_;
/*!
* @brief Creates a new OFNumber with the specified signed char.
*
* @param char_ A signed char which the OFNumber should contain
* @return A new autoreleased OFNumber
*/
+ (instancetype)numberWithChar: (signed char)char_;
/*!
* @brief Creates a new OFNumber with the specified signed short.
*
* @param short_ A signed short which the OFNumber should contain
* @return A new autoreleased OFNumber
*/
+ (instancetype)numberWithShort: (signed short)short_;
/*!
* @brief Creates a new OFNumber with the specified signed int.
*
* @param int_ A signed int which the OFNumber should contain
* @return A new autoreleased OFNumber
*/
+ (instancetype)numberWithInt: (signed int)int_;
/*!
* @brief Creates a new OFNumber with the specified signed long.
*
* @param long_ A signed long which the OFNumber should contain
* @return A new autoreleased OFNumber
*/
+ (instancetype)numberWithLong: (signed long)long_;
/*!
* @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
*/
|
|
|
|
|
|
|
|
|
|
|
|
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
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;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly) of_number_type_t type;
#endif
/*!
* @brief Creates a new OFNumber with the specified BOOL.
*
* @param bool_ A BOOL which the OFNumber should contain
* @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
* @return A new autoreleased OFNumber
*/
+ (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
* @return A new autoreleased OFNumber
*/
+ (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
* @return A new autoreleased OFNumber
*/
+ (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
* @return A new autoreleased OFNumber
*/
+ (instancetype)numberWithLong: (signed long)slong;
/*!
* @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
*/
|
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
*/
- initWithBool: (BOOL)bool_;
/*!
* @brief Initializes an already allocated OFNumber with the specified signed
* char.
*
* @param char_ A signed char which the OFNumber should contain
* @return An initialized OFNumber
*/
- initWithChar: (signed char)char_;
/*!
* @brief Initializes an already allocated OFNumber with the specified signed
* short.
*
* @param short_ A signed short which the OFNumber should contain
* @return An initialized OFNumber
*/
- initWithShort: (signed short)short_;
/*!
* @brief Initializes an already allocated OFNumber with the specified signed
* int.
*
* @param int_ A signed int which the OFNumber should contain
* @return An initialized OFNumber
*/
- initWithInt: (signed int)int_;
/*!
* @brief Initializes an already allocated OFNumber with the specified signed
* long.
*
* @param long_ A signed long which the OFNumber should contain
* @return An initialized OFNumber
*/
- initWithLong: (signed long)long_;
/*!
* @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
|
|
|
|
|
|
|
|
|
|
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
*/
- initWithBool: (BOOL)bool_;
/*!
* @brief Initializes an already allocated OFNumber with the specified signed
* char.
*
* @param schar A signed char which the OFNumber should contain
* @return An initialized OFNumber
*/
- 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
* @return An initialized OFNumber
*/
- 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
* @return An initialized OFNumber
*/
- 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
* @return An initialized OFNumber
*/
- initWithLong: (signed long)slong;
/*!
* @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
|