Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkArchive.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3 Portions (c) Copyright 2017 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5 See COPYRIGHT.txt
6 or http://www.slicer.org/copyright/copyright.txt for details.
7 
8 =========================================================================auto=*/
9 
10 #ifndef __vtkArchive_h
11 #define __vtkArchive_h
12 
13 // MRML includes
14 #include "vtkMRML.h"
15 
16 // VTK includes
17 #include <vtkObject.h>
18 
19 // STD includes
20 #include <string>
21 #include <vector>
22 
25 class VTK_MRML_EXPORT vtkArchive : public vtkObject
26 {
27 public:
28  static vtkArchive *New();
29  vtkTypeMacro(vtkArchive, vtkObject);
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
32  static bool ListArchive(const char* archiveFileNameFileName, std::vector<std::string>& files);
33 
34  // Warning, it extracts the archive into the current directory
35  // With Qt, you can change the current directory using QDir::setCurrent()
36  static bool ExtractTar(const char* tarFileName, bool verbose, bool extract, std::vector<std::string> * extracted_files = nullptr);
37 
38  // creates a zip file with the full contents of the directory (recurses)
39  // zip entries will include relative path of including tail of directoryToZip
40  static bool Zip(const char* zipFileName, const char* directoryToZip);
41 
42  // unzips zip file into specified directory
43  // (internally this supports many formats of archive, not just zip)
44  static bool UnZip(const char* zipFileName, const char *destinationDirectory);
45 
46 protected:
47  vtkArchive();
48  ~vtkArchive() override;
49  vtkArchive(const vtkArchive&);
50  void operator=(const vtkArchive&);
51 };
52 
53 #endif
Simple class for manipulating archive files.
Definition: vtkArchive.h:25