userver: userver/fs/blocking/temp_file.hpp Source File
Loading...
Searching...
No Matches
temp_file.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <string>
7#include <string_view>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace fs::blocking {
12
21class TempFile final {
22public:
25 static TempFile Create();
26
32 static TempFile Create(std::string_view parent_path, std::string_view name_prefix);
33
34 TempFile() = delete;
35 TempFile(TempFile&& other) noexcept;
36 TempFile& operator=(TempFile&& other) noexcept;
37 ~TempFile();
38
40 static TempFile Adopt(std::string path);
41
43 const std::string& GetPath() const;
44
47 void Remove() &&;
48
49private:
50 explicit TempFile(std::string&& path);
51
52 std::string path_;
53};
54
55} // namespace fs::blocking
56
57USERVER_NAMESPACE_END