blob: b9930cb2fe1d55b4e99bfbb8610b3ee88f6c7cab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* -------------------------------------------
Copyright Mahrouss Logic
------------------------------------------- */
#pragma once
#include <KernelKit/DeviceManager.hpp>
#include <NewKit/OwnPtr.hpp>
#include <NewKit/Stream.hpp>
#include "CompilerKit/CompilerKit.hpp"
namespace HCore {
// @brief Emulates a VT100 terminal.
class TerminalDevice final : public DeviceInterface<const Char *> {
public:
TerminalDevice(void (*print)(const Char *), void (*get)(const Char *))
: DeviceInterface<const Char *>(print, get) {}
virtual ~TerminalDevice() {}
/// @brief returns device name (terminal name)
/// @return string type (const char*)
virtual const char *Name() const override { return ("TerminalDevice"); }
HCORE_COPY_DEFAULT(TerminalDevice);
static TerminalDevice Shared() noexcept;
};
inline TerminalDevice end_line() {
TerminalDevice selfTerm = TerminalDevice::Shared();
selfTerm << "\n";
return selfTerm;
}
} // namespace HCore
#ifdef kcout
#undef kcout
#endif // ifdef kcout
#define kcout TerminalDevice::Shared()
#define endl end_line()
|