diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-12-15 16:10:38 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-12-15 16:10:38 +0100 |
| commit | b9a733b87e4ef1a2dcd17387cedf16402acd9fd7 (patch) | |
| tree | d74407155df80ec74d78b30389ff7956566b70ce | |
| parent | e9de1e44a21f4b6d31814ac994b26860d0f6b232 (diff) | |
| download | teachos-b9a733b87e4ef1a2dcd17387cedf16402acd9fd7.tar.xz teachos-b9a733b87e4ef1a2dcd17387cedf16402acd9fd7.zip | |
kapi/cio: extract output_device
| -rw-r--r-- | kapi/include/kapi/cio.hpp | 40 | ||||
| -rw-r--r-- | kapi/include/kapi/cio/output_device.hpp | 47 |
2 files changed, 51 insertions, 36 deletions
diff --git a/kapi/include/kapi/cio.hpp b/kapi/include/kapi/cio.hpp index a2be97e..071e6cb 100644 --- a/kapi/include/kapi/cio.hpp +++ b/kapi/include/kapi/cio.hpp @@ -1,5 +1,7 @@ -#ifndef TEACHOS_KAPI_IO_HPP -#define TEACHOS_KAPI_IO_HPP +#ifndef TEACHOS_KAPI_CIO_HPP +#define TEACHOS_KAPI_CIO_HPP + +#include "kapi/cio/output_device.hpp" // IWYU pragma: export #include <optional> #include <string_view> @@ -7,40 +9,6 @@ namespace teachos::cio { - //! The interface of a device able to perform character output on a platform. - struct output_device - { - output_device(output_device const &) = delete; - output_device(output_device &&) = delete; - auto operator=(output_device const &) -> output_device & = delete; - auto operator=(output_device &&) -> output_device & = delete; - - virtual ~output_device() = default; - - //! Write the given text to the output device. - //! - //! @param text The text to write. - auto virtual write(std::string_view text) -> void = 0; - - //! Write the given text to the output device, appending a newline - //! - //! @param text The text to write. - auto virtual writeln(std::string_view text) -> void = 0; - - //! Write the given error text to the output device. - //! - //! @param text The text to write. - auto virtual write_error(std::string_view text) -> void = 0; - - //! Write the given error text to the output device, appending a newline - //! - //! @param text The text to write. - auto virtual writeln_error(std::string_view text) -> void = 0; - - protected: - output_device() = default; - }; - //! @qualifier platform-defined //! Initialize the character I/O subsystem. //! diff --git a/kapi/include/kapi/cio/output_device.hpp b/kapi/include/kapi/cio/output_device.hpp new file mode 100644 index 0000000..0599906 --- /dev/null +++ b/kapi/include/kapi/cio/output_device.hpp @@ -0,0 +1,47 @@ +#ifndef TEACHOS_KAPI_CIO_OUTPUT_DEVICE_HPP +#define TEACHOS_KAPI_CIO_OUTPUT_DEVICE_HPP + +// IWYU pragma: private, include "kapi/cio.hpp" + +#include <string_view> + +namespace teachos::cio +{ + + //! The interface of a device able to perform character output on a platform. + struct output_device + { + output_device(output_device const &) = delete; + output_device(output_device &&) = delete; + auto operator=(output_device const &) -> output_device & = delete; + auto operator=(output_device &&) -> output_device & = delete; + + virtual ~output_device() = default; + + //! Write the given text to the output device. + //! + //! @param text The text to write. + auto virtual write(std::string_view text) -> void = 0; + + //! Write the given text to the output device, appending a newline + //! + //! @param text The text to write. + auto virtual writeln(std::string_view text) -> void = 0; + + //! Write the given error text to the output device. + //! + //! @param text The text to write. + auto virtual write_error(std::string_view text) -> void = 0; + + //! Write the given error text to the output device, appending a newline + //! + //! @param text The text to write. + auto virtual writeln_error(std::string_view text) -> void = 0; + + protected: + output_device() = default; + }; + +} // namespace teachos::cio + +#endif |
