Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/avnd/concepts/file_port.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
22 changes: 22 additions & 0 deletions include/halp/file_port.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <cstddef>
#include <string_view>
#include <vector>

HALP_MODULE_EXPORT
namespace halp
{
Expand Down Expand Up @@ -39,6 +40,15 @@ struct mmap_file_view
};
};

struct output_file_view
{
std::string_view filename;
enum
{
file_create
};
};

template <halp::static_string lit, typename FileType = text_file_view>
struct file_port
{
Expand All @@ -51,4 +61,16 @@ struct file_port

FileType file;
};

template <halp::static_string lit>
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;
};
}