@@ -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 @@ -13,47 +13,47 @@ * file. */ #import "OFException.h" -#ifndef OF_HAVE_SOCKETS -# error No sockets available! -#endif - -OF_ASSUME_NONNULL_BEGIN - -/** - * @class OFAlreadyConnectedException \ - * OFAlreadyConnectedException.h ObjFW/OFAlreadyConnectedException.h - * - * @brief An exception indicating an attempt to connect or bind an already - * connected or bound socket. - */ -@interface OFAlreadyConnectedException: OFException -{ - id _socket; - OF_RESERVE_IVARS(OFAlreadyConnectedException, 4) -} - -/** - * @brief The socket which is already connected. - */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) id socket; - -/** - * @brief Creates a new, autoreleased already connected exception. - * - * @param socket The socket which is already connected - * @return A new, autoreleased already connected exception - */ -+ (instancetype)exceptionWithSocket: (nullable id)socket; - -/** - * @brief Initializes an already allocated already connected exception. - * - * @param socket The socket which is already connected - * @return An initialized already connected exception - */ -- (instancetype)initWithSocket: (nullable id)socket OF_DESIGNATED_INITIALIZER; +OF_ASSUME_NONNULL_BEGIN + +/** + * @class OFAlreadyOpenException \ + * OFAlreadyOpenException.h ObjFW/OFAlreadyOpenException.h + * + * @brief An exception indicating that an object is already open and thus + * cannot be opened again. + */ +@interface OFAlreadyOpenException: OFException +{ + id _object; + OF_RESERVE_IVARS(OFAlreadyOpenException, 4) +} + +/** + * @brief The object which is already open. + */ +@property (readonly, nonatomic) id object; + +/** + * @brief Creates a new, autoreleased already open exception. + * + * @param object The object which is already open + * @return A new, autoreleased already open exception + */ ++ (instancetype)exceptionWithObject: (id)object; + ++ (instancetype)exception OF_UNAVAILABLE; + +/** + * @brief Initializes an already allocated already open exception. + * + * @param object The object which is already open + * @return An initialized already open exception + */ +- (instancetype)initWithObject: (id)object OF_DESIGNATED_INITIALIZER; + +- (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END