QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
File.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <cstddef>
9#include <filesystem>
10#include <optional>
11#include <span>
12#include <string>
13#include <string_view>
14#include <vector>
15
16namespace Quasar
17{
25 std::optional<std::string> ReadTextFile(const std::filesystem::path& path);
26
33 std::optional<std::vector<std::byte>> ReadBinaryFile(const std::filesystem::path& path);
34
42 bool WriteTextFile(const std::filesystem::path& path, std::string_view text);
43
50 bool WriteBinaryFile(const std::filesystem::path& path, std::span<const std::byte> data);
51
56 bool CreateDirectories(const std::filesystem::path& path);
57}
Contains all the engine code.
bool WriteBinaryFile(const std::filesystem::path &path, std::span< const std::byte > data)
Writes a whole binary file, byte for byte, replacing its content if it already exists.
std::optional< std::vector< std::byte > > ReadBinaryFile(const std::filesystem::path &path)
Reads a whole binary file, byte for byte.
bool CreateDirectories(const std::filesystem::path &path)
Creates a directory and its missing parents.
bool WriteTextFile(const std::filesystem::path &path, std::string_view text)
Writes a whole text file, replacing its content if it already exists.
std::optional< std::string > ReadTextFile(const std::filesystem::path &path)
Reads a whole text file.