From 23b7654f0d80cc56990cef19f6d4b06b209120b5 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 30 Apr 2013 15:49:12 +0200 Subject: Rename and document functions to be more clear what they do. Change-Id: Ic31df64c4eff8aa19b58d4dcd26b7f99c9e90d3c Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- src/libs/installer/lib7z_facade.cpp | 11 ++++++----- src/libs/installer/lib7z_facade.h | 37 ++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 18 deletions(-) (limited to 'src/libs') diff --git a/src/libs/installer/lib7z_facade.cpp b/src/libs/installer/lib7z_facade.cpp index c89ce35e1..624c08b54 100644 --- a/src/libs/installer/lib7z_facade.cpp +++ b/src/libs/installer/lib7z_facade.cpp @@ -1402,7 +1402,8 @@ void Lib7z::createArchive(QIODevice* archive, const QStringList &sourcePaths, Up } } -void Lib7z::extractArchive(QIODevice* archive, const File& item, QIODevice* target, ExtractCallback* callback) +void Lib7z::extractFileFromArchive(QIODevice* archive, const File& item, QIODevice* target, + ExtractCallback* callback) { assert(archive); assert(target); @@ -1452,7 +1453,7 @@ void Lib7z::extractArchive(QIODevice* archive, const File& item, QIODevice* targ } } -void Lib7z::extractArchive(QIODevice* archive, const File& item, const QString &targetDirectory, +void Lib7z::extractFileFromArchive(QIODevice* archive, const File& item, const QString &targetDirectory, ExtractCallback* callback) { assert(archive); @@ -1472,7 +1473,7 @@ void Lib7z::extractArchive(QIODevice* archive, const File& item, const QString & if (item.permissions) out.setPermissions(item.permissions); callback->setTarget(&out); - extractArchive(archive, item, &out, callback); + extractFileFromArchive(archive, item, &out, callback); outDir.release(); } @@ -1559,9 +1560,9 @@ void ExtractItemJob::doStart() if (!d->archive) throw SevenZipException(tr("Could not list archive: QIODevice not set or already destroyed.")); if (d->target) - extractArchive(d->archive, d->item, d->target, d->callback); + extractFileFromArchive(d->archive, d->item, d->target, d->callback); else if (!d->item.path.isEmpty()) - extractArchive(d->archive, d->item, d->targetDirectory, d->callback); + extractFileFromArchive(d->archive, d->item, d->targetDirectory, d->callback); else extractArchive(d->archive, d->targetDirectory, d->callback); } catch (const SevenZipException& e) { diff --git a/src/libs/installer/lib7z_facade.h b/src/libs/installer/lib7z_facade.h index f84cd987f..a783fbd44 100644 --- a/src/libs/installer/lib7z_facade.h +++ b/src/libs/installer/lib7z_facade.h @@ -85,7 +85,6 @@ namespace Lib7z { QFile::Permissions permissions; QString path; - QString name; QDateTime mtime; quint64 uncompressedSize; quint64 compressedSize; @@ -151,20 +150,32 @@ namespace Lib7z { void deviceDestroyed(QObject*); }; - /* - * @throws Lib7z::SevenZipException - */ - void INSTALLER_EXPORT extractArchive( QIODevice* archive, const File& item, QIODevice* out, ExtractCallback* callback=0 ); + /*! + Extracts the given File \a file from \a archive into output device \a out using the provided extract + callback \a callback. - /* - * @throws Lib7z::SevenZipException - */ - void INSTALLER_EXPORT extractArchive( QIODevice* archive, const File& item, const QString& targetDirectory, ExtractCallback* callback=0 ); + Throws Lib7z::SevenZipException on error. + */ + void INSTALLER_EXPORT extractFileFromArchive(QIODevice* archive, const File& item, QIODevice* out, + ExtractCallback* callback=0 ); - /* - * @throws Lib7z::SevenZipException - */ - void INSTALLER_EXPORT extractArchive( QIODevice* archive, const QString& targetDirectory, ExtractCallback* callback=0 ); + /*! + Extracts the given File \a file from \a archive into target directory \a targetDirectory using the + provided extract callback \a callback. The output filename is deduced from the \a file path name. + + Throws Lib7z::SevenZipException on error. + */ + void INSTALLER_EXPORT extractFileFromArchive(QIODevice* archive, const File& item, + const QString& targetDirectory, ExtractCallback* callback = 0); + + /*! + Extracts the given \a archive content into target directory \a targetDirectory using the + provided extract callback \a callback. The output filenames are deduced from the \a archive content. + + Throws Lib7z::SevenZipException on error. + */ + void INSTALLER_EXPORT extractArchive(QIODevice* archive, const QString& targetDirectory, + ExtractCallback* callback = 0); /* * @thows Lib7z::SevenZipException -- cgit v1.2.3