Differences From Artifact [ff0ae5f35c]:
- File
src/OFNumber.h
— part of check-in
[bc9998913a]
at
2020-08-30 16:22:17
on branch tagged-pointers
— OFNumber: Never access ivars after init
This is a requirement for tagged pointer numbers, which cannot have
ivars. (user: js, size: 10761) [annotate] [blame] [check-ins using] [more...]
To Artifact [028df04d4c]:
- File src/OFNumber.h — part of check-in [163a4a5a2e] at 2020-10-03 11:35:41 on branch trunk — Use /** */ instead of /*! */ for documentation (user: js, size: 10761) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
31 32 33 34 35 36 37 | #import "OFJSONRepresentation.h" #import "OFMessagePackRepresentation.h" #import "OFSerialization.h" #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 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 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 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 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 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 | #import "OFJSONRepresentation.h" #import "OFMessagePackRepresentation.h" #import "OFSerialization.h" #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN /** @file */ /** * @class OFNumber OFNumber.h ObjFW/OFNumber.h * * @brief Provides a way to store a number in an object. */ #ifndef OF_NUMBER_M OF_SUBCLASSING_RESTRICTED #endif @interface OFNumber: OFValue <OFComparing, OFSerialization, OFJSONRepresentation, OFMessagePackRepresentation> { union of_number_value { double float_; long long signed_; unsigned long long unsigned_; } _value; const char *_typeEncoding; } /** * @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 `short`. */ @property (readonly, nonatomic) short shortValue; /** * @brief The OFNumber as an `int`. */ @property (readonly, nonatomic) int intValue; /** * @brief The OFNumber as a `long`. */ @property (readonly, nonatomic) long longValue; /** * @brief The OFNumber as a `long long`. */ @property (readonly, nonatomic) long long longLongValue; /** * @brief The OFNumber as an `unsigned char`. */ @property (readonly, nonatomic) unsigned char unsignedCharValue; /** * @brief The OFNumber as an `unsigned short`. */ @property (readonly, nonatomic) unsigned short unsignedShortValue; /** * @brief The OFNumber as an `unsigned int`. */ @property (readonly, nonatomic) unsigned int unsignedIntValue; /** * @brief The OFNumber as an `unsigned long`. */ @property (readonly, nonatomic) unsigned long unsignedLongValue; /** * @brief The OFNumber as an `unsigned long long`. */ @property (readonly, nonatomic) unsigned long long unsignedLongLongValue; /** * @brief The OFNumber as a `float`. */ @property (readonly, nonatomic) float floatValue; /** * @brief The OFNumber as a `double`. */ @property (readonly, nonatomic) double doubleValue; /** * @brief The OFNumber as a string. */ @property (readonly, nonatomic) OFString *stringValue; #ifdef OF_HAVE_UNAVAILABLE + (instancetype)valueWithBytes: (const void *)bytes objCType: (const char *)objCType OF_UNAVAILABLE; + (instancetype)valueWithPointer: (const void *)pointer OF_UNAVAILABLE; + (instancetype)valueWithNonretainedObject: (id)object OF_UNAVAILABLE; + (instancetype)valueWithRange: (of_range_t)range OF_UNAVAILABLE; + (instancetype)valueWithPoint: (of_point_t)point OF_UNAVAILABLE; + (instancetype)valueWithDimension: (of_dimension_t)dimension OF_UNAVAILABLE; + (instancetype)valueWithRectangle: (of_rectangle_t)rectangle OF_UNAVAILABLE; #endif /** * @brief Creates a new OFNumber with the specified `bool`. * * @param value The `bool` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithBool: (bool)value; /** * @brief Creates a new OFNumber with the specified `signed char`. * * @param value The `signed char` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithChar: (signed char)value; /** * @brief Creates a new OFNumber with the specified `short`. * * @param value The `short` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithShort: (short)value; /** * @brief Creates a new OFNumber with the specified `int`. * * @param value The `int` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithInt: (int)value; /** * @brief Creates a new OFNumber with the specified `long`. * * @param value The `long` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithLong: (long)value; /** * @brief Creates a new OFNumber with the specified `long long`. * * @param value The `long long` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithLongLong: (long long)value; /** * @brief Creates a new OFNumber with the specified `unsigned char`. * * @param value The `unsigned char` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithUnsignedChar: (unsigned char)value; /** * @brief Creates a new OFNumber with the specified `unsigned short`. * * @param value The `unsigned short` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithUnsignedShort: (unsigned short)value; /** * @brief Creates a new OFNumber with the specified `unsigned int`. * * @param value The `unsigned int` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithUnsignedInt: (unsigned int)value; /** * @brief Creates a new OFNumber with the specified `unsigned long`. * * @param value The `unsigned long` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithUnsignedLong: (unsigned long)value; /** * @brief Creates a new OFNumber with the specified `unsigned long long`. * * @param value The `unsigned long long` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithUnsignedLongLong: (unsigned long long)value; /** * @brief Creates a new OFNumber with the specified `float`. * * @param value The `float` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithFloat: (float)value; /** * @brief Creates a new OFNumber with the specified `double`. * * @param value The `double` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithDouble: (double)value; - (instancetype)init OF_UNAVAILABLE; #ifdef OF_HAVE_UNAVAILABLE - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType OF_UNAVAILABLE; - (instancetype)initWithPointer: (const void *)pointer OF_UNAVAILABLE; - (instancetype)initWithNonretainedObject: (id)object OF_UNAVAILABLE; - (instancetype)initWithRange: (of_range_t)range OF_UNAVAILABLE; - (instancetype)initWithPoint: (of_point_t)point OF_UNAVAILABLE; - (instancetype)initWithDimension: (of_dimension_t)dimension OF_UNAVAILABLE; - (instancetype)initWithRectangle: (of_rectangle_t)rectangle OF_UNAVAILABLE; #endif /** * @brief Initializes an already allocated OFNumber with the specified `bool`. * * @param value The `bool` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithBool: (bool)value; /** * @brief Initializes an already allocated OFNumber with the specified * `signed char`. * * @param value The `signed char` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithChar: (signed char)value; /** * @brief Initializes an already allocated OFNumber with the specified `short`. * * @param value The `short` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithShort: (short)value; /** * @brief Initializes an already allocated OFNumber with the specified `int`. * * @param value The `int` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithInt: (int)value; /** * @brief Initializes an already allocated OFNumber with the specified `long`. * * @param value The `long` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithLong: (long)value; /** * @brief Initializes an already allocated OFNumber with the specified * `long long`. * * @param value The `long long` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithLongLong: (long long)value; /** * @brief Initializes an already allocated OFNumber with the specified * `unsigned char`. * * @param value The `unsigned char` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithUnsignedChar: (unsigned char)value; /** * @brief Initializes an already allocated OFNumber with the specified * `unsigned short`. * * @param value The `unsigned short` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithUnsignedShort: (unsigned short)value; /** * @brief Initializes an already allocated OFNumber with the specified * `unsigned int`. * * @param value The `unsigned int` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithUnsignedInt: (unsigned int)value; /** * @brief Initializes an already allocated OFNumber with the specified * `unsigned long`. * * @param value The `unsigned long` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithUnsignedLong: (unsigned long)value; /** * @brief Initializes an already allocated OFNumber with the specified * `unsigned long long`. * * @param value The `unsigned long long` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithUnsignedLongLong: (unsigned long long)value; /** * @brief Initializes an already allocated OFNumber with the specified `float`. * * @param value The `float` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithFloat: (float)value; /** * @brief Initializes an already allocated OFNumber with the specified `double`. * * @param value The `double` value which the OFNumber should contain * @return An initialized OFNumber */ - (instancetype)initWithDouble: (double)value; @end |
︙ | ︙ |