ObjFW  Diff

Differences From Artifact [4d081e6530]:

To Artifact [913bbdc96f]:

  • File src/exceptions/OFNotConnectedException.h — part of check-in [8d2a5052fd] at 2014-01-25 17:39:13 on branch trunk — Generalize stream / socket related exceptions

    This is in preparation for adding UDP sockets, as UDP sockets and TCP
    sockets have no common superclass, as one is stream-oriented while the
    other is packet-oriented.

    Read and write exceptions are for any object now, as they are useful for
    a lot more than just for streams, while the others (bind, listen, etc.)
    are for any socket now (the type is id in this case, though, as there is
    no common superclass). (user: js, size: 1439) [annotate] [blame] [check-ins using]


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

#import "OFException.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

@class OFStreamSocket;

/*!
 * @brief An exception indicating a socket is not connected or bound.
 */
@interface OFNotConnectedException: OFException
{
	OFStreamSocket *_socket;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, retain) OFStreamSocket *socket;
#endif

/*!
 * @brief Creates a new, autoreleased not connected exception.
 *
 * @param socket The socket which is not connected
 * @return A new, autoreleased not connected exception
 */
+ (instancetype)exceptionWithSocket: (OFStreamSocket*)socket;

/*!
 * @brief Initializes an already allocated not connected exception.
 *
 * @param socket The socket which is not connected
 * @return An initialized not connected exception
 */
- initWithSocket: (OFStreamSocket*)socket;

/*!
 * @brief Returns the socket which is not connected.
 *
 * @return The socket which is not connected
 */
- (OFStreamSocket*)socket;
@end







<
<





|



|








|







|






|

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

#import "OFException.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif



/*!
 * @brief An exception indicating a socket is not connected or bound.
 */
@interface OFNotConnectedException: OFException
{
	id _socket;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, retain) id socket;
#endif

/*!
 * @brief Creates a new, autoreleased not connected exception.
 *
 * @param socket The socket which is not connected
 * @return A new, autoreleased not connected exception
 */
+ (instancetype)exceptionWithSocket: (id)socket;

/*!
 * @brief Initializes an already allocated not connected exception.
 *
 * @param socket The socket which is not connected
 * @return An initialized not connected exception
 */
- initWithSocket: (id)socket;

/*!
 * @brief Returns the socket which is not connected.
 *
 * @return The socket which is not connected
 */
- (id)socket;
@end