QuaZIP: QuaZipDir Class Reference

QuaZIP quazip-0-5-1

- Main Page
- Related Pages
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
QuaZipDir Class Reference

Provides ZIP archive navigation. More...

`#include <quazipdir.h>`

List of all members.

## 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.
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.

## Detailed Description

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:

- In the cd() function.
- In the constructor.
- In the exists() function.

Note that since ZIP uses '/' on all platforms, the '\' separator is not supported.

## Constructor & Destructor Documentation

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 "/".

## Member Function Documentation

bool QuaZipDir::operator!= | ( | const QuaZipDir & | that | ) | `[inline]`

operator!=

Returns:
  `true` if either this and that use different QuaZip instances or if they point to different directories.

QuaZipDir & QuaZipDir::operator= | ( | const QuaZipDir & | that | ) |

operator==

Returns:
  `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.

References cd(), dirName(), exists(), isRoot(), and path().

Referenced by cd(), and cdUp().

QString QuaZipDir::dirName | ( |  | ) | const

Returns the current directory name.

The name doesn't include the path.

Referenced by cd().

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.

Parameters:

  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 (not supported yet).

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

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

Returns if the QuaZipDir points to the root of the archive.

Not that the root path is the empty string, not '/'.

Referenced by cd(), and exists().

QString QuaZipDir::path | ( |  | ) | const

Returns the path to the current dir.

The path never starts with '/', and the root path is an empty string.

Referenced by cd(), and setPath().

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

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

- quazip/quazipdir.h
- quazip/quazipdir.cpp