Orcus
Loading...
Searching...
No Matches
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
13#include <cstdlib>
14#include <exception>
15#include <string>
16#include <vector>
17
18namespace orcus {
19
20class zip_archive_stream;
21class zip_archive_impl;
22
23class ORCUS_PSR_DLLPUBLIC zip_error : public std::exception
24{
25 std::string m_msg;
26public:
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
34class 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
42public:
45
51 void load();
52
58 void dump_file_entry(size_t index) const;
59
66 void dump_file_entry(std::string_view entry_name) const;
67
75 std::string_view get_file_entry_name(std::size_t index) const;
76
84 size_t get_file_entry_count() const;
85
97 bool read_file_entry(std::string_view entry_name, std::vector<unsigned char>& buf) const;
98};
99
100}
101
102#endif
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: zip_archive_stream.hpp:19
Definition: zip_archive.hpp:35
void dump_file_entry(std::string_view entry_name) const
std::string_view get_file_entry_name(std::size_t index) const
bool read_file_entry(std::string_view entry_name, std::vector< unsigned char > &buf) const
size_t get_file_entry_count() const
void dump_file_entry(size_t index) const
Definition: zip_archive.hpp:24