MeshLib C++ Docs
Loading...
Searching...
No Matches
MRZip.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
5#include "MRExpected.h"
6#include <filesystem>
7#include <functional>
8#include <string>
9#include <vector>
10
11namespace MR
12{
13
17
22MRMESH_API Expected<void> decompressZip( const std::filesystem::path& zipFile, const std::filesystem::path& targetFolder,
23 const char * password = nullptr );
24
29MRMESH_API Expected<void> decompressZip( std::istream& zipStream, const std::filesystem::path& targetFolder, const char * password = nullptr );
30
33using ZipFileCallback = std::function<Expected<void>( const std::string& path, std::vector<char>&& data )>;
34
40MRMESH_API Expected<void> decompressZip( const std::filesystem::path& zipFile, const ZipFileCallback& callback,
41 const char * password = nullptr );
42
48MRMESH_API Expected<void> decompressZip( std::istream& zipStream, const ZipFileCallback& callback, const char * password = nullptr );
49
51{
53 std::vector<std::filesystem::path> excludeFiles;
54
58
60 std::string password;
61
64};
65
69MRMESH_API Expected<void> compressZip( const std::filesystem::path& zipFile, const std::filesystem::path& sourceFolder,
70 const CompressZipSettings& settings = {} );
71
78[[deprecated( "Use compressZip( zipFile, sourceFolder, settings )" )]]
79MRMESH_API Expected<void> compressZip( const std::filesystem::path& zipFile, const std::filesystem::path& sourceFolder,
80 const std::vector<std::filesystem::path>& excludeFiles, const char * password = nullptr, ProgressCallback cb = {} );
81
83
84}
#define MRMESH_API
Definition MRMeshFwd.h:85
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:790
tl::expected< T, E > Expected
Definition MRExpected.h:31
std::function< Expected< void >(const std::string &path, std::vector< char > &&data)> ZipFileCallback
Definition MRZip.h:33
Expected< void > decompressZip(const std::filesystem::path &zipFile, const std::filesystem::path &targetFolder, const char *password=nullptr)
decompresses given zip-file into given folder
Expected< void > compressZip(const std::filesystem::path &zipFile, const std::filesystem::path &sourceFolder, const CompressZipSettings &settings={})
compresses given folder in given zip-file
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8
Definition MRZip.h:51
std::string password
if password is given then the archive will be encrypted
Definition MRZip.h:60
std::vector< std::filesystem::path > excludeFiles
files that should not be included to result zip
Definition MRZip.h:53
int compressionLevel
Definition MRZip.h:57
ProgressCallback cb
an option to get progress notifications and cancel the operation
Definition MRZip.h:63