Mercurial > hg > orthanc
annotate OrthancFramework/Sources/Compression/ZipReader.h @ 5115:0a9d36187a91
merge
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 02 Dec 2022 15:05:33 +0100 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
rev | line source |
---|---|
4355 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4355 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU Lesser General Public License | |
10 * as published by the Free Software Foundation, either version 3 of | |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
19 * License along with this program. If not, see | |
20 * <http://www.gnu.org/licenses/>. | |
21 **/ | |
22 | |
23 | |
24 #pragma once | |
25 | |
26 #include "../OrthancFramework.h" | |
27 | |
28 #if !defined(ORTHANC_SANDBOXED) | |
29 # error The macro ORTHANC_SANDBOXED must be defined | |
30 #endif | |
31 | |
32 #if !defined(ORTHANC_ENABLE_ZLIB) | |
33 # error The macro ORTHANC_ENABLE_ZLIB must be defined | |
34 #endif | |
35 | |
36 #if ORTHANC_ENABLE_ZLIB != 1 | |
37 # error ZLIB support must be enabled to include this file | |
38 #endif | |
39 | |
40 | |
41 #include <stdint.h> | |
42 #include <string> | |
43 #include <boost/noncopyable.hpp> | |
44 #include <boost/shared_ptr.hpp> | |
45 | |
46 | |
47 namespace Orthanc | |
48 { | |
49 class ORTHANC_PUBLIC ZipReader : public boost::noncopyable | |
50 { | |
51 private: | |
52 class MemoryBuffer; | |
53 | |
54 struct PImpl; | |
55 boost::shared_ptr<PImpl> pimpl_; | |
56 | |
57 ZipReader(); | |
58 | |
59 void SeekFirst(); | |
60 | |
61 public: | |
62 ~ZipReader(); | |
63 | |
64 uint64_t GetFilesCount() const; | |
65 | |
4356 | 66 bool ReadNextFile(std::string& filename, |
67 std::string& content); | |
4355 | 68 |
69 static ZipReader* CreateFromMemory(const void* buffer, | |
70 size_t size); | |
71 | |
72 static ZipReader* CreateFromMemory(const std::string& buffer); | |
73 | |
74 #if ORTHANC_SANDBOXED != 1 | |
75 static ZipReader* CreateFromFile(const std::string& path); | |
76 #endif | |
77 | |
78 static bool IsZipMemoryBuffer(const void* buffer, | |
79 size_t size); | |
80 | |
81 static bool IsZipMemoryBuffer(const std::string& content); | |
82 | |
83 #if ORTHANC_SANDBOXED != 1 | |
84 static bool IsZipFile(const std::string& path); | |
85 #endif | |
86 }; | |
87 } |