1 #pragma once
2 
3 #include <array>
4 #include <cstdio>
5 #include <string>
6 
7 #include <detail/external/include_windows.hpp>
8 #include <helpers/path_helper.hpp>
9 
10 namespace {
11 
create_temporary_filename()12 static std::string create_temporary_filename()
13 {
14     return "temp.xlsx";
15 }
16 
17 } // namespace
18 
19 class temporary_file
20 {
21 public:
temporary_file()22     temporary_file() : path_(create_temporary_filename())
23     {
24         if(path_.exists())
25         {
26             std::remove(path_.string().c_str());
27         }
28     }
29 
~temporary_file()30     ~temporary_file()
31     {
32         std::remove(path_.string().c_str());
33     }
34 
get_path() const35     xlnt::path get_path() const { return path_; }
36 
37 private:
38     const xlnt::path path_;
39 };
40