ObjFW  Diff

Differences From Artifact [60fe00fa34]:

To Artifact [15976a5400]:


10
11
12
13
14
15
16

17
18
19
20
21
22
23
 */

#include <unistd.h>

#import "OFObject.h"

enum of_number_type {

	OF_NUMBER_CHAR,
	OF_NUMBER_SHORT,
	OF_NUMBER_INT,
	OF_NUMBER_LONG,
	OF_NUMBER_UCHAR,
	OF_NUMBER_USHORT,
	OF_NUMBER_UINT,







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 */

#include <unistd.h>

#import "OFObject.h"

enum of_number_type {
	OF_NUMBER_BOOL,
	OF_NUMBER_CHAR,
	OF_NUMBER_SHORT,
	OF_NUMBER_INT,
	OF_NUMBER_LONG,
	OF_NUMBER_UCHAR,
	OF_NUMBER_USHORT,
	OF_NUMBER_UINT,
43
44
45
46
47
48
49

50
51
52
53
54
55
56

/**
 * \brief Provides a way to store a number in an object.
 */
@interface OFNumber: OFObject <OFCopying>
{
	union {

		char	       char_;
		short	       short_;
		int	       int_;
		long	       long_;
		unsigned char  uchar;
		unsigned short ushort;
		unsigned int   uint;







>







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

/**
 * \brief Provides a way to store a number in an object.
 */
@interface OFNumber: OFObject <OFCopying>
{
	union {
		BOOL	       bool_;
		char	       char_;
		short	       short_;
		int	       int_;
		long	       long_;
		unsigned char  uchar;
		unsigned short ushort;
		unsigned int   uint;
72
73
74
75
76
77
78






79
80
81
82
83
84
85
		uintptr_t      uintptr;
		float	       float_;
		double	       double_;
	} value;
	enum of_number_type type;
}







/**
 * \param char_ A char which the OFNumber should contain
 * \return A new autoreleased OFNumber
 */
+ numberWithChar: (char)char_;

/**







>
>
>
>
>
>







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
		uintptr_t      uintptr;
		float	       float_;
		double	       double_;
	} value;
	enum of_number_type type;
}

/**
 * \param bool_ A BOOL which the OFNumber should contain
 * \return A new autoreleased OFNumber
 */
+ numberWithBool: (BOOL)bool_;

/**
 * \param char_ A char which the OFNumber should contain
 * \return A new autoreleased OFNumber
 */
+ numberWithChar: (char)char_;

/**
222
223
224
225
226
227
228








229
230
231
232
233
234
235

/**
 * \param double_ A double which the OFNumber should contain
 * \return A new autoreleased OFNumber
 */
+ numberWithDouble: (double)double_;









/**
 * Initializes an already allocated OFNumber with the specified char.
 *
 * \param char_ A char which the OFNumber should contain
 * \return An initialized OFNumber
 */
- initWithChar: (char)char_;







>
>
>
>
>
>
>
>







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251

/**
 * \param double_ A double which the OFNumber should contain
 * \return A new autoreleased OFNumber
 */
+ numberWithDouble: (double)double_;

/**
 * Initializes an already allocated OFNumber with the specified BOOL.
 *
 * \param bool_ A BOOL which the OFNumber should contain
 * \return An initialized OFNumber
 */
- initWithBool: (BOOL)bool_;

/**
 * Initializes an already allocated OFNumber with the specified char.
 *
 * \param char_ A char which the OFNumber should contain
 * \return An initialized OFNumber
 */
- initWithChar: (char)char_;
428
429
430
431
432
433
434





435
436
437
438
439
440
441

/**
 * \return An enum of type of_number_type indicating the type of contained
 *	   number of the OFNumber
 */
- (enum of_number_type)type;






/**
 * \return The OFNumber as a char
 */
- (char)charValue;

/**
 * \return The OFNumber as a short







>
>
>
>
>







444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462

/**
 * \return An enum of type of_number_type indicating the type of contained
 *	   number of the OFNumber
 */
- (enum of_number_type)type;

/**
 * \return The OFNumber as a BOOL
 */
- (BOOL)boolValue;

/**
 * \return The OFNumber as a char
 */
- (char)charValue;

/**
 * \return The OFNumber as a short