Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
ftxui_renderer.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <cstddef>
13#include <memory>
14#include <string>
15
17
18namespace contur {
19
24 class FtxuiRenderer final : public IRenderer
25 {
26 public:
30 explicit FtxuiRenderer(int width = 120, int height = 40);
31
33 ~FtxuiRenderer() override;
34
35 FtxuiRenderer(const FtxuiRenderer &) = delete;
37
39 FtxuiRenderer &operator=(FtxuiRenderer &&) noexcept;
40
42 [[nodiscard]] Result<void> render(const TuiSnapshot &snapshot) override;
43
45 void clear() override;
46
48 [[nodiscard]] const std::string &lastRendered() const noexcept;
49
51 [[nodiscard]] bool hasContent() const noexcept;
52
54 [[nodiscard]] int width() const noexcept;
55
57 [[nodiscard]] int height() const noexcept;
58
59 private:
60 struct Impl;
61 std::unique_ptr<Impl> impl_;
62 };
63
64} // namespace contur
void clear() override
Clears the internal screen buffer.
FtxuiRenderer & operator=(const FtxuiRenderer &)=delete
FtxuiRenderer(int width=120, int height=40)
Constructs renderer with given terminal dimensions.
int height() const noexcept
Screen height configured at construction.
FtxuiRenderer(FtxuiRenderer &&) noexcept
std::unique_ptr< Impl > impl_
~FtxuiRenderer() override
Destroys renderer.
Result< void > render(const TuiSnapshot &snapshot) override
Renders snapshot to the internal screen buffer.
FtxuiRenderer(const FtxuiRenderer &)=delete
const std::string & lastRendered() const noexcept
Returns the last rendered screen as a plain string.
bool hasContent() const noexcept
Returns whether the buffer currently holds rendered content.
int width() const noexcept
Screen width configured at construction.
Renderer contract for painting a full TUI snapshot.
Definition i_renderer.h:14
A result type that holds either a success value of type T or an ErrorCode.
Definition error.h:104
Backend-agnostic renderer contract for TUI MVC view boundary.
Definition block.h:15
Top-level immutable model snapshot consumed by TUI controller/views.
Definition tui_models.h:93