-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathHandleWrapper.h
More file actions
33 lines (26 loc) · 790 Bytes
/
HandleWrapper.h
File metadata and controls
33 lines (26 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include <string>
namespace Linter
{
class HandleWrapper
{
public:
explicit HandleWrapper(HANDLE h);
HandleWrapper(HandleWrapper const &) = delete;
HandleWrapper(HandleWrapper &&other) noexcept;
HandleWrapper &operator=(HandleWrapper const &) = delete;
HandleWrapper &operator=(HandleWrapper &&other) = delete;
~HandleWrapper();
void close() const;
operator HANDLE() const noexcept;
/** Write a string to the handle
*
* @param str - string to write
*/
void writeFile(std::string const &str) const;
/** Read the entire file */
std::string readFile() const;
private:
mutable HANDLE m_handle;
};
} // namespace Linter