aboutsummaryrefslogtreecommitdiff
path: root/kapi/include
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-07-24 20:51:55 +0000
committerFelix Morgner <felix.morgner@ost.ch>2025-07-24 20:51:55 +0000
commitdd04850c27e8bc273506f4a64bb28b7ddf111dc5 (patch)
treea00212f5c903e80e4e729c87ce34ece2c40e4ee6 /kapi/include
parentfeac668578a35aac280b59d478a57b6937bb68da (diff)
downloadteachos-dd04850c27e8bc273506f4a64bb28b7ddf111dc5.tar.xz
teachos-dd04850c27e8bc273506f4a64bb28b7ddf111dc5.zip
kapi: rework text device interface
Diffstat (limited to 'kapi/include')
-rw-r--r--kapi/include/kapi/cio.hpp29
-rw-r--r--kapi/include/kapi/io.hpp17
2 files changed, 29 insertions, 17 deletions
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 <optional>
+#include <string_view>
+
+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<output_device *>;
+
+ 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 <string_view>
-
-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