MeshLib C++ Docs
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{
11
12
14using FolderCallback = std::function<void( const std::filesystem::path& tempFolderName )>;
15
18{
19public:
21 MRMESH_API UniqueTemporaryFolder( FolderCallback onPreTempFolderDelete = {} );
22
25
26 explicit operator bool() const
27 {
28 return !folder_.empty();
29 }
30 operator const std::filesystem::path& ( ) const
31 {
32 return folder_;
33 }
34 std::filesystem::path operator /( const std::filesystem::path& child ) const
35 {
36 return folder_ / child;
37 }
38
39private:
40 std::filesystem::path folder_;
41 FolderCallback onPreTempFolderDelete_;
42};
43
44}
helper class to create a temporary folder; the folder will be removed on the object's destruction
Definition MRUniqueTemporaryFolder.h:18
MRMESH_API ~UniqueTemporaryFolder()
removes folder with all its content
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:14
std::filesystem::path operator/(const std::filesystem::path &child) const
Definition MRUniqueTemporaryFolder.h:34
MRMESH_API UniqueTemporaryFolder(FolderCallback onPreTempFolderDelete={})
creates new folder in temp directory
only for bindings generation
Definition MRCameraOrientationPlugin.h:8