Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
doxygen-1.8.11
qtools
qiodevice.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
**
4
** Definition of QIODevice class
5
**
6
** Created : 940913
7
**
8
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9
**
10
** This file is part of the tools module of the Qt GUI Toolkit.
11
**
12
** This file may be distributed under the terms of the Q Public License
13
** as defined by Trolltech AS of Norway and appearing in the file
14
** LICENSE.QPL included in the packaging of this file.
15
**
16
** This file may be distributed and/or modified under the terms of the
17
** GNU General Public License version 2 as published by the Free Software
18
** Foundation and appearing in the file LICENSE.GPL included in the
19
** packaging of this file.
20
**
21
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22
** licenses may use this file in accordance with the Qt Commercial License
23
** Agreement provided with the Software.
24
**
25
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
**
28
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29
** information about Qt Commercial License Agreements.
30
** See http://www.trolltech.com/qpl/ for QPL licensing information.
31
** See http://www.trolltech.com/gpl/ for GPL licensing information.
32
**
33
** Contact info@trolltech.com if any conditions of this licensing are
34
** not clear to you.
35
**
36
**********************************************************************/
37
38
#ifndef QIODEVICE_H
39
#define QIODEVICE_H
40
41
#ifndef QT_H
42
#include "
qglobal.h
"
43
#include "
qcstring.h
"
44
#endif // QT_H
45
46
47
// IO device access types
48
49
#define IO_Direct 0x0100 // direct access device
50
#define IO_Sequential 0x0200 // sequential access device
51
#define IO_Combined 0x0300 // combined direct/sequential
52
#define IO_TypeMask 0x0f00
53
54
// IO handling modes
55
56
#define IO_Raw 0x0040 // raw access (not buffered)
57
#define IO_Async 0x0080 // asynchronous mode
58
59
// IO device open modes
60
61
#define IO_ReadOnly 0x0001 // readable device
62
#define IO_WriteOnly 0x0002 // writable device
63
#define IO_ReadWrite 0x0003 // read+write device
64
#define IO_Append 0x0004 // append
65
#define IO_Truncate 0x0008 // truncate device
66
#define IO_Translate 0x0010 // translate CR+LF
67
#define IO_ModeMask 0x00ff
68
69
// IO device state
70
71
#define IO_Open 0x1000 // device is open
72
#define IO_StateMask 0xf000
73
74
75
// IO device status
76
77
#define IO_Ok 0
78
#define IO_ReadError 1 // read error
79
#define IO_WriteError 2 // write error
80
#define IO_FatalError 3 // fatal unrecoverable error
81
#define IO_ResourceError 4 // resource limitation
82
#define IO_OpenError 5 // cannot open device
83
#define IO_ConnectError 5 // cannot connect to device
84
#define IO_AbortError 6 // abort error
85
#define IO_TimeOutError 7 // time out
86
#define IO_UnspecifiedError 8 // unspecified error
87
88
class
Q_EXPORT
QIODevice
// IO device class
89
{
90
public
:
91
QIODevice
();
92
virtual
~
QIODevice
();
93
94
int
flags
()
const
{
return
ioMode; }
95
int
mode
()
const
{
return
ioMode &
IO_ModeMask
; }
96
int
state
()
const
{
return
ioMode &
IO_StateMask
; }
97
98
bool
isDirectAccess
()
const
{
return
((ioMode &
IO_Direct
) == IO_Direct); }
99
bool
isSequentialAccess
()
const
{
return
((ioMode &
IO_Sequential
) == IO_Sequential); }
100
bool
isCombinedAccess
()
const
{
return
((ioMode &
IO_Combined
) == IO_Combined); }
101
bool
isBuffered
()
const
{
return
((ioMode &
IO_Raw
) != IO_Raw); }
102
bool
isRaw
()
const
{
return
((ioMode &
IO_Raw
) == IO_Raw); }
103
bool
isSynchronous
()
const
{
return
((ioMode &
IO_Async
) != IO_Async); }
104
bool
isAsynchronous
()
const
{
return
((ioMode &
IO_Async
) == IO_Async); }
105
bool
isTranslated
()
const
{
return
((ioMode &
IO_Translate
) == IO_Translate); }
106
bool
isReadable
()
const
{
return
((ioMode &
IO_ReadOnly
) == IO_ReadOnly); }
107
bool
isWritable
()
const
{
return
((ioMode &
IO_WriteOnly
) == IO_WriteOnly); }
108
bool
isReadWrite
()
const
{
return
((ioMode &
IO_ReadWrite
) == IO_ReadWrite); }
109
bool
isInactive
()
const
{
return
state() == 0; }
110
bool
isOpen
()
const
{
return
state() ==
IO_Open
; }
111
112
int
status
()
const
{
return
ioSt; }
113
void
resetStatus
() { ioSt =
IO_Ok
; }
114
115
virtual
bool
open
(
int
mode ) = 0;
116
virtual
void
close
() = 0;
117
virtual
void
flush
() = 0;
118
119
virtual
uint
size
()
const
= 0;
120
virtual
int
at()
const
;
121
virtual
bool
at(
int
);
122
virtual
bool
atEnd()
const
;
123
bool
reset
() {
return
at(0); }
124
125
virtual
int
readBlock(
char
*
data
,
uint
maxlen
) = 0;
126
virtual
int
writeBlock(
const
char
*data,
uint
len ) = 0;
127
virtual
int
readLine(
char
*data,
uint
maxlen );
128
int
writeBlock(
const
QByteArray
& data );
129
QByteArray
readAll();
130
131
virtual
int
getch() = 0;
132
virtual
int
putch(
int
) = 0;
133
virtual
int
ungetch(
int
) = 0;
134
135
protected
:
136
void
setFlags
(
int
f
) { ioMode =
f
; }
137
void
setType(
int
);
138
void
setMode(
int
);
139
void
setState(
int
);
140
void
setStatus(
int
);
141
int
ioIndex
;
142
143
private
:
144
int
ioMode
;
145
int
ioSt
;
146
147
private
:
// Disabled copy constructor and operator=
148
#if defined(Q_DISABLE_COPY)
149
QIODevice
(
const
QIODevice
& );
150
QIODevice
&operator=(
const
QIODevice
& );
151
#endif
152
};
153
154
155
#endif // QIODEVICE_H
IO_ReadWrite
#define IO_ReadWrite
Definition:
qiodevice.h:63
QIODevice::state
int state() const
Definition:
qiodevice.h:96
keras_to_tensorflow.f
f
Definition:
keras_to_tensorflow.py:162
QIODevice::flags
int flags() const
Definition:
qiodevice.h:94
maxlen
static const int maxlen
Definition:
qregexp.cpp:904
IO_Raw
#define IO_Raw
Definition:
qiodevice.h:56
IO_WriteOnly
#define IO_WriteOnly
Definition:
qiodevice.h:62
QIODevice::isRaw
bool isRaw() const
Definition:
qiodevice.h:102
QIODevice::setFlags
void setFlags(int f)
Definition:
qiodevice.h:136
open
int open(const char *, int)
Opens a file descriptor.
QIODevice::status
int status() const
Definition:
qiodevice.h:112
QArray< char >
QIODevice::isCombinedAccess
bool isCombinedAccess() const
Definition:
qiodevice.h:100
QIODevice::isReadable
bool isReadable() const
Definition:
qiodevice.h:106
qcstring.h
IO_Translate
#define IO_Translate
Definition:
qiodevice.h:66
QIODevice::resetStatus
void resetStatus()
Definition:
qiodevice.h:113
IO_Direct
#define IO_Direct
Definition:
qiodevice.h:49
IO_ReadOnly
#define IO_ReadOnly
Definition:
qiodevice.h:61
util::size
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition:
StdUtils.h:92
IO_ModeMask
#define IO_ModeMask
Definition:
qiodevice.h:67
close
int close(int)
Closes the file descriptor fd.
qglobal.h
flush
QTextStream & flush(QTextStream &s)
Definition:
qtextstream.cpp:2035
QIODevice::isSequentialAccess
bool isSequentialAccess() const
Definition:
qiodevice.h:99
QIODevice::isWritable
bool isWritable() const
Definition:
qiodevice.h:107
IO_StateMask
#define IO_StateMask
Definition:
qiodevice.h:72
IO_Sequential
#define IO_Sequential
Definition:
qiodevice.h:50
QIODevice::ioSt
int ioSt
Definition:
qiodevice.h:145
QIODevice::isDirectAccess
bool isDirectAccess() const
Definition:
qiodevice.h:98
make_THn_beam_input.data
data
Definition:
make_THn_beam_input.py:80
IO_Ok
#define IO_Ok
Definition:
qiodevice.h:77
QIODevice::isSynchronous
bool isSynchronous() const
Definition:
qiodevice.h:103
QIODevice::isBuffered
bool isBuffered() const
Definition:
qiodevice.h:101
QIODevice::reset
bool reset()
Definition:
qiodevice.h:123
IO_Combined
#define IO_Combined
Definition:
qiodevice.h:51
QIODevice::mode
int mode() const
Definition:
qiodevice.h:95
QIODevice::isTranslated
bool isTranslated() const
Definition:
qiodevice.h:105
QIODevice::isAsynchronous
bool isAsynchronous() const
Definition:
qiodevice.h:104
QIODevice::ioMode
int ioMode
Definition:
qiodevice.h:144
IO_Async
#define IO_Async
Definition:
qiodevice.h:57
QIODevice::isReadWrite
bool isReadWrite() const
Definition:
qiodevice.h:108
QIODevice
The QIODevice class is the base class of I/O devices.
Definition:
qiodevice.h:88
QIODevice::isOpen
bool isOpen() const
Definition:
qiodevice.h:110
uint
unsigned uint
Definition:
qglobal.h:351
QIODevice::isInactive
bool isInactive() const
Definition:
qiodevice.h:109
IO_Open
#define IO_Open
Definition:
qiodevice.h:71
Q_EXPORT
#define Q_EXPORT
Definition:
qglobal.h:468
QIODevice::ioIndex
int ioIndex
Definition:
qiodevice.h:141
Generated by
1.8.11