QuaZIP quazip-0-6-2
|
Provides ZIP archive navigation. More...
#include <quazipdir.h>
Public Member Functions | |
QuaZipDir (const QuaZipDir &that) | |
The copy constructor. | |
QuaZipDir (QuaZip *zip, const QString &dir=QString()) | |
Constructs a QuaZipDir instance pointing to the specified directory. | |
~QuaZipDir () | |
Destructor. | |
bool | operator== (const QuaZipDir &that) |
The assignment operator. | |
bool | operator!= (const QuaZipDir &that) |
operator!= | |
QuaZipDir & | operator= (const QuaZipDir &that) |
operator== | |
QString | operator[] (int pos) const |
Returns the name of the entry at the specified position. | |
QuaZip::CaseSensitivity | caseSensitivity () const |
Returns the current case sensitivity mode. | |
bool | cd (const QString &dirName) |
Changes the 'current' directory. | |
bool | cdUp () |
Goes up. | |
uint | count () const |
Returns the number of entries in the directory. | |
QString | dirName () const |
Returns the current directory name. | |
QList< QuaZipFileInfo > | entryInfoList (const QStringList &nameFilters, QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entries in the directory. | |
QList< QuaZipFileInfo > | entryInfoList (QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entries in the directory. | |
QList< QuaZipFileInfo64 > | entryInfoList64 (const QStringList &nameFilters, QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entries in the directory with zip64 support. | |
QList< QuaZipFileInfo64 > | entryInfoList64 (QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entries in the directory with zip64 support. | |
QStringList | entryList (const QStringList &nameFilters, QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entry names in the directory. | |
QStringList | entryList (QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entry names in the directory. | |
bool | exists (const QString &fileName) const |
Returns true if the entry with the specified name exists. | |
bool | exists () const |
Return true if the directory pointed by this QuaZipDir exists. | |
QString | filePath (const QString &fileName) const |
Returns the full path to the specified file. | |
QDir::Filters | filter () |
Returns the default filter. | |
bool | isRoot () const |
Returns if the QuaZipDir points to the root of the archive. | |
QStringList | nameFilters () const |
Return the default name filter. | |
QString | path () const |
Returns the path to the current dir. | |
QString | relativeFilePath (const QString &fileName) const |
Returns the path to the specified file relative to the current dir. | |
void | setCaseSensitivity (QuaZip::CaseSensitivity caseSensitivity) |
Sets the default case sensitivity mode. | |
void | setFilter (QDir::Filters filters) |
Sets the default filter. | |
void | setNameFilters (const QStringList &nameFilters) |
Sets the default name filter. | |
void | setPath (const QString &path) |
Goes to the specified path. | |
void | setSorting (QDir::SortFlags sort) |
Sets the default sorting mode. | |
QDir::SortFlags | sorting () const |
Returns the default sorting mode. |
Provides ZIP archive navigation.
This class is modelled after QDir, and is designed to provide similar features for ZIP archives.
The only significant difference from QDir is that the root path is not '/', but an empty string since that's how the file paths are stored in the archive. However, QuaZipDir understands the paths starting with '/'. It is important in a few places:
Note that since ZIP uses '/' on all platforms, the '\' separator is not supported.
QuaZipDir::QuaZipDir | ( | QuaZip * | zip, |
const QString & | dir = QString() |
||
) |
Constructs a QuaZipDir instance pointing to the specified directory.
If dir is not specified, points to the root of the archive. The same happens if the dir is "/".
bool QuaZipDir::operator!= | ( | const QuaZipDir & | that | ) | [inline] |
operator!=
true
if either this and that use different QuaZip instances or if they point to different directories. operator==
true
if both this and that use the same QuaZip instance and point to the same directory. bool QuaZipDir::cd | ( | const QString & | dirName | ) |
Changes the 'current' directory.
If the path starts with '/', it is interpreted as an absolute path from the root of the archive. Otherwise, it is interpreted as a path relative to the current directory as was set by the previous cd() or the constructor.
Note that the subsequent path() call will not return a path starting with '/' in all cases.
QString QuaZipDir::dirName | ( | ) | const |
QList< QuaZipFileInfo > QuaZipDir::entryInfoList | ( | const QStringList & | nameFilters, |
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
Returns the list of the entries in the directory.
nameFilters | The list of file patterns to list, uses the same syntax as QDir. |
filters | The entry type filters, only Files and Dirs are accepted. |
sort | Sorting mode. |
Referenced by entryInfoList().
QList< QuaZipFileInfo > QuaZipDir::entryInfoList | ( | QDir::Filters | filters = QDir::NoFilter , |
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
Returns the list of the entries in the directory.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The same as entryInfoList(QStringList(), filters, sort).
References entryInfoList().
QList< QuaZipFileInfo64 > QuaZipDir::entryInfoList64 | ( | const QStringList & | nameFilters, |
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
Returns the list of the entries in the directory with zip64 support.
nameFilters | The list of file patterns to list, uses the same syntax as QDir. |
filters | The entry type filters, only Files and Dirs are accepted. |
sort | Sorting mode. |
Referenced by entryInfoList64().
QList< QuaZipFileInfo64 > QuaZipDir::entryInfoList64 | ( | QDir::Filters | filters = QDir::NoFilter , |
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
Returns the list of the entries in the directory with zip64 support.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The same as entryInfoList64(QStringList(), filters, sort).
References entryInfoList64().
QStringList QuaZipDir::entryList | ( | const QStringList & | nameFilters, |
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
Returns the list of the entry names in the directory.
The same as entryInfoList(nameFilters, filters, sort), but only returns entry names.
Referenced by count(), entryList(), exists(), and operator[]().
QStringList QuaZipDir::entryList | ( | QDir::Filters | filters = QDir::NoFilter , |
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
Returns the list of the entry names in the directory.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The same as entryList(QStringList(), filters, sort).
References entryList().
bool QuaZipDir::exists | ( | const QString & | fileName | ) | const |
Returns true
if the entry with the specified name exists.
The ".." is considered to exist if the current directory is not root. The "." and "/" are considered to always exist. Paths starting with "/" are relative to the archive root, other paths are relative to the current dir.
References QuaZip::convertCaseSensitivity(), entryList(), filePath(), and isRoot().
QString QuaZipDir::filePath | ( | const QString & | fileName | ) | const |
Returns the full path to the specified file.
Doesn't check if the file actually exists.
Referenced by exists().
bool QuaZipDir::isRoot | ( | ) | const |
QString QuaZipDir::path | ( | ) | const |
QString QuaZipDir::relativeFilePath | ( | const QString & | fileName | ) | const |
Returns the path to the specified file relative to the current dir.
This function is mostly useless, provided only for the sake of completeness.
fileName | The path to the file, should start with "/" if relative to the archive root. |
void QuaZipDir::setPath | ( | const QString & | path | ) |
Goes to the specified path.
The difference from cd() is that this function never checks if the path actually exists and doesn't use relative paths, so it's possible to go to the root directory with setPath("").
Note that this function still chops the trailing and/or leading '/' and treats a single '/' as the root path (path() will still return an empty string).
References path().