Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qsequentialfileadaptor_p.h
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4
#
ifndef
QSEQUENTIALFILEADAPTOR_P
5
#
define
QSEQUENTIALFILEADAPTOR_P
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtCore
/
qfile
.
h
>
19
20
struct
QSequentialFileAdaptor
:
QIODevice
21
{
22
template
<
typename
... Args>
23
explicit
QSequentialFileAdaptor
(Args... args) :
m_file
(
args
...)
24
{
25
}
26
27
bool
open
(QIODeviceBase::OpenMode mode)
override
28
{
29
QIODevice::open(mode);
30
return
m_file.open(mode);
31
}
32
33
void
close
()
override
34
{
35
m_file.close();
36
QIODevice::close();
37
}
38
39
qint64
pos
()
const
override
{
return
m_file.pos(); }
40
qint64
size
()
const
override
{
return
m_file.size(); }
41
bool
seek
(qint64 pos)
override
{
return
m_file.seek(pos); }
42
bool
atEnd
()
const
override
{
return
m_file.atEnd(); }
43
bool
reset
()
override
{
return
m_file.reset(); }
44
45
qint64
bytesAvailable
()
const
override
{
return
m_file.bytesAvailable(); }
46
47
bool
isSequential
()
const
override
{
return
true
; }
48
49
qint64
readData
(
char
*data, qint64 maxlen)
override
{
return
m_file.read(data, maxlen); }
50
qint64
writeData
(
const
char
*data, qint64 len)
override
{
return
m_file.write(data, len); }
51
52
QFile
m_file
;
53
};
54
55
#
endif
// QSEQUENTIALFILEADAPTOR_P
QSequentialFileAdaptor
Definition
qsequentialfileadaptor_p.h:21
QSequentialFileAdaptor::readData
qint64 readData(char *data, qint64 maxlen) override
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
Definition
qsequentialfileadaptor_p.h:49
QSequentialFileAdaptor::seek
bool seek(qint64 pos) override
For random-access devices, this function sets the current position to pos, returning true on success,...
Definition
qsequentialfileadaptor_p.h:41
QSequentialFileAdaptor::atEnd
bool atEnd() const override
Returns true if the current read and write position is at the end of the device (i....
Definition
qsequentialfileadaptor_p.h:42
QSequentialFileAdaptor::m_file
QFile m_file
Definition
qsequentialfileadaptor_p.h:52
QSequentialFileAdaptor::writeData
qint64 writeData(const char *data, qint64 len) override
Writes up to maxSize bytes from data to the device.
Definition
qsequentialfileadaptor_p.h:50
QSequentialFileAdaptor::bytesAvailable
qint64 bytesAvailable() const override
Returns the number of bytes that are available for reading.
Definition
qsequentialfileadaptor_p.h:45
QSequentialFileAdaptor::reset
bool reset() override
Seeks to the start of input for random-access devices.
Definition
qsequentialfileadaptor_p.h:43
QSequentialFileAdaptor::close
void close() override
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
Definition
qsequentialfileadaptor_p.h:33
QSequentialFileAdaptor::open
bool open(QIODeviceBase::OpenMode mode) override
Opens the device and sets its OpenMode to mode.
Definition
qsequentialfileadaptor_p.h:27
QSequentialFileAdaptor::pos
qint64 pos() const override
For random-access devices, this function returns the position that data is written to or read from.
Definition
qsequentialfileadaptor_p.h:39
QSequentialFileAdaptor::isSequential
bool isSequential() const override
Returns true if this device is sequential; otherwise returns false.
Definition
qsequentialfileadaptor_p.h:47
QSequentialFileAdaptor::size
qint64 size() const override
For open random-access devices, this function returns the size of the device.
Definition
qsequentialfileadaptor_p.h:40
QSequentialFileAdaptor::QSequentialFileAdaptor
QSequentialFileAdaptor(Args... args)
Definition
qsequentialfileadaptor_p.h:23
qtmultimedia
src
multimediatestlib
qsequentialfileadaptor_p.h
Generated on
for Qt by
1.18.0