![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qfiledevice.h>
Public Types | |
enum | FileError { NoError = 0 , ReadError = 1 , WriteError = 2 , FatalError = 3 , ResourceError = 4 , OpenError = 5 , AbortError = 6 , TimeOutError = 7 , UnspecifiedError = 8 , RemoveError = 9 , RenameError = 10 , PositionError = 11 , ResizeError = 12 , PermissionsError = 13 , CopyError = 14 } |
This enum describes the errors that may be returned by the error() function. More... | |
enum | FileTime { FileAccessTime , FileBirthTime , FileMetadataChangeTime , FileModificationTime } |
enum | Permission { ReadOwner = 0x4000 , WriteOwner = 0x2000 , ExeOwner = 0x1000 , ReadUser = 0x0400 , WriteUser = 0x0200 , ExeUser = 0x0100 , ReadGroup = 0x0040 , WriteGroup = 0x0020 , ExeGroup = 0x0010 , ReadOther = 0x0004 , WriteOther = 0x0002 , ExeOther = 0x0001 } |
This enum is used by the permission() function to report the permissions and ownership of a file. More... | |
enum | FileHandleFlag { AutoCloseHandle = 0x0001 , DontCloseHandle = 0 } |
This enum is used when opening a file to specify additional options which only apply to files and not to a generic QIODevice. More... | |
enum | MemoryMapFlag { NoOptions = 0 , MapPrivateOption = 0x0001 } |
![]() | |
enum | OpenModeFlag { NotOpen = 0x0000 , ReadOnly = 0x0001 , WriteOnly = 0x0002 , ReadWrite = ReadOnly | WriteOnly , Append = 0x0004 , Truncate = 0x0008 , Text = 0x0010 , Unbuffered = 0x0020 , NewOnly = 0x0040 , ExistingOnly = 0x0080 } |
This enum is used with QIODevice::open() to describe the mode in which a device is opened. More... | |
Public Member Functions | |
~QFileDevice () | |
Destroys the file device, closing it if necessary. | |
FileError | error () const |
Returns the file error status. | |
void | unsetError () |
Sets the file's error to QFileDevice::NoError. | |
void | close () override |
Calls QFileDevice::flush() and closes the file. | |
bool | isSequential () const override |
Returns true if the file can only be manipulated sequentially; otherwise returns false . | |
int | handle () const |
Returns the file handle of the file. | |
virtual QString | fileName () const |
Returns the name of the file. | |
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, or false if an error occurred. | |
bool | atEnd () const override |
Returns true if the end of the file has been reached; otherwise returns false. | |
bool | flush () |
Flushes any buffered data to the file. | |
qint64 | size () const override |
Returns the size of the file. | |
virtual bool | resize (qint64 sz) |
Sets the file size (in bytes) sz. | |
virtual Permissions | permissions () const |
Returns the complete OR-ed together combination of QFile::Permission for the file. | |
virtual bool | setPermissions (Permissions permissionSpec) |
Sets the permissions for the file to the permissions specified. | |
uchar * | map (qint64 offset, qint64 size, MemoryMapFlags flags=NoOptions) |
Maps size bytes of the file into memory starting at offset. | |
bool | unmap (uchar *address) |
Unmaps the memory address. | |
QDateTime | fileTime (QFileDevice::FileTime time) const |
bool | setFileTime (const QDateTime &newDate, QFileDevice::FileTime fileTime) |
![]() | |
QIODevice () | |
Constructs a QIODevice object. | |
QIODevice (QObject *parent) | |
Constructs a QIODevice object with the given parent. | |
virtual | ~QIODevice () |
The destructor is virtual, and QIODevice is an abstract base class. | |
QIODeviceBase::OpenMode | openMode () const |
Returns the mode in which the device has been opened; i.e. | |
void | setTextModeEnabled (bool enabled) |
If enabled is true, this function sets the \l Text flag on the device; otherwise the \l Text flag is removed. | |
bool | isTextModeEnabled () const |
Returns true if the \l Text flag is enabled; otherwise returns false . | |
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. | |
bool | isWritable () const |
Returns true if data can be written to the device; otherwise returns false. | |
int | readChannelCount () const |
int | writeChannelCount () const |
int | currentReadChannel () const |
void | setCurrentReadChannel (int channel) |
int | currentWriteChannel () const |
void | setCurrentWriteChannel (int channel) |
virtual bool | open (QIODeviceBase::OpenMode mode) |
Opens the device and sets its OpenMode to mode. | |
virtual bool | reset () |
Seeks to the start of input for random-access devices. | |
virtual qint64 | bytesAvailable () const |
Returns the number of bytes that are available for reading. | |
virtual qint64 | bytesToWrite () const |
For buffered devices, this function returns the number of bytes waiting to be written. | |
qint64 | read (char *data, qint64 maxlen) |
Reads at most maxSize bytes from the device into data, and returns the number of bytes read. | |
QByteArray | read (qint64 maxlen) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Reads at most maxSize bytes from the device, and returns the data read as a QByteArray. | |
QByteArray | readAll () |
Reads all remaining data from the device, and returns it as a byte array. | |
qint64 | readLine (char *data, qint64 maxlen) |
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes, stores the characters in data, and returns the number of bytes read. | |
QByteArray | readLine (qint64 maxlen=0) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Reads a line from the device, but no more than maxSize characters, and returns the result as a byte array. | |
bool | readLineInto (QByteArray *result, qint64 maxlen=0) |
QByteArrayView | readLineInto (QSpan< char > buffer) |
QByteArrayView | readLineInto (QSpan< uchar > buffer) |
QByteArrayView | readLineInto (QSpan< std::byte > buffer) |
Reads a line from this device into buffer, and returns the subset of buffer that contains the data read. | |
virtual bool | canReadLine () const |
Returns true if a complete line of data can be read from the device; otherwise returns false . | |
void | startTransaction () |
void | commitTransaction () |
void | rollbackTransaction () |
bool | isTransactionStarted () const |
qint64 | write (const char *data, qint64 len) |
Writes at most maxSize bytes of data from data to the device. | |
qint64 | write (const char *data) |
qint64 | write (const QByteArray &data) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Writes the content of data to the device. | |
qint64 | peek (char *data, qint64 maxlen) |
QByteArray | peek (qint64 maxlen) |
qint64 | skip (qint64 maxSize) |
virtual bool | waitForReadyRead (int msecs) |
Blocks until new data is available for reading and the readyRead() signal has been emitted, or until msecs milliseconds have passed. | |
virtual bool | waitForBytesWritten (int msecs) |
For buffered devices, this function waits until a payload of buffered written data has been written to the device and the bytesWritten() signal has been emitted, or until msecs milliseconds have passed. | |
void | ungetChar (char c) |
Puts the character c back into the device, and decrements the current position unless the position is 0. | |
bool | putChar (char c) |
Writes the character c to the device. | |
bool | getChar (char *c) |
Reads one character from the device and stores it in c. | |
QString | errorString () const |
Returns a human-readable description of the last device error that occurred. | |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
bool | moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL) |
Changes the thread affinity for this object and its children and returns true on success. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
void | killTimer (Qt::TimerId id) |
template<typename T> | |
T | findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T> | |
QList< T > | findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T> | |
T | findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T> | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
Protected Member Functions | |
QFileDevice () | |
\macro QT_USE_NODISCARD_FILE_OPEN \macro QT_NO_USE_NODISCARD_FILE_OPEN | |
QFileDevice (QObject *parent) | |
QFileDevice (QFileDevicePrivate &dd, QObject *parent=nullptr) | |
qint64 | readData (char *data, qint64 maxlen) override |
\reimp | |
qint64 | writeData (const char *data, qint64 len) override |
\reimp | |
qint64 | readLineData (char *data, qint64 maxlen) override |
\reimp | |
![]() | |
QIODevice (QIODevicePrivate &dd, QObject *parent=nullptr) | |
virtual qint64 | skipData (qint64 maxSize) |
void | setOpenMode (QIODeviceBase::OpenMode openMode) |
Sets the OpenMode of the device to openMode. | |
void | setErrorString (const QString &errorString) |
Sets the human readable description of the last device error that occurred to str. | |
![]() | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
![]() | |
~QIODeviceBase ()=default | |
Additional Inherited Members | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
void | readyRead () |
This signal is emitted once every time new data is available for reading from the device's current read channel. | |
void | channelReadyRead (int channel) |
void | bytesWritten (qint64 bytes) |
This signal is emitted every time a payload of data has been written to the device's current write channel. | |
void | channelBytesWritten (int channel, qint64 bytes) |
void | aboutToClose () |
This signal is emitted when the device is about to close. | |
void | readChannelFinished () |
![]() | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1, typename Func2> | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1, typename Func2> | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1, typename Func2> | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1> | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
QString | objectName |
the name of this object | |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
\inmodule QtCore
The QFileDevice class provides an interface for reading from and writing to open files.
\reentrant
QFileDevice is the base class for I/O devices that can read and write text and binary files and \l{The Qt Resource System}{resources}. QFile offers the main functionality, QFileDevice serves as a base class for sharing functionality with other file devices such as QSaveFile, by providing all the operations that can be done on files that have been opened by QFile or QSaveFile.
Definition at line 31 of file qfiledevice.h.
This enum describes the errors that may be returned by the error() function.
\value NoError No error occurred. \value ReadError An error occurred when reading from the file. \value WriteError An error occurred when writing to the file. \value FatalError A fatal error occurred. \value ResourceError Out of resources (e.g., too many open files, out of memory, etc.) \value OpenError The file could not be opened. \value AbortError The operation was aborted. \value TimeOutError A timeout occurred. \value UnspecifiedError An unspecified error occurred. \value RemoveError The file could not be removed. \value RenameError The file could not be renamed. \value PositionError The position in the file could not be changed. \value ResizeError The file could not be resized. \value PermissionsError The file could not be accessed. \value CopyError The file could not be copied.
Enumerator | |
---|---|
NoError | |
ReadError | |
WriteError | |
FatalError | |
ResourceError | |
OpenError | |
AbortError | |
TimeOutError | |
UnspecifiedError | |
RemoveError | |
RenameError | |
PositionError | |
ResizeError | |
PermissionsError | |
CopyError |
Definition at line 39 of file qfiledevice.h.
This enum is used when opening a file to specify additional options which only apply to files and not to a generic QIODevice.
\value AutoCloseHandle The file handle passed into open() should be closed by close(), the default behavior is that close just flushes the file and the application is responsible for closing the file handle. When opening a file by name, this flag is ignored as Qt always owns the file handle and must close it. \value DontCloseHandle If not explicitly closed, the underlying file handle is left open when the QFile object is destroyed.
Enumerator | |
---|---|
AutoCloseHandle | |
DontCloseHandle |
Definition at line 72 of file qfiledevice.h.
This enum is used by the fileTime() and setFileTime() functions.
\value FileAccessTime When the file was most recently accessed (e.g. read or written to). \value FileBirthTime When the file was created (may not be not supported on UNIX). \value FileMetadataChangeTime When the file's metadata was last changed. \value FileModificationTime When the file was most recently modified.
Enumerator | |
---|---|
FileAccessTime | |
FileBirthTime | |
FileMetadataChangeTime | |
FileModificationTime |
Definition at line 57 of file qfiledevice.h.
This enum describes special options that may be used by the map() function.
\value NoOptions No options. \value MapPrivateOption The mapped memory will be private, so any modifications will not be visible to other processes and will not be written to disk. Any such modifications will be lost when the memory is unmapped. It is unspecified whether modifications made to the file made after the mapping is created will be visible through the mapped memory. This enum value was introduced in Qt 5.4.
Enumerator | |
---|---|
NoOptions | |
MapPrivateOption |
Definition at line 101 of file qfiledevice.h.
This enum is used by the permission() function to report the permissions and ownership of a file.
The values may be OR-ed together to test multiple permissions and ownership values.
\value ReadOwner The file is readable by the owner of the file. \value WriteOwner The file is writable by the owner of the file. \value ExeOwner The file is executable by the owner of the file. \value ReadUser The file is readable by the user. \value WriteUser The file is writable by the user. \value ExeUser The file is executable by the user. \value ReadGroup The file is readable by the group. \value WriteGroup The file is writable by the group. \value ExeGroup The file is executable by the group. \value ReadOther The file is readable by others. \value WriteOther The file is writable by others. \value ExeOther The file is executable by others.
Permission checking is then turned on and off by incrementing and decrementing qt_ntfs_permission_lookup
by 1.
qt_ntfs_permission_lookup
before any threads other than the main thread have started or after every thread other than the main thread has ended.qt_ntfs_permission_lookup
is deprecated. Please use the following alternatives.The safe and easy way to manage permission checks is to use the RAII class QNtfsPermissionCheckGuard
.
If you need more fine-grained control, it is possible to manage the permission with the following functions instead:
Enumerator | |
---|---|
ReadOwner | |
WriteOwner | |
ExeOwner | |
ReadUser | |
WriteUser | |
ExeUser | |
ReadGroup | |
WriteGroup | |
ExeGroup | |
ReadOther | |
WriteOther | |
ExeOther |
Definition at line 64 of file qfiledevice.h.
QFileDevice::~QFileDevice | ( | ) |
Destroys the file device, closing it if necessary.
Definition at line 236 of file qfiledevice.cpp.
|
protected |
\macro QT_USE_NODISCARD_FILE_OPEN \macro QT_NO_USE_NODISCARD_FILE_OPEN
File-related I/O classes (such as QFile, QSaveFile, QTemporaryFile) have an {open()} method to open the file they act upon. It is important to check the return value of the call to
{open()} before proceeding with reading or writing data into the file.
For this reason, starting with Qt 6.8, some overloads of {open()} have been marked with the
{[[nodiscard]]} attribute. Since this change may raise warnings in existing codebases, user code can opt-in or opt-out from having the attribute applied by defining certain macros:
\list
{QT_USE_NODISCARD_FILE_OPEN} macro is defined, overloads of
{open()} are marked as
{[[nodiscard]]}.
{QT_NO_USE_NODISCARD_FILE_OPEN} is defined, the overloads of
{open()} are {not} marked as
{[[nodiscard]]}. Definition at line 213 of file qfiledevice.cpp.
|
explicitprotected |
Definition at line 220 of file qfiledevice.cpp.
|
protected |
Definition at line 227 of file qfiledevice.cpp.
|
overridevirtual |
Returns true
if the end of the file has been reached; otherwise returns false.
For regular empty files on Unix (e.g. those in /proc
), this function returns true
, since the file system reports that the size of such a file is
Reimplemented from QIODevice.
Definition at line 366 of file qfiledevice.cpp.
|
overridevirtual |
Calls QFileDevice::flush() and closes the file.
Errors from flush are ignored.
Reimplemented from QIODevice.
Definition at line 326 of file qfiledevice.cpp.
QFileDevice::FileError QFileDevice::error | ( | ) | const |
Returns the file error status.
The I/O device status returns an error code. For example, if open() returns false
, or a read/write operation returns -1, this function can be called to find out the reason why the operation failed.
Definition at line 587 of file qfiledevice.cpp.
|
virtual |
Returns the name of the file.
The default implementation in QFileDevice returns a null string.
Reimplemented in QFile.
Definition at line 280 of file qfiledevice.cpp.
QDateTime QFileDevice::fileTime | ( | QFileDevice::FileTime | time | ) | const |
Definition at line 775 of file qfiledevice.cpp.
bool QFileDevice::flush | ( | ) |
Flushes any buffered data to the file.
Returns true
if successful; otherwise returns false
.
Definition at line 289 of file qfiledevice.cpp.
Referenced by testing.tools.encode_pdf_filter._SinkPdfStream::close().
int QFileDevice::handle | ( | ) | const |
Returns the file handle of the file.
This is a small positive integer, suitable for use with C library functions such as fdopen()
and fcntl()
. On systems that use file descriptors for sockets (i.e. Unix systems, but not Windows) the handle can be used with QSocketNotifier as well.
If the file is not open, or there is an error, handle() returns -1.
Definition at line 267 of file qfiledevice.cpp.
|
overridevirtual |
Returns true
if the file can only be manipulated sequentially; otherwise returns false
.
Most files support random-access, but some special files may not.
Reimplemented from QIODevice.
Definition at line 249 of file qfiledevice.cpp.
Maps size bytes of the file into memory starting at offset.
A file should be open for a map to succeed but the file does not need to stay open after the memory has been mapped. When the QFile is destroyed or a new file is opened with this object, any maps that have not been unmapped will automatically be unmapped.
The mapping will have the same open mode as the file (read and/or write), except when using MapPrivateOption, in which case it is always possible to write to the mapped memory.
Any mapping options can be passed through flags.
Returns a pointer to the memory or \nullptr if there is an error.
Definition at line 715 of file qfiledevice.cpp.
|
virtual |
Returns the complete OR-ed together combination of QFile::Permission for the file.
Reimplemented in QFile.
Definition at line 654 of file qfiledevice.cpp.
|
overridevirtual |
|
virtual |
Sets the file size (in bytes) sz.
Returns true
if the resize succeeds; false otherwise. If sz is larger than the file currently is, the new bytes will be set to 0; if sz is smaller, the file is simply truncated.
Reimplemented in QFile.
Definition at line 630 of file qfiledevice.cpp.
|
overridevirtual |
For random-access devices, this function sets the current position to pos, returning true on success, or false if an error occurred.
For sequential devices, the default behavior is to do nothing and return false.
Seeking beyond the end of a file: If the position is beyond the end of a file, then seek() will not immediately extend the file. If a write is performed at this position, then the file will be extended. The content of the file between the previous end of file and the newly written data is UNDEFINED and varies between platforms and file systems.
Reimplemented from QIODevice.
Definition at line 411 of file qfiledevice.cpp.
bool QFileDevice::setFileTime | ( | const QDateTime & | newDate, |
QFileDevice::FileTime | fileTime ) |
Definition at line 794 of file qfiledevice.cpp.
|
virtual |
Sets the permissions for the file to the permissions specified.
Returns true
if successful, or false
if the permissions cannot be modified.
Reimplemented in QFile.
Definition at line 671 of file qfiledevice.cpp.
|
overridevirtual |
Returns the size of the file.
For regular empty files on Unix (e.g. those in /proc
), this function returns 0; the contents of such a file are generated on demand in response to you calling read().
Reimplemented from QIODevice.
Definition at line 611 of file qfiledevice.cpp.
bool QFileDevice::unmap | ( | uchar * | address | ) |
Unmaps the memory address.
Returns true
if the unmap succeeds; false otherwise.
Definition at line 736 of file qfiledevice.cpp.
void QFileDevice::unsetError | ( | ) |
Sets the file's error to QFileDevice::NoError.
Definition at line 598 of file qfiledevice.cpp.