Four-space indents, braces on their own lines, and one-statement bodies without braces. Semicolons in comments became full stops. Designated initializers may leave fields out without a warning.
25 lines
558 B
C++
25 lines
558 B
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
class File
|
|
{
|
|
public:
|
|
File() = default;
|
|
File(const std::filesystem::path&, const char* mode);
|
|
~File();
|
|
|
|
bool open(const std::filesystem::path&, const char* mode);
|
|
int close();
|
|
FILE* get() const;
|
|
explicit operator bool() const;
|
|
|
|
private:
|
|
FILE* handle = nullptr;
|
|
};
|
|
|
|
bool file_text_load(const std::filesystem::path&, std::string*, const char* mode = "rb");
|
|
bool file_text_save(const std::filesystem::path&, std::string_view, const char* mode = "wb");
|