ObjFW  Diff

Differences From Artifact [afb39b7429]:

To Artifact [29b807402b]:


30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44







-
+








/*! @file */

/*!
 * @brief The C type of a number stored in an OFNumber.
 */
typedef enum of_number_type_t {
	/*! BOOL */
	/*! bool */
	OF_NUMBER_BOOL		= 0x01,
	/*! unsigned char */
	OF_NUMBER_UCHAR		= 0x02,
	/*! unsigned short */
	OF_NUMBER_USHORT	= 0x03,
	/*! unsigned int */
	OF_NUMBER_UINT		= 0x04,
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
96
97
98
99
100
101
102

103
104
105
106
107
108
109
110







-
+







/*!
 * @brief Provides a way to store a number in an object.
 */
@interface OFNumber: OFObject <OFCopying, OFComparing, OFSerialization,
    OFJSONRepresentation, OFBinaryPackRepresentation>
{
	union of_number_value {
		BOOL		   bool_;
		bool		   bool_;
		signed char	   schar;
		signed short	   sshort;
		signed int	   sint;
		signed long	   slong;
		signed long long   slonglong;
		unsigned char	   uchar;
		unsigned short	   ushort;
133
134
135
136
137
138
139
140

141
142

143
144
145

146
147
148
149
150
151
152
133
134
135
136
137
138
139

140
141

142
143
144

145
146
147
148
149
150
151
152







-
+

-
+


-
+







}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) of_number_type_t type;
#endif

/*!
 * @brief Creates a new OFNumber with the specified BOOL.
 * @brief Creates a new OFNumber with the specified bool.
 *
 * @param bool_ A BOOL which the OFNumber should contain
 * @param bool_ A bool which the OFNumber should contain
 * @return A new autoreleased OFNumber
 */
+ (instancetype)numberWithBool: (BOOL)bool_;
+ (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
 */
357
358
359
360
361
362
363
364

365
366

367
368
369

370
371
372
373
374
375
376
357
358
359
360
361
362
363

364
365

366
367
368

369
370
371
372
373
374
375
376







-
+

-
+


-
+







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

/*!
 * @brief Initializes an already allocated OFNumber with the specified BOOL.
 * @brief Initializes an already allocated OFNumber with the specified bool.
 *
 * @param bool_ A BOOL which the OFNumber should contain
 * @param bool_ A bool which the OFNumber should contain
 * @return An initialized OFNumber
 */
- initWithBool: (BOOL)bool_;
- 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
601
602
603
604
605
606
607
608

609
610

611
612

613
614
615
616
617
618
619
601
602
603
604
605
606
607

608
609

610
611

612
613
614
615
616
617
618
619







-
+

-
+

-
+







 * @brief Returns the type of the number.
 *
 * @return An of_number_type_t indicating the type of the number
 */
- (of_number_type_t)type;

/*!
 * @brief Returns the OFNumber as a BOOL.
 * @brief Returns the OFNumber as a bool.
 *
 * @return The OFNumber as a BOOL
 * @return The OFNumber as a bool
 */
- (BOOL)boolValue;
- (bool)boolValue;

/*!
 * @brief Returns the OFNumber as a signed char.
 *
 * @return The OFNumber as a signed char
 */
- (signed char)charValue;