Last change
on this file was 2, checked in by dmik, 19 years ago |
Imported original Psi 0.10 sources from Affinix
|
File size:
889 bytes
|
Line | |
---|
1 | #ifndef QPIPE_H
|
---|
2 | #define QPIPE_H
|
---|
3 |
|
---|
4 | #include<qstring.h>
|
---|
5 | #include<qcstring.h>
|
---|
6 |
|
---|
7 | #ifdef Q_WS_WIN
|
---|
8 | #include<windows.h>
|
---|
9 | typedef HANDLE QPipeId;
|
---|
10 | #else
|
---|
11 | typedef int QPipeId;
|
---|
12 | #endif
|
---|
13 |
|
---|
14 | class QPipeEnd
|
---|
15 | {
|
---|
16 | public:
|
---|
17 | enum { Read, Write };
|
---|
18 | QPipeEnd();
|
---|
19 | ~QPipeEnd();
|
---|
20 |
|
---|
21 | bool isOpen() const;
|
---|
22 | const QPipeId & id() const;
|
---|
23 | void setId(const QPipeId &);
|
---|
24 |
|
---|
25 | void close();
|
---|
26 | void release();
|
---|
27 |
|
---|
28 | QString toString() const;
|
---|
29 |
|
---|
30 | int write(const QByteArray &);
|
---|
31 | QByteArray readAll(bool *done=0);
|
---|
32 |
|
---|
33 | #ifdef Q_WS_WIN
|
---|
34 | bool winDupHandle();
|
---|
35 | #else
|
---|
36 | bool setBlock(bool b);
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | private:
|
---|
40 | QPipeId p;
|
---|
41 |
|
---|
42 | void reset();
|
---|
43 | };
|
---|
44 |
|
---|
45 | class QPipe
|
---|
46 | {
|
---|
47 | public:
|
---|
48 | QPipe();
|
---|
49 | ~QPipe();
|
---|
50 |
|
---|
51 | void closeReadEnd();
|
---|
52 | void closeWriteEnd();
|
---|
53 |
|
---|
54 | int write(const QByteArray &);
|
---|
55 | QByteArray readAll(bool *done=0);
|
---|
56 |
|
---|
57 | QPipeEnd & readEnd() { return i; }
|
---|
58 | QPipeEnd & writeEnd() { return o; }
|
---|
59 |
|
---|
60 | bool open();
|
---|
61 | void close();
|
---|
62 | void release();
|
---|
63 |
|
---|
64 | private:
|
---|
65 | QPipeEnd i, o;
|
---|
66 | };
|
---|
67 |
|
---|
68 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.