ObjFW  Diff

Differences From Artifact [ac208c2ef2]:

To Artifact [f7277d1a0d]:


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


27
28
29


30
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
11
12
13
14
15
16
17




18
19
20


21
22
23


24
25
26

27
28


29
30
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







-
-
-
-



-
-
+
+

-
-
+
+

-
+

-
-
+
+

+
+
+
+
+


-
-
-
-
-
-
+

-
-
+
+

-
+

+
+

-
+

-
-
+
+

+
+
-
+



 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFException.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

OF_ASSUME_NONNULL_BEGIN

/**
 * @class OFAlreadyConnectedException \
 *	  OFAlreadyConnectedException.h ObjFW/OFAlreadyConnectedException.h
 * @class OFAlreadyOpenException \
 *	  OFAlreadyOpenException.h ObjFW/OFAlreadyOpenException.h
 *
 * @brief An exception indicating an attempt to connect or bind an already
 *        connected or bound socket.
 * @brief An exception indicating that an object is already open and thus
 *	  cannot be opened again.
 */
@interface OFAlreadyConnectedException: OFException
@interface OFAlreadyOpenException: OFException
{
	id _socket;
	OF_RESERVE_IVARS(OFAlreadyConnectedException, 4)
	id _object;
	OF_RESERVE_IVARS(OFAlreadyOpenException, 4)
}

/**
 * @brief The object which is already open.
 */
@property (readonly, nonatomic) id object;

/**
 * @brief The socket which is already connected.
 */
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) id socket;

/**
 * @brief Creates a new, autoreleased already connected exception.
 * @brief Creates a new, autoreleased already open exception.
 *
 * @param socket The socket which is already connected
 * @return A new, autoreleased already connected exception
 * @param object The object which is already open
 * @return A new, autoreleased already open exception
 */
+ (instancetype)exceptionWithSocket: (nullable id)socket;
+ (instancetype)exceptionWithObject: (id)object;

+ (instancetype)exception OF_UNAVAILABLE;

/**
 * @brief Initializes an already allocated already connected exception.
 * @brief Initializes an already allocated already open exception.
 *
 * @param socket The socket which is already connected
 * @return An initialized already connected exception
 * @param object The object which is already open
 * @return An initialized already open exception
 */
- (instancetype)initWithObject: (id)object OF_DESIGNATED_INITIALIZER;

- (instancetype)initWithSocket: (nullable id)socket OF_DESIGNATED_INITIALIZER;
- (instancetype)init OF_UNAVAILABLE;
@end

OF_ASSUME_NONNULL_END