fw4spl
ReadZipArchive.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWZIP_READZIPARCHIVE_HPP__
8 #define __FWZIP_READZIPARCHIVE_HPP__
9 
10 #include "fwZip/config.hpp"
11 #include "fwZip/IReadArchive.hpp"
12 
13 #include <fwCore/macros.hpp>
14 
15 #include <boost/filesystem/path.hpp>
16 
17 #include <istream>
18 
19 namespace fwZip
20 {
21 
25 class FWZIP_CLASS_API ReadZipArchive : public IReadArchive
26 {
27 
28 public:
29 
31  ((( const ::boost::filesystem::path& ))),
32  std::make_shared< ReadZipArchive >);
33 
34  /*
35  * @brief Constructors. Initializes archive path, zip descriptor and zip stream.
36  *
37  * @throw ::fwZip::exception::Read if archive doesn't exist.
38  * @throw ::fwZip::exception::Read if archive cannot be opened.
39  */
40  FWZIP_API ReadZipArchive( const ::boost::filesystem::path& archive );
41 
50  FWZIP_API SPTR(std::istream) getFile(const ::boost::filesystem::path &path) override;
51 
57  FWZIP_API std::string getComment();
58 
62  FWZIP_API const ::boost::filesystem::path getArchivePath() const override;
63 
64  //------------------------------------------------------------------------------
65 
66  IReadArchive::sptr clone() const override
67  {
68  return ReadZipArchive::New(m_archive);
69  }
70 
71 protected:
72 
73  ::boost::filesystem::path m_archive;
74 };
75 
76 }
77 
78 #endif /* __FWZIP_READZIPARCHIVE_HPP__ */
79 
#define SPTR(_cls_)
This class defines functions to read a file in a zip archive.
STL namespace.
This file defines fwCore base macros.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
The namespace fwZip provides IO for compress/uncompress .zip files using zlib .
Definition: Read.hpp:14
This interface defines functions to read a file in an archive.