5#include <QtCore/QLockFile>
6#include <QtCore/QSaveFile>
7#include <QtCore/QCryptographicHash>
37 return (l.
key ==
r.key);
64static constexpr quint32 QtVersion = (QT_VERSION_MAJOR << 16) | (QT_VERSION_MINOR << 8) | (QT_VERSION_PATCH);
70 ds >> *startPos >> *version >> qtver >>
fileId;
76 qWarning(
"qsbc file has an unsupported version");
80 qWarning(
"qsbc file is for a different Qt version");
95 if (startPos >= 0 && startPos < size && device->seek(startPos)) {
130 return h.result().toHex();
135 return generateSha(materialKey, featureSet);
140 return EntryMap(entries.keyBegin(), entries.keyEnd());
146 if (!entries.contains(
e)) {
147 entries.insert(
e, entryDesc);
177 qWarning(
"Could not create shader cache lock file '%s'",
200 for (
const Entry &
e : entryMap) {
207 entries.insert(
Entry(
e.key), entryDesc);
218 qWarning(
"Could not create shader cache lock file '%s'",
223#if QT_CONFIG(temporaryfile)
245#if QT_CONFIG(temporaryfile)
260 , devOwner(DeviceOwner::Extern)
277 qWarning(
"Open mode needs to have Truncate set for writing!");
281 qWarning(
"Open mode can't have Text mode set!");
285 }
else if (!device.
open(QIODevice::OpenMode(
mode))) {
309 if (devOwner == DeviceOwner::Self)
352 qWarning(
"Unable to open file for reading");
358static const char *
borderText() {
return "--------------------------------------------------------------------------------"; }
363 qDebug(
"Number of entries in collection: %zu\n",
size_t(entries.
size()));
365 qDebug(
"Qsbc version: %u", version);
366 for (
const auto &
e : std::as_const(entries)) {
379 qWarning(
"Extracting Qsb entry failed!");
IOBluetoothDevice * device
\inmodule QtCore\reentrant
void setVersion(int)
Sets the version number of the data serialization format to v, a value of the \l Version enum.
bool remove()
Removes the file specified by fileName().
\inmodule QtCore \reentrant
virtual bool open(QIODeviceBase::OpenMode mode)
Opens the device and sets its OpenMode to mode.
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from.
bool isOpen() const
Returns true if the device is open; otherwise returns false.
bool isReadable() const
Returns true if data can be read from the device; otherwise returns false.
QIODeviceBase::OpenMode openMode() const
Returns the mode in which the device has been opened; i.e.
virtual void close()
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success,...
const_iterator cend() const
const_iterator cbegin() const
void writeEndHeader(QDataStream &ds, qint64 startPos, quint8 version, quint64 magic)
virtual ~QQsbCollection()
bool readEndHeader(QDataStream &ds, qint64 *startPos, quint8 *version)
~QQsbIODeviceCollection()
Entry addEntry(const QByteArray &key, const EntryDesc &entryDesc) override
bool extractEntry(Entry entry, EntryDesc &entryDesc) override
QQsbIODeviceCollection(const QString &filePath)
EntryMap availableEntries() const override
Entry addEntry(const QByteArray &key, const EntryDesc &entryDesc) override
bool load(const QString &filename)
bool save(const QString &filename)
EntryMap availableEntries() const override
bool extractEntry(Entry entry, EntryDesc &entryDesc) override
const_iterator constEnd() const noexcept
const_iterator constFind(const T &value) const
bool contains(const T &value) const
const_iterator cbegin() const noexcept
iterator insert(const T &value)
static QShader fromSerialized(const QByteArray &data)
Creates a new QShader instance from the given data.
QByteArray serialized(SerializedFormatVersion version=SerializedFormatVersion::Latest) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
QMap< QString, QString > map
[6]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QTextStream & endl(QTextStream &stream)
Writes '\n' to the stream and flushes the stream.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static QByteArray fileId(HANDLE handle)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat GLfloat h
static const char * borderText()
static constexpr quint32 QtVersion
bool operator==(const QQsbCollection::Entry &l, const QQsbCollection::Entry &r)
static constexpr quint64 MagicaDS
static QString lockFileName(const QString &name)
QDataStream & operator>>(QDataStream &stream, QQsbCollection::Entry &entry)
QDataStream & operator<<(QDataStream &stream, const QQsbCollection::Entry &entry)
static constexpr qint64 HeaderSize
size_t qHash(const QQsbCollection::Entry &entry, size_t)
#define qPrintable(string)
QLatin1StringView QLatin1String
static const uchar magic[MagicLength]
unsigned long long quint64
QByteArray generateSha() const