QuaZip quazip-1-4
quazipdir.h
1#ifndef QUAZIP_QUAZIPDIR_H
2#define QUAZIP_QUAZIPDIR_H
3
4/*
5Copyright (C) 2005-2014 Sergey A. Tachenov
6
7This file is part of QuaZip.
8
9QuaZip is free software: you can redistribute it and/or modify
10it under the terms of the GNU Lesser General Public License as published by
11the Free Software Foundation, either version 2.1 of the License, or
12(at your option) any later version.
13
14QuaZip is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License
20along with QuaZip. If not, see <http://www.gnu.org/licenses/>.
21
22See COPYING file for the full LGPL text.
23
24Original ZIP package is copyrighted by Gilles Vollant and contributors,
25see quazip/(un)zip.h files for details. Basically it's the zlib license.
26*/
27
28class QuaZipDirPrivate;
29
30#include "quazip.h"
31#include "quazipfileinfo.h"
32#include <QtCore/QDir>
33#include <QtCore/QList>
34#include <QtCore/QSharedDataPointer>
35
37
54class QUAZIP_EXPORT QuaZipDir {
55private:
56 QSharedDataPointer<QuaZipDirPrivate> d;
57public:
59 QuaZipDir(const QuaZipDir &that);
61
65 QuaZipDir(QuaZip *zip, const QString &dir = QString());
69 bool operator==(const QuaZipDir &that);
71
75 inline bool operator!=(const QuaZipDir &that) {return !operator==(that);}
77
83 QString operator[](int pos) const;
87
96 bool cd(const QString &dirName);
98 bool cdUp();
100 uint count() const;
102
105 QString dirName() const;
107
114 QList<QuaZipFileInfo> entryInfoList(const QStringList &nameFilters,
115 QDir::Filters filters = QDir::NoFilter,
116 QDir::SortFlags sort = QDir::NoSort) const;
118
123 QList<QuaZipFileInfo> entryInfoList(QDir::Filters filters = QDir::NoFilter,
124 QDir::SortFlags sort = QDir::NoSort) const;
126
133 QList<QuaZipFileInfo64> entryInfoList64(const QStringList &nameFilters,
134 QDir::Filters filters = QDir::NoFilter,
135 QDir::SortFlags sort = QDir::NoSort) const;
137
142 QList<QuaZipFileInfo64> entryInfoList64(QDir::Filters filters = QDir::NoFilter,
143 QDir::SortFlags sort = QDir::NoSort) const;
145
149 QStringList entryList(const QStringList &nameFilters,
150 QDir::Filters filters = QDir::NoFilter,
151 QDir::SortFlags sort = QDir::NoSort) const;
153
158 QStringList entryList(QDir::Filters filters = QDir::NoFilter,
159 QDir::SortFlags sort = QDir::NoSort) const;
161
167 bool exists(const QString &fileName) const;
169 bool exists() const;
171
174 QString filePath(const QString &fileName) const;
176 QDir::Filters filter();
178
181 bool isRoot() const;
183 QStringList nameFilters() const;
185
189 QString path() const;
191
199 QString relativeFilePath(const QString &fileName) const;
203 void setFilter(QDir::Filters filters);
205 void setNameFilters(const QStringList &nameFilters);
207
216 void setPath(const QString &path);
218 void setSorting(QDir::SortFlags sort);
220 QDir::SortFlags sorting() const;
221};
222
223#endif // QUAZIP_QUAZIPDIR_H
QuaZip::CaseSensitivity caseSensitivity() const
Returns the current case sensitivity mode.
Definition quazipdir.cpp:71
QString dirName() const
Returns the current directory name.
Definition quazipdir.cpp:142
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.
Definition quazipdir.cpp:404
bool operator==(const QuaZipDir &that)
The assignment operator.
Definition quazipdir.cpp:61
bool cdUp()
Goes up.
Definition quazipdir.cpp:132
QuaZipDir(const QuaZipDir &that)
The copy constructor.
bool operator!=(const QuaZipDir &that)
operator!=
Definition quazipdir.h:75
void setFilter(QDir::Filters filters)
Sets the default filter.
Definition quazipdir.cpp:501
uint count() const
Returns the number of entries in the directory.
Definition quazipdir.cpp:137
QString relativeFilePath(const QString &fileName) const
Returns the path to the specified file relative to the current dir.
Definition quazipdir.cpp:491
QuaZipDir & operator=(const QuaZipDir &that)
operator==
QString operator[](int pos) const
Returns the name of the entry at the specified position.
Definition quazipdir.cpp:66
bool cd(const QString &dirName)
Changes the 'current' directory.
Definition quazipdir.cpp:76
void setNameFilters(const QStringList &nameFilters)
Sets the default name filter.
Definition quazipdir.cpp:506
QDir::Filters filter()
Returns the default filter.
Definition quazipdir.cpp:471
bool isRoot() const
Returns if the QuaZipDir points to the root of the archive.
Definition quazipdir.cpp:476
void setCaseSensitivity(QuaZip::CaseSensitivity caseSensitivity)
Sets the default case sensitivity mode.
Definition quazipdir.cpp:496
QStringList nameFilters() const
Return the default name filter.
Definition quazipdir.cpp:481
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.
Definition quazipdir.cpp:389
QDir::SortFlags sorting() const
Returns the default sorting mode.
Definition quazipdir.cpp:530
void setSorting(QDir::SortFlags sort)
Sets the default sorting mode.
Definition quazipdir.cpp:525
QString path() const
Returns the path to the current dir.
Definition quazipdir.cpp:486
bool exists(const QString &fileName) const
Returns true if the entry with the specified name exists.
Definition quazipdir.cpp:419
void setPath(const QString &path)
Goes to the specified path.
Definition quazipdir.cpp:511
~QuaZipDir()
Destructor.
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.
Definition quazipdir.cpp:374
QString filePath(const QString &fileName) const
Returns the full path to the specified file.
Definition quazipdir.cpp:466
ZIP archive.
Definition quazip.h:84
CaseSensitivity
Case sensitivity for the file names.
Definition quazip.h:114