[][src]Struct qt_core::QFile

#[repr(C)]pub struct QFile { /* fields omitted */ }

The QFile class provides an interface for reading from and writing to files.

C++ class: QFile.

C++ documentation:

The QFile class provides an interface for reading from and writing to files.

QFile is an I/O device for reading and writing text and binary files and resources. A QFile may be used by itself or, more conveniently, with a QTextStream or QDataStream.

The file name is usually passed in the constructor, but it can be set at any time using setFileName(). QFile expects the file separator to be '/' regardless of operating system. The use of other separators (e.g., '\') is not supported.

You can check for a file's existence using exists(), and remove a file using remove(). (More advanced file system related operations are provided by QFileInfo and QDir.)

The file is opened with open(), closed with close(), and flushed with flush(). Data is usually read and written using QDataStream or QTextStream, but you can also call the QIODevice-inherited functions read(), readLine(), readAll(), write(). QFile also inherits getChar(), putChar(), and ungetChar(), which work one character at a time.

The size of the file is returned by size(). You can get the current file position using pos(), or move to a new file position using seek(). If you've reached the end of the file, atEnd() returns true.

Methods

impl QFile[src]

pub unsafe fn copy_mut(&self, new_name: impl CastInto<Ref<QString>>) -> bool[src]

Copies the file currently specified by fileName() to a file called newName. Returns true if successful; otherwise returns false.

Calls C++ function: bool QFile::copy(const QString& newName).

C++ documentation:

Copies the file currently specified by fileName() to a file called newName. Returns true if successful; otherwise returns false.

Note that if a file with the name newName already exists, copy() returns false (i.e. QFile will not overwrite it).

The source file is closed before it is copied.

See also setFileName().

pub unsafe fn copy(
    file_name: impl CastInto<Ref<QString>>,
    new_name: impl CastInto<Ref<QString>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: static bool QFile::copy(const QString& fileName, const QString& newName).

C++ documentation:

This is an overloaded function.

Copies the file fileName to newName. Returns true if successful; otherwise returns false.

If a file with the name newName already exists, copy() returns false (i.e., QFile will not overwrite it).

See also rename().

pub unsafe fn decode_name_q_byte_array(
    local_file_name: impl CastInto<Ref<QByteArray>>
) -> CppBox<QString>
[src]

This does the reverse of QFile::encodeName() using localFileName.

Calls C++ function: static QString QFile::decodeName(const QByteArray& localFileName).

C++ documentation:

This does the reverse of QFile::encodeName() using localFileName.

See also encodeName().

pub unsafe fn decode_name_char(
    local_file_name: *const c_char
) -> CppBox<QString>
[src]

This is an overloaded function.

Calls C++ function: static QString QFile::decodeName(const char* localFileName).

C++ documentation:

This is an overloaded function.

Returns the Unicode version of the given localFileName. See encodeName() for details.

pub unsafe fn encode_name(
    file_name: impl CastInto<Ref<QString>>
) -> CppBox<QByteArray>
[src]

Converts fileName to the local 8-bit encoding determined by the user's locale. This is sufficient for file names that the user chooses. File names hard-coded into the application should only use 7-bit ASCII filename characters.

Calls C++ function: static QByteArray QFile::encodeName(const QString& fileName).

C++ documentation:

Converts fileName to the local 8-bit encoding determined by the user's locale. This is sufficient for file names that the user chooses. File names hard-coded into the application should only use 7-bit ASCII filename characters.

See also decodeName().

pub unsafe fn exists_0a(&self) -> bool[src]

This is an overloaded function.

Calls C++ function: bool QFile::exists() const.

C++ documentation:

This is an overloaded function.

Returns true if the file specified by fileName() exists; otherwise returns false.

See also fileName() and setFileName().

pub unsafe fn exists_1a(file_name: impl CastInto<Ref<QString>>) -> bool[src]

Returns true if the file specified by fileName exists; otherwise returns false.

Calls C++ function: static bool QFile::exists(const QString& fileName).

C++ documentation:

Returns true if the file specified by fileName exists; otherwise returns false.

Note: If fileName is a symlink that points to a non-existing file, false is returned.

pub unsafe fn file_name(&self) -> CppBox<QString>[src]

Reimplemented from QFileDevice::fileName().

Calls C++ function: virtual QString QFile::fileName() const.

C++ documentation:

Reimplemented from QFileDevice::fileName().

Returns the name set by setFileName() or to the QFile constructors.

See also setFileName() and QFileInfo::fileName().

Creates a link named linkName that points to the file currently specified by fileName(). What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.

Calls C++ function: bool QFile::link(const QString& newName).

C++ documentation:

Creates a link named linkName that points to the file currently specified by fileName(). What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.

This function will not overwrite an already existing entity in the file system; in this case, link() will return false and set error() to return RenameError.

Note: To create a valid link on Windows, linkName must have a .lnk file extension.

See also setFileName().

This is an overloaded function.

Calls C++ function: static bool QFile::link(const QString& oldname, const QString& newName).

C++ documentation:

This is an overloaded function.

Creates a link named linkName that points to the file fileName. What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.

See also link().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QFile::metaObject() const.

pub unsafe fn new() -> QBox<QFile>[src]

Constructs a QFile object.

Calls C++ function: [constructor] void QFile::QFile().

C++ documentation:

Constructs a QFile object.

pub unsafe fn from_q_string(name: impl CastInto<Ref<QString>>) -> QBox<QFile>[src]

Constructs a new file object to represent the file with the given name.

Calls C++ function: [constructor] void QFile::QFile(const QString& name).

C++ documentation:

Constructs a new file object to represent the file with the given name.

pub unsafe fn from_q_object(parent: impl CastInto<Ptr<QObject>>) -> QBox<QFile>[src]

Constructs a new file object with the given parent.

Calls C++ function: [constructor] void QFile::QFile(QObject* parent).

C++ documentation:

Constructs a new file object with the given parent.

pub unsafe fn from_q_string_q_object(
    name: impl CastInto<Ref<QString>>,
    parent: impl CastInto<Ptr<QObject>>
) -> QBox<QFile>
[src]

Constructs a new file object with the given parent to represent the file with the specified name.

Calls C++ function: [constructor] void QFile::QFile(const QString& name, QObject* parent).

C++ documentation:

Constructs a new file object with the given parent to represent the file with the specified name.

pub unsafe fn open_1a(&self, flags: QFlags<OpenModeFlag>) -> bool[src]

Reimplemented from QIODevice::open().

Calls C++ function: virtual bool QFile::open(QFlags<QIODevice::OpenModeFlag> flags).

C++ documentation:

Reimplemented from QIODevice::open().

Opens the file using OpenMode mode, returning true if successful; otherwise false.

The mode must be QIODevice::ReadOnly, QIODevice::WriteOnly, or QIODevice::ReadWrite. It may also have additional flags, such as QIODevice::Text and QIODevice::Unbuffered.

Note: In WriteOnly or ReadWrite mode, if the relevant file does not already exist, this function will try to create a new file before opening it.

See also QIODevice::OpenMode and setFileName().

pub unsafe fn open_3a(
    &self,
    fd: c_int,
    io_flags: QFlags<OpenModeFlag>,
    handle_flags: QFlags<FileHandleFlag>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QFile::open(int fd, QFlags<QIODevice::OpenModeFlag> ioFlags, QFlags<QFileDevice::FileHandleFlag> handleFlags = …).

C++ documentation:

This is an overloaded function.

Opens the existing file descriptor fd in the given mode. handleFlags may be used to specify additional options. Returns true if successful; otherwise returns false.

When a QFile is opened using this function, behaviour of close() is controlled by the AutoCloseHandle flag. If AutoCloseHandle is specified, and this function succeeds, then calling close() closes the adopted handle. Otherwise, close() does not actually close the file, but only flushes it.

The QFile that is opened using this function is automatically set to be in raw mode; this means that the file input/output functions are slow. If you run into performance issues, you should try to use one of the other open functions.

Warning: If fd is not a regular file, e.g, it is 0 (stdin), 1 (stdout), or 2 (stderr), you may not be able to seek(). In those cases, size() returns 0. See QIODevice::isSequential() for more information.

Warning: Since this function opens the file without specifying the file name, you cannot use this QFile with a QFileInfo.

See also close().

pub unsafe fn open_2a(&self, fd: c_int, io_flags: QFlags<OpenModeFlag>) -> bool[src]

This is an overloaded function.

Calls C++ function: bool QFile::open(int fd, QFlags<QIODevice::OpenModeFlag> ioFlags).

C++ documentation:

This is an overloaded function.

Opens the existing file descriptor fd in the given mode. handleFlags may be used to specify additional options. Returns true if successful; otherwise returns false.

When a QFile is opened using this function, behaviour of close() is controlled by the AutoCloseHandle flag. If AutoCloseHandle is specified, and this function succeeds, then calling close() closes the adopted handle. Otherwise, close() does not actually close the file, but only flushes it.

The QFile that is opened using this function is automatically set to be in raw mode; this means that the file input/output functions are slow. If you run into performance issues, you should try to use one of the other open functions.

Warning: If fd is not a regular file, e.g, it is 0 (stdin), 1 (stdout), or 2 (stderr), you may not be able to seek(). In those cases, size() returns 0. See QIODevice::isSequential() for more information.

Warning: Since this function opens the file without specifying the file name, you cannot use this QFile with a QFileInfo.

See also close().

pub unsafe fn permissions_0a(&self) -> QFlags<Permission>[src]

Reimplemented from QFileDevice::permissions().

Calls C++ function: virtual QFlags<QFileDevice::Permission> QFile::permissions() const.

C++ documentation:

Reimplemented from QFileDevice::permissions().

See also setPermissions().

pub unsafe fn permissions_1a(
    filename: impl CastInto<Ref<QString>>
) -> QFlags<Permission>
[src]

This is an overloaded function.

Calls C++ function: static QFlags<QFileDevice::Permission> QFile::permissions(const QString& filename).

C++ documentation:

This is an overloaded function.

Returns the complete OR-ed together combination of QFile::Permission for fileName.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QFile::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QFile::qt_metacast(const char* arg1).

Use symLinkTarget() instead.

Calls C++ function: QString QFile::readLink() const.

C++ documentation:

Use symLinkTarget() instead.

Use symLinkTarget() instead.

Calls C++ function: static QString QFile::readLink(const QString& fileName).

C++ documentation:

Use symLinkTarget() instead.

pub unsafe fn remove_mut(&self) -> bool[src]

Removes the file specified by fileName(). Returns true if successful; otherwise returns false.

Calls C++ function: bool QFile::remove().

C++ documentation:

Removes the file specified by fileName(). Returns true if successful; otherwise returns false.

The file is closed before it is removed.

See also setFileName().

pub unsafe fn remove(file_name: impl CastInto<Ref<QString>>) -> bool[src]

This is an overloaded function.

Calls C++ function: static bool QFile::remove(const QString& fileName).

C++ documentation:

This is an overloaded function.

Removes the file specified by the fileName given.

Returns true if successful; otherwise returns false.

See also remove().

pub unsafe fn rename_mut(&self, new_name: impl CastInto<Ref<QString>>) -> bool[src]

Renames the file currently specified by fileName() to newName. Returns true if successful; otherwise returns false.

Calls C++ function: bool QFile::rename(const QString& newName).

C++ documentation:

Renames the file currently specified by fileName() to newName. Returns true if successful; otherwise returns false.

If a file with the name newName already exists, rename() returns false (i.e., QFile will not overwrite it).

The file is closed before it is renamed.

If the rename operation fails, Qt will attempt to copy this file's contents to newName, and then remove this file, keeping only newName. If that copy operation fails or this file can't be removed, the destination file newName is removed to restore the old state.

See also setFileName().

pub unsafe fn rename(
    old_name: impl CastInto<Ref<QString>>,
    new_name: impl CastInto<Ref<QString>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: static bool QFile::rename(const QString& oldName, const QString& newName).

C++ documentation:

This is an overloaded function.

Renames the file oldName to newName. Returns true if successful; otherwise returns false.

If a file with the name newName already exists, rename() returns false (i.e., QFile will not overwrite it).

See also rename().

pub unsafe fn resize_mut(&self, sz: i64) -> bool[src]

Reimplemented from QFileDevice::resize().

Calls C++ function: virtual bool QFile::resize(qint64 sz).

C++ documentation:

Reimplemented from QFileDevice::resize().

pub unsafe fn resize(filename: impl CastInto<Ref<QString>>, sz: i64) -> bool[src]

This is an overloaded function.

Calls C++ function: static bool QFile::resize(const QString& filename, qint64 sz).

C++ documentation:

This is an overloaded function.

Sets fileName to size (in bytes) sz. Returns true if the resize succeeds; false otherwise. If sz is larger than fileName currently is the new bytes will be set to 0, if sz is smaller the file is simply truncated.

Warning: This function can fail if the file doesn't exist.

See also resize().

pub unsafe fn set_file_name(&self, name: impl CastInto<Ref<QString>>)[src]

Sets the name of the file. The name can have no path, a relative path, or an absolute path.

Calls C++ function: void QFile::setFileName(const QString& name).

C++ documentation:

Sets the name of the file. The name can have no path, a relative path, or an absolute path.

Do not call this function if the file has already been opened.

If the file name has no path or a relative path, the path used will be the application's current directory path at the time of the open() call.

Example:

QFile file; QDir::setCurrent("/tmp"); file.setFileName("readme.txt"); QDir::setCurrent("/home"); file.open(QIODevice::ReadOnly); // opens "/home/readme.txt" under Unix

Note that the directory separator "/" works for all operating systems supported by Qt.

See also fileName(), QFileInfo, and QDir.

pub unsafe fn set_permissions_mut(
    &self,
    permission_spec: QFlags<Permission>
) -> bool
[src]

Reimplemented from QFileDevice::setPermissions().

Calls C++ function: virtual bool QFile::setPermissions(QFlags<QFileDevice::Permission> permissionSpec).

C++ documentation:

Reimplemented from QFileDevice::setPermissions().

Sets the permissions for the file to the permissions specified. Returns true if successful, or false if the permissions cannot be modified.

Warning: This function does not manipulate ACLs, which may limit its effectiveness.

See also permissions() and setFileName().

pub unsafe fn set_permissions(
    filename: impl CastInto<Ref<QString>>,
    permission_spec: QFlags<Permission>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: static bool QFile::setPermissions(const QString& filename, QFlags<QFileDevice::Permission> permissionSpec).

C++ documentation:

This is an overloaded function.

Sets the permissions for fileName file to permissions.

pub unsafe fn size(&self) -> i64[src]

Reimplemented from QIODevice::size().

Calls C++ function: virtual qint64 QFile::size() const.

C++ documentation:

Reimplemented from QIODevice::size().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

This is an overloaded function.

Calls C++ function: QString QFile::symLinkTarget() const.

C++ documentation:

This is an overloaded function.

Returns the absolute path of the file or directory a symlink (or shortcut on Windows) points to, or a an empty string if the object isn't a symbolic link.

This name may not represent an existing file; it is only a string. QFile::exists() returns true if the symlink points to an existing file.

This function was introduced in Qt 4.2.

See also fileName() and setFileName().

Returns the absolute path of the file or directory referred to by the symlink (or shortcut on Windows) specified by fileName, or returns an empty string if the fileName does not correspond to a symbolic link.

Calls C++ function: static QString QFile::symLinkTarget(const QString& fileName).

C++ documentation:

Returns the absolute path of the file or directory referred to by the symlink (or shortcut on Windows) specified by fileName, or returns an empty string if the fileName does not correspond to a symbolic link.

This name may not represent an existing file; it is only a string. QFile::exists() returns true if the symlink points to an existing file.

This function was introduced in Qt 4.2.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QFile::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QFile::trUtf8(const char* s, const char* c, int n).

Methods from Deref<Target = QFileDevice>

pub unsafe fn at_end(&self) -> bool[src]

Reimplemented from QIODevice::atEnd().

Calls C++ function: virtual bool QFileDevice::atEnd() const.

C++ documentation:

Reimplemented from QIODevice::atEnd().

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 0. Therefore, you should not depend on atEnd() when reading data from such a file, but rather call read() until no more data can be read.

pub unsafe fn close(&self)[src]

Reimplemented from QIODevice::close().

Calls C++ function: virtual void QFileDevice::close().

C++ documentation:

Reimplemented from QIODevice::close().

Calls QFileDevice::flush() and closes the file. Errors from flush are ignored.

See also QIODevice::close().

pub unsafe fn error(&self) -> FileError[src]

Returns the file error status.

Calls C++ function: QFileDevice::FileError QFileDevice::error() const.

C++ documentation:

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.

See also unsetError().

pub unsafe fn file_name(&self) -> CppBox<QString>[src]

Returns the name of the file. The default implementation in QFileDevice returns a null string.

Calls C++ function: virtual QString QFileDevice::fileName() const.

C++ documentation:

Returns the name of the file. The default implementation in QFileDevice returns a null string.

pub unsafe fn file_time(&self, time: FileTime) -> CppBox<QDateTime>[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the file time specified by time. If the time cannot be determined return QDateTime() (an invalid date time).

Calls C++ function: QDateTime QFileDevice::fileTime(QFileDevice::FileTime time) const.

C++ documentation:

Returns the file time specified by time. If the time cannot be determined return QDateTime() (an invalid date time).

This function was introduced in Qt 5.10.

See also setFileTime(), FileTime, and QDateTime::isValid().

pub unsafe fn flush(&self) -> bool[src]

Flushes any buffered data to the file. Returns true if successful; otherwise returns false.

Calls C++ function: bool QFileDevice::flush().

C++ documentation:

Flushes any buffered data to the file. Returns true if successful; otherwise returns false.

pub unsafe fn handle(&self) -> c_int[src]

Returns the file handle of the file.

Calls C++ function: int QFileDevice::handle() const.

C++ documentation:

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.

See also QSocketNotifier.

pub unsafe fn is_sequential(&self) -> bool[src]

Reimplemented from QIODevice::isSequential().

Calls C++ function: virtual bool QFileDevice::isSequential() const.

C++ documentation:

Reimplemented from QIODevice::isSequential().

Returns true if the file can only be manipulated sequentially; otherwise returns false.

Most files support random-access, but some special files may not.

See also QIODevice::isSequential().

pub unsafe fn map_3a(
    &self,
    offset: i64,
    size: i64,
    flags: MemoryMapFlags
) -> *mut c_uchar
[src]

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.

Calls C++ function: unsigned char* QFileDevice::map(qint64 offset, qint64 size, QFileDevice::MemoryMapFlags flags = …).

C++ documentation:

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 0 if there is an error.

See also unmap().

pub unsafe fn map_2a(&self, offset: i64, size: i64) -> *mut c_uchar[src]

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.

Calls C++ function: unsigned char* QFileDevice::map(qint64 offset, qint64 size).

C++ documentation:

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 0 if there is an error.

See also unmap().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QFileDevice::metaObject() const.

pub unsafe fn permissions(&self) -> QFlags<Permission>[src]

Returns the complete OR-ed together combination of QFile::Permission for the file.

Calls C++ function: virtual QFlags<QFileDevice::Permission> QFileDevice::permissions() const.

C++ documentation:

Returns the complete OR-ed together combination of QFile::Permission for the file.

See also setPermissions().

pub unsafe fn pos(&self) -> i64[src]

Reimplemented from QIODevice::pos().

Calls C++ function: virtual qint64 QFileDevice::pos() const.

C++ documentation:

Reimplemented from QIODevice::pos().

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QFileDevice::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QFileDevice::qt_metacast(const char* arg1).

pub unsafe fn resize(&self, sz: i64) -> bool[src]

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.

Calls C++ function: virtual bool QFileDevice::resize(qint64 sz).

C++ documentation:

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.

Warning: This function can fail if the file doesn't exist.

See also size().

pub unsafe fn seek(&self, offset: i64) -> bool[src]

Reimplemented from QIODevice::seek().

Calls C++ function: virtual bool QFileDevice::seek(qint64 offset).

C++ documentation:

Reimplemented from QIODevice::seek().

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.

pub unsafe fn set_file_time(
    &self,
    new_date: impl CastInto<Ref<QDateTime>>,
    file_time: FileTime
) -> bool
[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Sets the file time specified by fileTime to newDate, returning true if successful; otherwise returns false.

Calls C++ function: bool QFileDevice::setFileTime(const QDateTime& newDate, QFileDevice::FileTime fileTime).

C++ documentation:

Sets the file time specified by fileTime to newDate, returning true if successful; otherwise returns false.

Note: The file must be open to use this function.

This function was introduced in Qt 5.10.

See also fileTime() and FileTime.

pub unsafe fn set_permissions(
    &self,
    permission_spec: QFlags<Permission>
) -> bool
[src]

Sets the permissions for the file to the permissions specified. Returns true if successful, or false if the permissions cannot be modified.

Calls C++ function: virtual bool QFileDevice::setPermissions(QFlags<QFileDevice::Permission> permissionSpec).

C++ documentation:

Sets the permissions for the file to the permissions specified. Returns true if successful, or false if the permissions cannot be modified.

Warning: This function does not manipulate ACLs, which may limit its effectiveness.

See also permissions().

pub unsafe fn size(&self) -> i64[src]

Reimplemented from QIODevice::size().

Calls C++ function: virtual qint64 QFileDevice::size() const.

C++ documentation:

Reimplemented from QIODevice::size().

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().

pub unsafe fn unmap(&self, address: *mut c_uchar) -> bool[src]

Unmaps the memory address.

Calls C++ function: bool QFileDevice::unmap(unsigned char* address).

C++ documentation:

Unmaps the memory address.

Returns true if the unmap succeeds; false otherwise.

See also map().

pub unsafe fn unset_error(&self)[src]

Sets the file's error to QFileDevice::NoError.

Calls C++ function: void QFileDevice::unsetError().

C++ documentation:

Sets the file's error to QFileDevice::NoError.

See also error().

Trait Implementations

impl CppDeletable for QFile[src]

unsafe fn delete(&self)[src]

Destroys the file object, closing it if necessary.

Calls C++ function: virtual [destructor] void QFile::~QFile().

C++ documentation:

Destroys the file object, closing it if necessary.

impl Deref for QFile[src]

type Target = QFileDevice

The resulting type after dereferencing.

fn deref(&self) -> &QFileDevice[src]

Calls C++ function: QFileDevice* static_cast<QFileDevice*>(QFile* ptr).

impl DynamicCast<QFile> for QFileDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QFileDevice>) -> Ptr<QFile>[src]

Calls C++ function: QFile* dynamic_cast<QFile*>(QFileDevice* ptr).

impl DynamicCast<QFile> for QIODevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QIODevice>) -> Ptr<QFile>[src]

Calls C++ function: QFile* dynamic_cast<QFile*>(QIODevice* ptr).

impl DynamicCast<QFile> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QFile>[src]

Calls C++ function: QFile* dynamic_cast<QFile*>(QObject* ptr).

impl DynamicCast<QTemporaryFile> for QFile[src]

unsafe fn dynamic_cast(ptr: Ptr<QFile>) -> Ptr<QTemporaryFile>[src]

Calls C++ function: QTemporaryFile* dynamic_cast<QTemporaryFile*>(QFile* ptr).

impl Size for QFile[src]

unsafe fn size(&self) -> usize[src]

Reimplemented from QIODevice::size().

Calls C++ function: virtual qint64 QFile::size() const.

C++ documentation:

Reimplemented from QIODevice::size().

impl StaticDowncast<QFile> for QFileDevice[src]

unsafe fn static_downcast(ptr: Ptr<QFileDevice>) -> Ptr<QFile>[src]

Calls C++ function: QFile* static_cast<QFile*>(QFileDevice* ptr).

impl StaticDowncast<QFile> for QIODevice[src]

unsafe fn static_downcast(ptr: Ptr<QIODevice>) -> Ptr<QFile>[src]

Calls C++ function: QFile* static_cast<QFile*>(QIODevice* ptr).

impl StaticDowncast<QFile> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QFile>[src]

Calls C++ function: QFile* static_cast<QFile*>(QObject* ptr).

impl StaticDowncast<QTemporaryFile> for QFile[src]

unsafe fn static_downcast(ptr: Ptr<QFile>) -> Ptr<QTemporaryFile>[src]

Calls C++ function: QTemporaryFile* static_cast<QTemporaryFile*>(QFile* ptr).

impl StaticUpcast<QFile> for QTemporaryFile[src]

unsafe fn static_upcast(ptr: Ptr<QTemporaryFile>) -> Ptr<QFile>[src]

Calls C++ function: QFile* static_cast<QFile*>(QTemporaryFile* ptr).

impl StaticUpcast<QFileDevice> for QFile[src]

unsafe fn static_upcast(ptr: Ptr<QFile>) -> Ptr<QFileDevice>[src]

Calls C++ function: QFileDevice* static_cast<QFileDevice*>(QFile* ptr).

impl StaticUpcast<QIODevice> for QFile[src]

unsafe fn static_upcast(ptr: Ptr<QFile>) -> Ptr<QIODevice>[src]

Calls C++ function: QIODevice* static_cast<QIODevice*>(QFile* ptr).

impl StaticUpcast<QObject> for QFile[src]

unsafe fn static_upcast(ptr: Ptr<QFile>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QFile* ptr).

Auto Trait Implementations

impl RefUnwindSafe for QFile

impl Send for QFile

impl Sync for QFile

impl Unpin for QFile

impl UnwindSafe for QFile

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.