Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
QuaZIPFacade.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef QUAZIPFACADE_H
22 #define QUAZIPFACADE_H
23 
24 #include <tulip/tulipconf.h>
25 
26 namespace tlp {
27 class PluginProgress;
28 }
29 
30 class QString;
31 
32 /**
33  @brief This class is a facade to the QuaZIP libraries features.
34  It provides with convenience methods allowing to manipulate the QuaZIP library on a higher level.
35  QuaZIPFacade contains only static methods, as it should only work as a toolbox.
36  */
37 class TLP_QT_SCOPE QuaZIPFacade {
38  QuaZIPFacade();
39 public:
40 
41  /**
42  @brief Compress (ZIPs) a directory into an archive.
43  This method compress the content of a directory (without taking the top directory) into an archive.
44  @param rootPath The absolute path of the directory to compress.
45  @param archivePath The absolute file path of the ZIP file to create.
46  @param progress A progress handler
47  @warning If an archive already exists with that name, it will be overwritten.
48  @return true if compression process went sucessfuly
49  */
50  static bool zipDir(const QString &rootPath, const QString &archivePath, tlp::PluginProgress *progress=NULL);
51 
52  /**
53  @brief Uncompress (un-ZIPs) an archive into a directory.
54  Files contained in the archive will be stored inside the specified directory. Making it the root path of the uncompressed files.
55  @param rootPath The absolute path of the directory where files should be written.
56  @param archivePath The absolute file path of the ZIP file to uncompress.
57  @param progress A progress handler
58  @warning If some files already exist in the target directory, they will be overwritten.
59  @return true if uncompression process went sucessfuly
60  */
61  static bool unzip(const QString &rootPath, const QString &archivePath, tlp::PluginProgress *progress=NULL);
62 };
63 
64 #endif // QUAZIPFACADE_H
65 ///@endcond