resonance 1.0.1
Loading...
Searching...
No Matches
fileio.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <expected>
5#include <filesystem>
6#include <span>
7#include <string_view>
8#include <vector>
9
10#include "error.h"
11
12namespace Tools {
13
20std::expected<std::vector<std::uint8_t>, Error> readFile(const std::filesystem::path &path);
21
29std::expected<void, Error> writeFile(const std::filesystem::path &path,
30 std::span<const std::uint8_t> data);
31
39std::expected<void, Error> writeFile(const std::filesystem::path &path, std::string_view text);
40
41} // namespace Tools
Host tools that the build runs.
Definition byteorder.h:7
std::expected< std::vector< std::uint8_t >, Error > readFile(const std::filesystem::path &path)
Read a whole file.
std::expected< void, Error > writeFile(const std::filesystem::path &path, std::span< const std::uint8_t > data)
Replace a file with the given bytes.
Failure returned through std::expected.
Definition error.h:17