summaryrefslogtreecommitdiffstats
path: root/installerbuilder/common/fileutils.h
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-04-21 11:59:53 +0200
committerkh1 <qt-info@nokia.com>2011-04-21 11:59:53 +0200
commitab8044c68dd6f4ffd7a37ded488944479257e01d (patch)
treeeb8581e142dbb29984b4224a5717599f589213e3 /installerbuilder/common/fileutils.h
parent53b6164460a9bf478013f8447db7b6730806effc (diff)
Cleanup. Whitespaces. Style.
Diffstat (limited to 'installerbuilder/common/fileutils.h')
-rw-r--r--installerbuilder/common/fileutils.h115
1 files changed, 59 insertions, 56 deletions
diff --git a/installerbuilder/common/fileutils.h b/installerbuilder/common/fileutils.h
index c9af75384..8be14f08f 100644
--- a/installerbuilder/common/fileutils.h
+++ b/installerbuilder/common/fileutils.h
@@ -26,11 +26,12 @@
#ifndef QINSTALLER_FILEUTILS_H
#define QINSTALLER_FILEUTILS_H
+#include "installer_global.h"
+
+#include <QtCore/QSet>
#include <QtCore/QString>
#include <QtCore/QStringList>
-#include "installer_global.h"
-
QT_BEGIN_NAMESPACE
class QByteArray;
class QIODevice;
@@ -38,69 +39,71 @@ class QUrl;
QT_END_NAMESPACE
namespace QInstaller {
- void INSTALLER_EXPORT openForWrite(QIODevice* dev, const QString& name);
- void INSTALLER_EXPORT openForRead(QIODevice* dev, const QString& name);
-
- qint64 INSTALLER_EXPORT blockingRead( QIODevice* in, char *buffer, qint64 size );
- qint64 INSTALLER_EXPORT blockingWrite( QIODevice* out, const char* buffer, qint64 size);
- qint64 INSTALLER_EXPORT blockingWrite( QIODevice* out, const QByteArray& ba );
- void INSTALLER_EXPORT blockingCopy( QIODevice* in, QIODevice* out, qint64 size );
-
- /**
- * Removes the directory at \a path recursively.
- * @param path The directory to remove
- * @param ignoreErrors if @p true, errors will be silently ignored. Otherwise an exception will be thrown if removing fails.
- *
- * @throws QInstaller::Error if the directory cannot be removed and ignoreErrors is @p false
- */
+class INSTALLER_EXPORT TempDirDeleter
+{
+public:
+ explicit TempDirDeleter(const QString &path);
+ explicit TempDirDeleter(const QStringList &paths = QStringList());
+ ~TempDirDeleter();
+
+ QStringList paths() const;
+
+ void add(const QString &path);
+ void add(const QStringList &paths);
+
+ void releaseAll();
+ void release(const QString &path);
+ void passAndReleaseAll(TempDirDeleter &tdd);
+ void passAndRelease(TempDirDeleter &tdd, const QString &path);
+
+private:
+ Q_DISABLE_COPY(TempDirDeleter)
+ QSet<QString> m_paths;
+};
+
+ void INSTALLER_EXPORT openForWrite(QIODevice *dev, const QString &name);
+ void INSTALLER_EXPORT openForRead(QIODevice *dev, const QString &name);
+
+ qint64 INSTALLER_EXPORT blockingRead(QIODevice *in, char *buffer, qint64 size);
+ void INSTALLER_EXPORT blockingCopy(QIODevice *in, QIODevice *out, qint64 size);
+ qint64 INSTALLER_EXPORT blockingWrite(QIODevice *out, const char* buffer, qint64 size);
+ qint64 INSTALLER_EXPORT blockingWrite(QIODevice *out, const QByteArray& ba);
+
+ /*!
+ Removes the directory at \a path recursively.
+ @param path The directory to remove
+ @param ignoreErrors if @p true, errors will be silently ignored. Otherwise an exception will be thrown
+ if removing fails.
+
+ @throws QInstaller::Error if the directory cannot be removed and ignoreErrors is @p false
+ */
void INSTALLER_EXPORT removeFiles(const QString &path, bool ignoreErrors = false);
- void INSTALLER_EXPORT removeDirectory( const QString& path, bool ignoreErrors = false );
- void INSTALLER_EXPORT removeDirectoryThreaded( const QString& path, bool ignoreErrors = false );
+ void INSTALLER_EXPORT removeDirectory(const QString &path, bool ignoreErrors = false);
+ void INSTALLER_EXPORT removeDirectoryThreaded(const QString &path, bool ignoreErrors = false);
- /**
- * Creates a temporary directory
- * @throws QInstaller::Error if creating the temporary directory fails
- */
- QString INSTALLER_EXPORT createTemporaryDirectory( const QString& templ=QString() );
+ /*!
+ Creates a temporary directory
+ @throws QInstaller::Error if creating the temporary directory fails
+ */
+ QString INSTALLER_EXPORT createTemporaryDirectory(const QString &templ=QString());
- QString INSTALLER_EXPORT generateTemporaryFileName( const QString& templ=QString() );
+ QString INSTALLER_EXPORT generateTemporaryFileName(const QString &templ=QString());
- void INSTALLER_EXPORT moveDirectoryContents( const QString& sourceDir, const QString& targetDir );
- void INSTALLER_EXPORT copyDirectoryContents( const QString& sourceDir, const QString& targetDir );
+ void INSTALLER_EXPORT moveDirectoryContents(const QString &sourceDir, const QString &targetDir);
+ void INSTALLER_EXPORT copyDirectoryContents(const QString &sourceDir, const QString &targetDir);
- bool INSTALLER_EXPORT isLocalUrl( const QUrl& url );
- QString INSTALLER_EXPORT pathFromUrl( const QUrl& url );
+ bool INSTALLER_EXPORT isLocalUrl(const QUrl &url);
+ QString INSTALLER_EXPORT pathFromUrl(const QUrl &url);
- void INSTALLER_EXPORT mkdir( const QString& path );
- void INSTALLER_EXPORT mkpath( const QString& path );
+ void INSTALLER_EXPORT mkdir(const QString &path);
+ void INSTALLER_EXPORT mkpath(const QString &path);
#ifdef Q_WS_WIN
- /**
- * Sets the .ico file at \a icon as application icon for \a application.
- */
- void INSTALLER_EXPORT setApplicationIcon( const QString& application, const QString& icon );
-
+ /*!
+ Sets the .ico file at \a icon as application icon for \a application.
+ */
+ void INSTALLER_EXPORT setApplicationIcon(const QString &application, const QString &icon);
#endif
-
- class INSTALLER_EXPORT TempDirDeleter
- {
- public:
- explicit TempDirDeleter( const QString& path );
- explicit TempDirDeleter( const QStringList& paths = QStringList() );
- ~TempDirDeleter();
- void releaseAll();
- void release( const QString& path );
- void passAndReleaseAll( TempDirDeleter& tdd );
- void passAndRelease( TempDirDeleter& tdd, const QString& path );
-
- void add( const QString& path );
- void add( const QStringList& paths );
- QStringList paths() const;
-
- private:
- Q_DISABLE_COPY(TempDirDeleter)
- QStringList m_paths;
- };
}
#endif // QINSTALLER_FILEUTILS_H