ckb-next
v0.2.8 at branch master
ckb-next driver for corsair devices
|
Provides ZIP archive navigation. More...
#include <src/ckb/quazip/quazipdir.h>
Public Member Functions | |
QuaZipDir (const QuaZipDir &that) | |
The copy constructor. More... | |
QuaZipDir (QuaZip *zip, const QString &dir=QString()) | |
Constructs a QuaZipDir instance pointing to the specified directory. More... | |
~QuaZipDir () | |
Destructor. More... | |
bool | operator== (const QuaZipDir &that) |
The assignment operator. More... | |
bool | operator!= (const QuaZipDir &that) |
operator!= More... | |
QuaZipDir & | operator= (const QuaZipDir &that) |
operator== More... | |
QString | operator[] (int pos) const |
Returns the name of the entry at the specified position. More... | |
QuaZip::CaseSensitivity | caseSensitivity () const |
Returns the current case sensitivity mode. More... | |
bool | cd (const QString &dirName) |
Changes the 'current' directory. More... | |
bool | cdUp () |
Goes up. More... | |
uint | count () const |
Returns the number of entries in the directory. More... | |
QString | dirName () const |
Returns the current directory name. More... | |
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. More... | |
QList< QuaZipFileInfo > | entryInfoList (QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entries in the directory. More... | |
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. More... | |
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. More... | |
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. More... | |
QStringList | entryList (QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) const |
Returns the list of the entry names in the directory. More... | |
bool | exists (const QString &fileName) const |
Returns true if the entry with the specified name exists. More... | |
bool | exists () const |
Return true if the directory pointed by this QuaZipDir exists. More... | |
QString | filePath (const QString &fileName) const |
Returns the full path to the specified file. More... | |
QDir::Filters | filter () |
Returns the default filter. More... | |
bool | isRoot () const |
Returns if the QuaZipDir points to the root of the archive. More... | |
QStringList | nameFilters () const |
Return the default name filter. More... | |
QString | path () const |
Returns the path to the current dir. More... | |
QString | relativeFilePath (const QString &fileName) const |
Returns the path to the specified file relative to the current dir. More... | |
void | setCaseSensitivity (QuaZip::CaseSensitivity caseSensitivity) |
Sets the default case sensitivity mode. More... | |
void | setFilter (QDir::Filters filters) |
Sets the default filter. More... | |
void | setNameFilters (const QStringList &nameFilters) |
Sets the default name filter. More... | |
void | setPath (const QString &path) |
Goes to the specified path. More... | |
void | setSorting (QDir::SortFlags sort) |
Sets the default sorting mode. More... | |
QDir::SortFlags | sorting () const |
Returns the default sorting mode. More... | |
Private Attributes | |
QSharedDataPointer < QuaZipDirPrivate > | d |
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.
Definition at line 54 of file quazipdir.h.
QuaZipDir::QuaZipDir | ( | const QuaZipDir & | that | ) |
Definition at line 50 of file quazipdir.cpp.
Referenced by exists().
QuaZipDir::QuaZipDir | ( | QuaZip * | zip, |
const QString & | dir = QString() |
||
) |
If dir is not specified, points to the root of the archive. The same happens if the dir is "/".
Definition at line 55 of file quazipdir.cpp.
References d.
QuaZipDir::~QuaZipDir | ( | ) |
Definition at line 62 of file quazipdir.cpp.
QuaZip::CaseSensitivity QuaZipDir::caseSensitivity | ( | ) | const |
Definition at line 82 of file quazipdir.cpp.
References d.
Referenced by setCaseSensitivity().
bool QuaZipDir::cd | ( | const QString & | dirName | ) |
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.
Definition at line 87 of file quazipdir.cpp.
References cd(), d, dirName(), exists(), isRoot(), and path().
Referenced by cd(), and cdUp().
bool QuaZipDir::cdUp | ( | ) |
Definition at line 150 of file quazipdir.cpp.
References cd().
uint QuaZipDir::count | ( | ) | const |
Definition at line 155 of file quazipdir.cpp.
References entryList().
QString QuaZipDir::dirName | ( | ) | const |
The name doesn't include the path.
Definition at line 160 of file quazipdir.cpp.
References d.
Referenced by cd().
QList< QuaZipFileInfo > QuaZipDir::entryInfoList | ( | const QStringList & | nameFilters, |
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
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. |
Definition at line 401 of file quazipdir.cpp.
References d.
Referenced by entryInfoList().
QList< QuaZipFileInfo > QuaZipDir::entryInfoList | ( | QDir::Filters | filters = QDir::NoFilter , |
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
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).
Definition at line 411 of file quazipdir.cpp.
References entryInfoList().
QList< QuaZipFileInfo64 > QuaZipDir::entryInfoList64 | ( | const QStringList & | nameFilters, |
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
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. |
Definition at line 417 of file quazipdir.cpp.
References d.
Referenced by entryInfoList64().
QList< QuaZipFileInfo64 > QuaZipDir::entryInfoList64 | ( | QDir::Filters | filters = QDir::NoFilter , |
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
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).
Definition at line 427 of file quazipdir.cpp.
References entryInfoList64().
QStringList QuaZipDir::entryList | ( | const QStringList & | nameFilters, |
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
The same as entryInfoList(nameFilters, filters, sort), but only returns entry names.
Definition at line 433 of file quazipdir.cpp.
References d.
Referenced by count(), entryList(), exists(), and operator[]().
QStringList QuaZipDir::entryList | ( | QDir::Filters | filters = QDir::NoFilter , |
QDir::SortFlags | sort = QDir::NoSort |
||
) | const |
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).
Definition at line 443 of file quazipdir.cpp.
References entryList().
bool QuaZipDir::exists | ( | const QString & | fileName | ) | const |
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.
Definition at line 449 of file quazipdir.cpp.
References QuaZip::convertCaseSensitivity(), d, entryList(), filePath(), and isRoot().
bool QuaZipDir::exists | ( | ) | const |
Definition at line 495 of file quazipdir.cpp.
References d, and QuaZipDir().
Referenced by cd().
QString QuaZipDir::filePath | ( | const QString & | fileName | ) | const |
Doesn't check if the file actually exists.
Definition at line 500 of file quazipdir.cpp.
References d.
Referenced by exists().
QDir::Filters QuaZipDir::filter | ( | ) |
bool QuaZipDir::isRoot | ( | ) | const |
Not that the root path is the empty string, not '/'.
Definition at line 510 of file quazipdir.cpp.
References d.
Referenced by cd(), and exists().
QStringList QuaZipDir::nameFilters | ( | ) | const |
Definition at line 515 of file quazipdir.cpp.
References d.
Referenced by setNameFilters().
|
inline |
true
if either this and that use different QuaZip instances or if they point to different directories. Definition at line 75 of file quazipdir.h.
true
if both this and that use the same QuaZip instance and point to the same directory. Definition at line 71 of file quazipdir.cpp.
References d.
bool QuaZipDir::operator== | ( | const QuaZipDir & | that | ) |
QString QuaZipDir::operator[] | ( | int | pos | ) | const |
Definition at line 77 of file quazipdir.cpp.
References entryList().
QString QuaZipDir::path | ( | ) | const |
The path never starts with '/', and the root path is an empty string.
Definition at line 520 of file quazipdir.cpp.
References d.
Referenced by cd(), and setPath().
QString QuaZipDir::relativeFilePath | ( | const QString & | fileName | ) | const |
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. |
Definition at line 525 of file quazipdir.cpp.
References d.
void QuaZipDir::setCaseSensitivity | ( | QuaZip::CaseSensitivity | caseSensitivity | ) |
Definition at line 530 of file quazipdir.cpp.
References caseSensitivity(), and d.
void QuaZipDir::setFilter | ( | QDir::Filters | filters | ) |
void QuaZipDir::setNameFilters | ( | const QStringList & | nameFilters | ) |
Definition at line 540 of file quazipdir.cpp.
References d, and nameFilters().
void QuaZipDir::setPath | ( | const QString & | 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).
Definition at line 545 of file quazipdir.cpp.
void QuaZipDir::setSorting | ( | QDir::SortFlags | sort | ) |
QDir::SortFlags QuaZipDir::sorting | ( | ) | const |
|
private |
Definition at line 56 of file quazipdir.h.
Referenced by caseSensitivity(), cd(), dirName(), entryInfoList(), entryInfoList64(), entryList(), exists(), filePath(), filter(), isRoot(), nameFilters(), operator=(), operator==(), path(), QuaZipDir(), relativeFilePath(), setCaseSensitivity(), setFilter(), setNameFilters(), setPath(), setSorting(), and sorting().