@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2022 Jonathan Schleifer + * Copyright (c) 2008-2024 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -26,11 +26,10 @@ # include #endif #import "OFJSONRepresentation.h" #import "OFMessagePackRepresentation.h" -#import "OFSerialization.h" #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @@ -38,24 +37,12 @@ /** * @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 -{ - union { - double float_; - long long signed_; - unsigned long long unsigned_; - } _value; - const char *_typeEncoding; -} - +@interface OFNumber: OFValue /** * @brief The OFNumber as a `bool`. */ @property (readonly, nonatomic) bool boolValue; @@ -122,12 +109,10 @@ /** * @brief The OFNumber as a string. */ @property (readonly, nonatomic) OFString *stringValue; -+ (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: (OFRange)range OF_UNAVAILABLE; + (instancetype)valueWithPoint: (OFPoint)point OF_UNAVAILABLE; + (instancetype)valueWithSize: (OFSize)size OF_UNAVAILABLE; @@ -235,14 +220,10 @@ * @param value The `double` value which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithDouble: (double)value; -- (instancetype)init OF_UNAVAILABLE; -- (instancetype)initWithBytes: (const void *)bytes - objCType: (const char *)objCType OF_UNAVAILABLE; - /** * @brief Initializes an already allocated OFNumber with the specified `bool`. * * @param value The `bool` value which the OFNumber should contain * @return An initialized OFNumber