5#include <aegis2d/core/export.hpp>
43 using Reload = std::function<void(
const std::filesystem::path& path)>;
50 std::chrono::milliseconds interval = std::chrono::milliseconds{250});
54 [[nodiscard]]
bool enabled() const noexcept;
62 void watch(const
std::filesystem::path& path,
Reload reload);
66 [[nodiscard]]
std::
size_t size() const noexcept;
75 std::filesystem::file_time_type time{};
76 std::uintmax_t size = 0;
77 bool operator==(
const Stamp&)
const =
default;
80 std::filesystem::path path{};
82 std::optional<Stamp> seen{};
85 [[nodiscard]]
static std::optional<Stamp> stamp(
const std::filesystem::path& path)
noexcept;
87 std::vector<File> files_;
88 std::chrono::milliseconds interval_;
89 std::chrono::steady_clock::time_point last_{};
Watches files and reloads each one with its own function when it changes.
Definition hot_reload.hpp:40
HotReload(bool enabled, std::chrono::milliseconds interval=std::chrono::milliseconds{250})
Creates a watcher with no file.
bool enabled() const noexcept
Tells whether files are watched.
std::function< void(const std::filesystem::path &path)> Reload
What to do with a changed file.
Definition hot_reload.hpp:43
Logging, time, main loop, events and configuration shared by client and server.
Definition clock.hpp:11
constexpr bool hot_reload_by_default
Whether to turn hot reload on: in debug builds (NDEBUG not defined).
Definition hot_reload.hpp:23
Definition endpoint.hpp:85