MeshLib
 
Loading...
Searching...
No Matches
MRUniqueTemporaryFolder.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4
5#include <filesystem>
6
7namespace MR
8{
9
11using FolderCallback = std::function<void( const std::filesystem::path& tempFolderName )>;
12
15{
16public:
21
22 explicit operator bool() const
23 {
24 return !folder_.empty();
25 }
26 operator const std::filesystem::path& ( ) const
27 {
28 return folder_;
29 }
30 std::filesystem::path operator /( const std::filesystem::path& child ) const
31 {
32 return folder_ / child;
33 }
34
35private:
36 std::filesystem::path folder_;
37 FolderCallback onPreTempFolderDelete_;
38};
39
40} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
helper class to create a temporary folder; the folder will be removed on the object's destruction
Definition MRUniqueTemporaryFolder.h:15
MRMESH_API ~UniqueTemporaryFolder()
removes folder with all its content
MRMESH_API UniqueTemporaryFolder(FolderCallback onPreTempFolderDelete)
creates new folder in temp directory
std::filesystem::path operator/(const std::filesystem::path &child) const
Definition MRUniqueTemporaryFolder.h:30
Definition MRCameraOrientationPlugin.h:8
std::function< void(const std::filesystem::path &tempFolderName)> FolderCallback
this callback will be called before compression on serialization and after decompression on deseriali...
Definition MRUniqueTemporaryFolder.h:11