Template
32 lines
652 B
C++
32 lines
652 B
C++
#pragma once
|
|
#include <concepts>
|
|
#include <cstdio>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <type_traits>
|
|
|
|
namespace core {
|
|
|
|
class file_stream
|
|
{
|
|
public:
|
|
file_stream(const file_stream&) = delete;
|
|
file_stream& operator=(const file_stream&) = delete;
|
|
file_stream(file_stream&&) noexcept;
|
|
file_stream& operator=(file_stream&&);
|
|
~file_stream();
|
|
|
|
static file_stream open_for_reading(const std::filesystem::path& file_path);
|
|
static std::string file_content_as_string(const std::filesystem::path& file_path);
|
|
|
|
std::string read_all_as_string();
|
|
void close();
|
|
|
|
private:
|
|
file_stream() = default;
|
|
|
|
FILE* m_file_handle{};
|
|
};
|
|
|
|
}
|