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