File: afcfile.h

package info (click to toggle)
kio-extras 4%3A25.04.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 31,928 kB
  • sloc: cpp: 28,852; ansic: 3,084; perl: 1,048; xml: 116; sh: 92; python: 28; makefile: 9
file content (40 lines) | stat: -rw-r--r-- 879 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * SPDX-FileCopyrightText: 2022 Kai Uwe Broulik <kde@broulik.de>
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#pragma once

#include <KIO/WorkerBase>

#include "afcclient.h"
#include "afcfilereader.h"

#include <optional>

class AfcFile
{
public:
    AfcFile(const AfcClient::Ptr &client, const QString &path);
    AfcFile(AfcFile &&other) Q_DECL_NOEXCEPT;
    ~AfcFile();

    AfcClient::Ptr client() const;
    QString path() const;

    KIO::WorkerResult open(QIODevice::OpenMode mode);
    KIO::WorkerResult seek(KIO::filesize_t offset);
    KIO::WorkerResult truncate(KIO::filesize_t length);
    KIO::WorkerResult write(const QByteArray &data, uint32_t &bytesWritten);
    KIO::WorkerResult close();

    AfcFileReader reader() const;

private:
    AfcClient::Ptr m_client;
    QString m_path;

    std::optional<uint64_t> m_handle;

    Q_DISABLE_COPY(AfcFile)
};