gio-qt 0.0.16
Loading...
Searching...
No Matches
DGioFile Class Reference
Inheritance diagram for DGioFile:
Collaboration diagram for DGioFile:

Signals

void createFileIteratorReady (QExplicitlySharedDataPointer< DGioFileIterator > iter)
void mountEnclosingVolumeReady (bool result, QString msg)

Public Member Functions

 DGioFile (Gio::File *gmmFilePtr, QObject *parent=nullptr)
QString basename () const
 Gets the base name (the last component of the path) of the DGioFile.
QString path () const
 Gets the local pathname of the DGioFile, if one exists.
QString uri () const
QExplicitlySharedDataPointer< DGioFileInfocreateFileInfo (QString attr="*", DGioFileQueryInfoFlags queryInfoFlags=FILE_QUERY_INFO_NONE, unsigned long timeout_msec=ULONG_MAX)
 Gets the requested information about the file.
QExplicitlySharedDataPointer< DGioFileInfocreateFileSystemInfo (QString attr="*")
 Obtains information about the filesystem the file is on.
QExplicitlySharedDataPointer< DGioFileIteratorcreateFileIterator (QString attr="*", DGioFileQueryInfoFlags queryInfoFlags=FILE_QUERY_INFO_NONE)
 Gets the requested information about the files in a directory.
void createFileIteratorAsync (QString attr="*", DGioFileQueryInfoFlags queryInfoFlags=FILE_QUERY_INFO_NONE)
void mountEnclosingVolume (DGioMountOperation *dgioMountOperation)
QExplicitlySharedDataPointer< DGioMountfindEnclosingMount ()

Static Public Member Functions

static DGioFilecreateFromPath (QString path, QObject *parent=nullptr)
 Create a DGioFile instance by given path.
static DGioFilecreateFromUri (QString uri, QObject *parent=nullptr)
 Create a DGioFile instance by given uri.
static DGioFilecreateFromCmdArg (QString uri, QObject *parent=nullptr)
 Create a DGioFile instance for a given argument from the command line.

Member Function Documentation

◆ basename()

QString DGioFile::basename ( ) const

Gets the base name (the last component of the path) of the DGioFile.

Wrapper of Gio::File::get_basename(), normally return filename with suffix (without path).

If called for the top level of a system (such as the filesystem root or a uri like sftp://host/) it will return a single directory separator (and on Windows, possibly a drive letter).

If you want to use filenames in a user interface you should use DGioFileInfo::displayName() instead.

◆ createFileInfo()

QExplicitlySharedDataPointer< DGioFileInfo > DGioFile::createFileInfo ( QString attr = "*",
DGioFileQueryInfoFlags queryInfoFlags = FILE_QUERY_INFO_NONE,
unsigned long timeout_msec = ULONG_MAX )

Gets the requested information about the file.

Wrapper of Gio::File::query_info(const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE).

Returns
the created file info object, or nullptr if create failed.

◆ createFileIterator()

QExplicitlySharedDataPointer< DGioFileIterator > DGioFile::createFileIterator ( QString attr = "*",
DGioFileQueryInfoFlags queryInfoFlags = FILE_QUERY_INFO_NONE )

Gets the requested information about the files in a directory.

Wrapper of Gio::File::enumerate_children()

The attribute value is a string that specifies the file attributes that should be gathered. It is not an error if its not possible to read a particular requested attribute from a file, it just won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user". The standard attributes are available as defines, like FILE_ATTRIBUTE_STANDARD_NAME.

Parameters
attrAn attribute query string.
queryInfoFlags
Returns
the created DGioFileIterator object, or nullptr if failed.

◆ createFileSystemInfo()

QExplicitlySharedDataPointer< DGioFileInfo > DGioFile::createFileSystemInfo ( QString attr = "*")

Obtains information about the filesystem the file is on.

Wrapper of Gio::File::query_filesystem_info("filesystem::*").

Returns
the created file system info object, or nullptr if create failed.

◆ createFromCmdArg()

DGioFile * DGioFile::createFromCmdArg ( QString arg,
QObject * parent = nullptr )
static

Create a DGioFile instance for a given argument from the command line.

The value of arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if arg points to a malformed path.

Parameters
argA string containing either a URI, a relative or absolute path.
Returns
the created DGioFile instance

◆ createFromPath()

DGioFile * DGioFile::createFromPath ( QString path,
QObject * parent = nullptr )
static

Create a DGioFile instance by given path.

This operation never fails since Gio::File::create_for_path never fails, but the returned object might not support any I/O operation if path is malformed.

Caller take the ownership of the created object, you can also provide a parent object.

Returns
the created DGioFile instance

◆ createFromUri()

DGioFile * DGioFile::createFromUri ( QString uri,
QObject * parent = nullptr )
static

Create a DGioFile instance by given uri.

This operation never fails since Gio::File::create_for_uri never fails, but the returned object might not support any I/O operation if uri is malformed.

Caller take the ownership of the created object, you can also provide a parent object.

Returns
the created DGioFile instance

◆ path()

QString DGioFile::path ( ) const

Gets the local pathname of the DGioFile, if one exists.

Wrapper of Gio::File::get_path(). For local file it gets the local pathname with filename included, for filesystem it gets the mount point path.

If valid, this is guaranteed to be an absolute, canonical path. It might contain symlinks.


The documentation for this class was generated from the following files: