1 | #pragma once |
2 | #include "taichi/common/core.h" |
3 | |
4 | namespace taichi { |
5 | namespace zip { |
6 | |
7 | // (penguinliong) Currently only supports loading. |
8 | struct ZipArchive { |
9 | std::unordered_map<std::string, std::vector<uint8_t>> file_dict; |
10 | |
11 | ZipArchive() = default; |
12 | ZipArchive(const ZipArchive &) = delete; |
13 | ZipArchive(ZipArchive &&) = default; |
14 | |
15 | ZipArchive &operator=(const ZipArchive &) = delete; |
16 | ZipArchive &operator=(ZipArchive &&) = default; |
17 | |
18 | // Parse a serialized Zip archive and extract the uncompressed data keyed by |
19 | // its file name. Returns true if success. |
20 | static bool try_from_bytes(const void *data, size_t size, ZipArchive &ar); |
21 | }; |
22 | |
23 | } // namespace zip |
24 | } // namespace taichi |
25 | |