Orcus
zip_archive.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
7 
8 #ifndef INCLUDED_ORCUS_ZIP_ARCHIVE_HPP
9 #define INCLUDED_ORCUS_ZIP_ARCHIVE_HPP
10 
11 #include "env.hpp"
12 #include <cstdlib>
13 #include <exception>
14 #include <string>
15 #include <vector>
16 
17 namespace orcus {
18 
19 class zip_archive_stream;
20 class zip_archive_impl;
21 class pstring;
22 
23 class ORCUS_PSR_DLLPUBLIC zip_error : public std::exception
24 {
25  std::string m_msg;
26 public:
27  zip_error();
28  zip_error(const std::string& msg);
29  virtual ~zip_error() throw();
30 
31  virtual const char* what() const throw();
32 };
33 
34 class ORCUS_PSR_DLLPUBLIC zip_archive
35 {
36  zip_archive_impl* mp_impl;
37 
38  zip_archive() = delete;
39  zip_archive(const zip_archive&) = delete;
40  zip_archive& operator= (const zip_archive) = delete;
41 
42 public:
44  ~zip_archive();
45 
51  void load();
52 
58  void dump_file_entry(size_t index) const;
59 
66  void dump_file_entry(const char* entry_name) const;
67 
75  pstring get_file_entry_name(size_t index) const;
76 
84  size_t get_file_entry_count() const;
85 
97  bool read_file_entry(const pstring& entry_name, std::vector<unsigned char>& buf) const;
98 };
99 
100 }
101 
102 #endif
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: pstring.hpp:24
Definition: zip_archive_stream.hpp:17
Definition: zip_archive.hpp:23
Definition: zip_archive.hpp:34
Definition: base64.hpp:15