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{
9
11using FolderCallback = std::function<void( const std::filesystem::path& tempFolderName )>;
12
14class UniqueTemporaryFolder
15{
16public:
18 MRMESH_API UniqueTemporaryFolder( FolderCallback onPreTempFolderDelete = {} );
19
21 MRMESH_API ~UniqueTemporaryFolder();
22
23 explicit operator bool() const
24 {
25 return !folder_.empty();
26 }
27 operator const std::filesystem::path& ( ) const
28 {
29 return folder_;
30 }
31 std::filesystem::path operator /( const std::filesystem::path& child ) const
32 {
33 return folder_ / child;
34 }
35
36private:
37 std::filesystem::path folder_;
38 FolderCallback onPreTempFolderDelete_;
39};
40
41} // namespace MR
#define MRMESH_API
Definition MRMeshFwd.h:80
unsafe UniqueTemporaryFolder(MR.Std._ByValue_Function_VoidFuncFromConstStdFilesystemPathRef? onPreTempFolderDelete=null)
Definition MRCameraOrientationPlugin.h:8