Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
io_atomic.h
1#ifndef SOURCEMETA_CORE_IO_ATOMIC_H_
2#define SOURCEMETA_CORE_IO_ATOMIC_H_
3
4#ifndef SOURCEMETA_CORE_IO_EXPORT
5#include <sourcemeta/core/io_export.h>
6#endif
7
8#include <cstddef> // std::byte
9#include <filesystem> // std::filesystem::path
10#include <functional> // std::function
11#include <ostream> // std::ostream
12#include <span> // std::span
13#include <string_view> // std::string_view
14
15namespace sourcemeta::core {
16
26SOURCEMETA_CORE_IO_EXPORT
27auto atomic_write_file(const std::filesystem::path &path,
28 const std::string_view contents) -> void;
29
42SOURCEMETA_CORE_IO_EXPORT
43auto atomic_write_file(const std::filesystem::path &path,
44 const std::span<const std::byte> contents) -> void;
45
60SOURCEMETA_CORE_IO_EXPORT
61auto atomic_write_file(const std::filesystem::path &path,
62 const std::function<void(std::ostream &)> &writer)
63 -> void;
64
79SOURCEMETA_CORE_IO_EXPORT
80auto atomic_directory_swap(const std::filesystem::path &original,
81 const std::filesystem::path &replacement) -> void;
82
83} // namespace sourcemeta::core
84
85#endif
SOURCEMETA_CORE_IO_EXPORT auto atomic_write_file(const std::filesystem::path &path, const std::string_view contents) -> void
SOURCEMETA_CORE_IO_EXPORT auto atomic_directory_swap(const std::filesystem::path &original, const std::filesystem::path &replacement) -> void