diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-12-11 18:36:23 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-12-11 18:36:23 +0100 |
| commit | cf8d0d899ee17db734ce8ab7ee618333eb1767f2 (patch) | |
| tree | 8ff328c106d9f928423dfa860567fbf6dbf84f88 /kapi/src/cio.cpp | |
| parent | 998a001fc621ca0e7560ca09a8acd29469ae3373 (diff) | |
| download | teachos-cf8d0d899ee17db734ce8ab7ee618333eb1767f2.tar.xz teachos-cf8d0d899ee17db734ce8ab7ee618333eb1767f2.zip | |
kapi: finish documentation
Diffstat (limited to 'kapi/src/cio.cpp')
| -rw-r--r-- | kapi/src/cio.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/kapi/src/cio.cpp b/kapi/src/cio.cpp index 210e58e..66493b6 100644 --- a/kapi/src/cio.cpp +++ b/kapi/src/cio.cpp @@ -1,14 +1,29 @@ #include "kapi/cio.hpp" #include <optional> +#include <string_view> #include <utility> namespace teachos::cio { + namespace + { + struct null_device final : public output_device + { + null_device static instance; + + auto write(std::string_view) -> void override {} + auto writeln(std::string_view) -> void override {} + + auto write_error(std::string_view) -> void override {} + auto writeln_error(std::string_view) -> void override {} + }; + + constinit null_device null_device::instance; + } // namespace + // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - auto constinit null_device = output_device{}; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - auto constinit active_device = &null_device; + constinit auto active_device = static_cast<output_device *>(&null_device::instance); auto set_output_device(output_device & device) -> std::optional<output_device *> { |
