mFrame
載入中...
搜尋中...
無符合項目
InputStream.h
1
7#ifndef MFRAME_029349A4_F909_41C7_AC18_0DE3B02FAB01
8#define MFRAME_029349A4_F909_41C7_AC18_0DE3B02FAB01
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../io/CompletionHandler.h"
18#include "./../lang/Appendable.h"
19#include "./../util/Future.h"
20
21/* ***************************************************************************************
22 * Namespace
23 */
24namespace mframe::io {
25 struct InputStream;
26}
27
28/* ***************************************************************************************
29 * Class/Interface/Struct/Enum
30 */
38 virtual bool abortRead(void) abstract;
39
46 virtual bool readBusy(void) abstract;
47
61 virtual bool read(mframe::lang::Appendable& appendable,
62 void* attachment,
63 mframe::io::CompletionHandler<int>* handler) abstract;
64
73 inline bool read(mframe::lang::Appendable& appendable,
75 if (future.isBusy())
76 return false;
77
78 future.setWait();
79 if (this->read(appendable, nullptr, &future))
80 return true;
81
82 future.failed(nullptr);
83 return false;
84 }
85};
86
87/* ***************************************************************************************
88 * End of file
89 */
90
91#endif /* MFRAME_029349A4_F909_41C7_AC18_0DE3B02FAB01 */
Definition AppendableOutputStream.h:24
Definition CompletionHandler.h:32
virtual void failed(void *attachment) override
Invoked when an operation fails.
Definition InputStream.h:31
bool read(mframe::lang::Appendable &appendable, mframe::util::Future< int > &future)
Definition InputStream.h:73
virtual bool abortRead(void) override
virtual bool readBusy(void) override
virtual bool read(mframe::lang::Appendable &appendable, void *attachment, mframe::io::CompletionHandler< int > *handler) override
非同步讀取。從輸入串流中讀取一些字節數,並將他們存到寫入緩衝區writeBuffer。
可附加的 <Interface>
Definition Appendable.h:36
Definition Interface.h:134
Definition Future.h:33