ObjFW
 All Classes Functions Variables
OFRunLoop.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 #import "OFStream.h"
19 #import "OFStreamObserver.h"
20 #import "OFTCPSocket.h"
21 
22 @class OFSortedList;
23 @class OFTimer;
24 @class OFMutableDictionary;
25 
29 @interface OFRunLoop: OFObject
30 {
31  OFSortedList *timersQueue;
32  OFStreamObserver *streamObserver;
33  OFMutableDictionary *readQueues;
34 }
35 
41 + (OFRunLoop*)mainRunLoop;
42 
48 + (OFRunLoop*)currentRunLoop;
49 
50 + (void)OF_setMainRunLoop;
51 + (void)OF_addAsyncReadForStream: (OFStream*)stream
52  buffer: (void*)buffer
53  length: (size_t)length
54  target: (id)target
55  selector: (SEL)selector;
56 + (void)OF_addAsyncReadForStream: (OFStream*)stream
57  buffer: (void*)buffer
58  exactLength: (size_t)length
59  target: (id)target
60  selector: (SEL)selector;
61 + (void)OF_addAsyncReadLineForStream: (OFStream*)stream
62  encoding: (of_string_encoding_t)encoding
63  target: (id)target
64  selector: (SEL)selector;
65 + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket
66  target: (id)target
67  selector: (SEL)selector;
68 #ifdef OF_HAVE_BLOCKS
69 + (void)OF_addAsyncReadForStream: (OFStream*)stream
70  buffer: (void*)buffer
71  length: (size_t)length
72  block: (of_stream_async_read_block_t)block;
73 + (void)OF_addAsyncReadForStream: (OFStream*)stream
74  buffer: (void*)buffer
75  exactLength: (size_t)length
76  block: (of_stream_async_read_block_t)block;
77 + (void)OF_addAsyncReadLineForStream: (OFStream*)stream
78  encoding: (of_string_encoding_t)encoding
79  block: (of_stream_async_read_line_block_t)block;
80 + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket
81  block: (of_tcpsocket_async_accept_block_t)block;
82 #endif
83 
89 - (void)addTimer: (OFTimer*)timer;
90 
94 - (void)run;
95 @end