Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmlpreviewfileengine.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLPREVIEWFILEENGINE_H
5#define QQMLPREVIEWFILEENGINE_H
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
19
20#include <private/qabstractfileengine_p.h>
21#include <private/qfsfileengine_p.h>
22#include <QtCore/qbuffer.h>
23
25
27{
28public:
29 QQmlPreviewFileEngine(const QString &file, const QString &absolute,
31
32 void setFileName(const QString &file) override;
33
34 bool open(QIODevice::OpenMode flags, std::optional<QFile::Permissions> permissions) override;
35 bool close() override;
36 qint64 size() const override;
37 qint64 pos() const override;
38 bool seek(qint64) override;
39 qint64 read(char *data, qint64 maxlen) override;
40
41 FileFlags fileFlags(FileFlags type) const override;
43 uint ownerId(FileOwner) const override;
44
45 Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override;
46 Iterator *endEntryList() override;
47
48 // Forwarding to fallback if exists
49 bool flush() override;
50 bool syncToDisk() override;
51 bool isSequential() const override;
52 bool remove() override;
53 bool copy(const QString &newName) override;
54 bool rename(const QString &newName) override;
55 bool renameOverwrite(const QString &newName) override;
56 bool link(const QString &newName) override;
57 bool mkdir(const QString &dirName, bool createParentDirectories,
58 std::optional<QFile::Permissions> permissions = std::nullopt) const override;
59 bool rmdir(const QString &dirName, bool recurseParentDirectories) const override;
60 bool setSize(qint64 size) override;
61 bool caseSensitive() const override;
62 bool isRelativePath() const override;
63 QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override;
64 bool setPermissions(uint perms) override;
65 QByteArray id() const override;
66 QString owner(FileOwner) const override;
67 QDateTime fileTime(FileTime time) const override;
68 int handle() const override;
69 qint64 readLine(char *data, qint64 maxlen) override;
70 qint64 write(const char *data, qint64 len) override;
72 bool supportsExtension(Extension extension) const override;
73
74private:
75 void load() const;
76
77 QString m_name;
78 QString m_absolute;
80
81 mutable QBuffer m_contents;
82 mutable QStringList m_entries;
83 mutable QScopedPointer<QAbstractFileEngine> m_fallback;
85};
86
88{
89public:
91 QAbstractFileEngine *create(const QString &fileName) const override;
92
93private:
95};
96
97
98
100
101#endif // QQMLPREVIEWFILEENGINE_H
\inmodule QtCore \reentrant
The QAbstractFileEngineIterator class provides an iterator interface for custom file engines.
\inmodule QtCore \reentrant
FileOwner
\value OwnerUser The user who owns the file.
FileTime
These are used by the fileTime() function.
FileName
These values are used to request a file name in a particular format.
\inmodule QtCore \reentrant
Definition qbuffer.h:16
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore\reentrant
Definition qdatetime.h:257
\inmodule QtCore
Definition qpointer.h:18
bool supportsExtension(Extension extension) const override
bool link(const QString &newName) override
Creates a link from the file currently specified by fileName() to newName.
uint ownerId(FileOwner) const override
If owner is OwnerUser return the ID of the user who owns the file.
bool setPermissions(uint perms) override
Requests that the file's permissions be set to perms.
Iterator * endEntryList() override
bool caseSensitive() const override
Should return true if the underlying file system is case-sensitive; otherwise return false.
FileFlags fileFlags(FileFlags type) const override
This function should return the set of OR'd flags that are true for the file engine's file,...
bool seek(qint64) override
Sets the file position to the given offset.
void setFileName(const QString &file) override
Sets the file engine's file name to file.
QDateTime fileTime(FileTime time) const override
If time is BirthTime, return when the file was born (created).
bool mkdir(const QString &dirName, bool createParentDirectories, std::optional< QFile::Permissions > permissions=std::nullopt) const override
Requests that the directory dirName be created with the specified permissions.
Iterator * beginEntryList(QDir::Filters filters, const QStringList &filterNames) override
Returns an instance of a QAbstractFileEngineIterator using filters for entry filtering and filterName...
QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override
Requests that a list of all the files matching the filters list based on the filterNames in the file ...
bool flush() override
Flushes the open file, returning true if successful; otherwise returns false.
qint64 read(char *data, qint64 maxlen) override
Reads a number of characters from the file into data.
qint64 write(const char *data, qint64 len) override
Writes len bytes from data to the file.
bool open(QIODevice::OpenMode flags, std::optional< QFile::Permissions > permissions) override
Opens the file in the specified mode.
qint64 pos() const override
Returns the current file position.
qint64 readLine(char *data, qint64 maxlen) override
This function reads one line, terminated by a '\n' character, from the file info data.
bool copy(const QString &newName) override
Copies the contents of this file to a file with the name newName.
bool setSize(qint64 size) override
Requests that the file be set to size size.
bool isRelativePath() const override
Return true if the file referred to by this file engine has a relative path; otherwise return false.
bool rmdir(const QString &dirName, bool recurseParentDirectories) const override
Requests that the directory dirName is deleted from the file system.
QString owner(FileOwner) const override
If owner is OwnerUser return the name of the user who owns the file.
bool renameOverwrite(const QString &newName) override
bool isSequential() const override
Returns true if the file is a sequential access device; returns false if the file is a direct access ...
int handle() const override
Returns the native file handle for this file engine.
bool rename(const QString &newName) override
Requests that the file be renamed to newName in the file system.
qint64 size() const override
Returns the size of the file.
bool remove() override
Requests that the file is deleted from the file system.
bool close() override
Closes the file, returning true if successful; otherwise returns false.
QByteArray id() const override
\inmodule QtCore
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
void extension()
[6]
Definition dialogs.cpp:230
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum type
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLsizei len
GLuint GLenum option
unsigned int uint
Definition qtypes.h:29
long long qint64
Definition qtypes.h:55
QT_BEGIN_NAMESPACE typedef uchar * output
QFile file
[0]
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]
view create()