17 struct ResetModeMemo {
24 enum class UVTTYModeT: std::underlying_type_t<uv_tty_mode_t> {
25 NORMAL = UV_TTY_MODE_NORMAL,
26 RAW = UV_TTY_MODE_RAW,
53 static auto resetModeMemo() {
54 static std::weak_ptr<details::ResetModeMemo> weak;
55 auto shared = weak.lock();
56 if(!shared) { weak = shared = std::make_shared<details::ResetModeMemo>(); }
61 using Mode = details::UVTTYModeT;
63 explicit TTYHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref,
FileHandle desc,
bool readable)
65 memo{resetModeMemo()},
75 return initialize(&uv_tty_init, fd, rw);
95 return (0 == uv_tty_set_mode(
get(),
static_cast<std::underlying_type_t<Mode>
>(m)));
103 return (0 == uv_tty_reset_mode());
113 if(0 != uv_tty_get_winsize(
get(), &size.
width, &size.
height)) {
122 std::shared_ptr<details::ResetModeMemo> memo;
WinSize getWinSize()
Gets the current Window size.
details::UVTypeWrapper< uv_file > FileHandle
bool mode(Mode m)
Sets the TTY using the specified terminal mode.
Windows size representation.
bool init()
Initializes the handle.
bool reset() noexcept
Resets TTY settings to default values.