From dd04850c27e8bc273506f4a64bb28b7ddf111dc5 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 24 Jul 2025 20:51:55 +0000 Subject: kapi: rework text device interface --- kapi/include/kapi/cio.hpp | 29 +++++++++++++++++++++++++++++ kapi/include/kapi/io.hpp | 17 ----------------- 2 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 kapi/include/kapi/cio.hpp delete mode 100644 kapi/include/kapi/io.hpp (limited to 'kapi/include') diff --git a/kapi/include/kapi/cio.hpp b/kapi/include/kapi/cio.hpp new file mode 100644 index 0000000..6b93638 --- /dev/null +++ b/kapi/include/kapi/cio.hpp @@ -0,0 +1,29 @@ +#ifndef TEACHOS_KAPI_IO_HPP +#define TEACHOS_KAPI_IO_HPP + +#include +#include + +namespace teachos::cio +{ + struct output_device + { + auto virtual write(std::string_view text [[maybe_unused]]) -> void {} + auto virtual writeln(std::string_view text [[maybe_unused]]) -> void {} + + auto virtual write_error(std::string_view text [[maybe_unused]]) -> void {} + auto virtual writeln_error(std::string_view text [[maybe_unused]]) -> void {} + }; + + auto init() -> void; + + auto set_output_device(output_device & device) -> std::optional; + + auto print(std::string_view text) -> void; + auto println(std::string_view text) -> void; + + auto print_error(std::string_view text) -> void; + auto println_error(std::string_view text) -> void; +} // namespace teachos::cio + +#endif diff --git a/kapi/include/kapi/io.hpp b/kapi/include/kapi/io.hpp deleted file mode 100644 index 764738f..0000000 --- a/kapi/include/kapi/io.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef TEACHOS_KAPI_IO_HPP -#define TEACHOS_KAPI_IO_HPP - -#include - -namespace teachos::io -{ - auto init() -> void; - - auto print(std::string_view text) -> void; - auto println(std::string_view text) -> void; - - auto print_error(std::string_view text) -> void; - auto println_error(std::string_view text) -> void; -} // namespace teachos::io - -#endif -- cgit v1.2.3