4#include "qplatformdefs.h"
10#define tr(X) QString::fromLatin1(X)
15#ifndef QFILE_WRITEBUFFER_SIZE
16#define QFILE_WRITEBUFFER_SIZE 16384
31 fileEngine = std::make_unique<QFSFileEngine>();
223 return d->fileEngine &&
d->fileEngine->isSequential();
241 if (!
isOpen() || !
d->fileEngine)
244 return d->fileEngine->handle();
263 if (!
d->fileEngine) {
264 qWarning(
"QFileDevice::flush: No file engine. Is IODevice open?");
268 if (!
d->writeBuffer.isEmpty()) {
270 qint64 written =
d->fileEngine->write(
d->writeBuffer.readPointer(),
size);
272 d->writeBuffer.free(written);
273 if (written !=
size) {
277 d->setError(err,
d->fileEngine->errorString());
282 if (!
d->fileEngine->flush()) {
286 d->setError(err,
d->fileEngine->errorString());
302 bool flushed =
flush();
306 d->lastWasWrite =
false;
307 d->writeBuffer.clear();
313 if (
d->fileEngine->close() && flushed)
316 d->setError(
d->fileEngine->error(),
d->fileEngine->errorString());
341 if (!
d->isBufferEmpty())
347 if (!
d->ensureFlushed())
354 return d->fileEngine->atEnd();
359 if (
pos() <
d->cachedSize)
385 qWarning(
"QFileDevice::seek: IODevice is not open");
389 if (!
d->ensureFlushed())
396 d->setError(err,
d->fileEngine->errorString());
409 if (!
d->ensureFlushed())
414 read =
d->fileEngine->readLine(
data, maxlen);
438 if (!
d->ensureFlushed())
446 d->setError(err,
d->fileEngine->errorString());
479 qWarning(
"QIODevice::putChar: Closed device");
481 qWarning(
"QIODevice::putChar: ReadOnly device");
521 d->lastWasWrite =
true;
525 if (buffered && (
d->writeBuffer.size() +
len) >
d->writeBufferChunkSize) {
532 if (!buffered ||
len >
d->writeBufferChunkSize) {
538 d->setError(err,
d->fileEngine->errorString());
584 if (!
d->ensureFlushed())
586 d->cachedSize =
d->engine()->size();
587 return d->cachedSize;
603 if (!
d->ensureFlushed())
606 if (
isOpen() &&
d->fileEngine->pos() > sz)
608 if (
d->fileEngine->setSize(sz)) {
628 return QFile::Permissions::fromInt(perms.toInt());
693 d->setError(
d->fileEngine->error(),
d->fileEngine->errorString());
712 bool success =
d->fileEngine->unmap(
address);
714 d->setError(
d->fileEngine->error(),
d->fileEngine->errorString());
717 d->setError(
PermissionsError,
tr(
"No file engine available or engine does not support UnMapExtension"));
783 d->setError(
d->fileEngine->error(),
d->fileEngine->errorString());
794#include "moc_qfiledevice.cpp"
\inmodule QtCore \reentrant
FileTime
These are used by the fileTime() function.
\inmodule QtCore\reentrant
bool putCharHelper(char c) override
std::unique_ptr< QAbstractFileEngine > fileEngine
virtual QAbstractFileEngine * engine() const
void setError(QFileDevice::FileError err)
QFileDevice::FileError error
qint64 readLineData(char *data, qint64 maxlen) override
\reimp
qint64 readData(char *data, qint64 maxlen) override
\reimp
bool flush()
Flushes any buffered data to the file.
~QFileDevice()
Destroys the file device, closing it if necessary.
QDateTime fileTime(QFileDevice::FileTime time) const
qint64 pos() const override
\reimp
bool seek(qint64 offset) override
For random-access devices, this function sets the current position to pos, returning true on success,...
qint64 size() const override
Returns the size of the file.
void unsetError()
Sets the file's error to QFileDevice::NoError.
virtual bool resize(qint64 sz)
Sets the file size (in bytes) sz.
qint64 writeData(const char *data, qint64 len) override
\reimp
uchar * map(qint64 offset, qint64 size, MemoryMapFlags flags=NoOptions)
Maps size bytes of the file into memory starting at offset.
int handle() const
Returns the file handle of the file.
bool setFileTime(const QDateTime &newDate, QFileDevice::FileTime fileTime)
bool atEnd() const override
Returns true if the end of the file has been reached; otherwise returns false.
FileError error() const
Returns the file error status.
bool isSequential() const override
Returns true if the file can only be manipulated sequentially; otherwise returns false.
virtual QString fileName() const
Returns the name of the file.
FileError
This enum describes the errors that may be returned by the error() function.
virtual bool setPermissions(Permissions permissionSpec)
Sets the permissions for the file to the permissions specified.
bool unmap(uchar *address)
Unmaps the memory address.
void close() override
Calls QFileDevice::flush() and closes the file.
virtual Permissions permissions() const
Returns the complete OR-ed together combination of QFile::Permission for the file.
QIODevice::OpenMode openMode
bool isSequential() const
virtual bool putCharHelper(char c)
\inmodule QtCore \reentrant
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.
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
virtual qint64 readLineData(char *data, qint64 maxlen)
Reads up to maxSize characters into data and returns the number of characters read.
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,...
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
\macro QT_RESTRICTED_CAST_FROM_ASCII
void clear()
Clears the contents of the string and makes it null.
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
#define QFILE_WRITEBUFFER_SIZE
static QAbstractFileEngine::FileTime FileDeviceTimeToAbstractFileEngineTime(QFileDevice::FileTime time)
Q_DECL_COLD_FUNCTION Q_CORE_EXPORT QString qt_error_string(int errorCode=-1)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLuint GLuint64EXT address
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent