From c97cc1d67b8e5814f08107f2a7add3f66b695c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Thu, 2 Jan 2025 13:20:34 -0500 Subject: [PATCH] concepts: start work on file output --- include/avnd/concepts/file_port.hpp | 2 ++ include/halp/file_port.hpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/avnd/concepts/file_port.hpp b/include/avnd/concepts/file_port.hpp index 6e7a7e53..7c0c916a 100644 --- a/include/avnd/concepts/file_port.hpp +++ b/include/avnd/concepts/file_port.hpp @@ -30,4 +30,6 @@ concept raw_file_port = requires(T t) { }; AVND_DEFINE_TAG(file_watch) +AVND_DEFINE_TAG(file_load) +AVND_DEFINE_TAG(file_create) } diff --git a/include/halp/file_port.hpp b/include/halp/file_port.hpp index b985c067..2fb61cef 100644 --- a/include/halp/file_port.hpp +++ b/include/halp/file_port.hpp @@ -10,6 +10,7 @@ #include #include #include + HALP_MODULE_EXPORT namespace halp { @@ -39,6 +40,15 @@ struct mmap_file_view }; }; +struct output_file_view +{ + std::string_view filename; + enum + { + file_create + }; +}; + template struct file_port { @@ -51,4 +61,16 @@ struct file_port FileType file; }; + +template +struct file_write_port +{ + using file_type = output_file_view; + static clang_buggy_consteval auto name() { return std::string_view{lit.value}; } + + HALP_INLINE_FLATTEN operator output_file_view&() noexcept { return file; } + HALP_INLINE_FLATTEN operator const output_file_view&() const noexcept { return file; } + + output_file_view file; +}; }