Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qmockiodevice_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 QMOCKIODEVICE_P_H
5#define QMOCKIODEVICE_P_H
6
7#include <qiodevice.h>
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
21
22class MockIODevice : public QIODevice
23{
24public:
25 using QIODevice::QIODevice;
26
27 qint64 writeData(const char *, qint64 len) override { return len; }
28
29 qint64 readData(char *data, qint64 maxlen) override
30 {
31 memset(data, 0, maxlen);
32 return maxlen;
33 }
34};
35
36QT_END_NAMESPACE
37
38#endif // QMOCKIODEVICE_P_H
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...
qint64 writeData(const char *, qint64 len) override
Writes up to maxSize bytes from data to the device.