cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
cursor.hpp
Go to the documentation of this file.
1/*
2* cpp-terminal
3* C++ library for writing multi-platform terminal applications.
4*
5* SPDX-FileCopyrightText: 2019-2025 cpp-terminal
6*
7* SPDX-License-Identifier: MIT
8*/
9
10#pragma once
11
13
14#include <string>
15
16namespace Term
17{
18
19class Cursor
20{
21public:
22 Cursor() = default;
23 explicit Cursor(const Position& position);
24 std::size_t row() const;
25 std::size_t column() const;
26 bool empty() const;
27 bool operator==(const Term::Cursor& cursor) const;
28 bool operator!=(const Term::Cursor& cursor) const;
29
30private:
32};
33
34// returns the current cursor position (row, column) (Y, X)
36
37// move the cursor to the given (row, column) / (Y, X)
38std::string cursor_move(const std::size_t& row, const std::size_t& column);
39// move the cursor the given rows up
40std::string cursor_up(const std::size_t& rows);
41// move the cursor the given rows down
42std::string cursor_down(const std::size_t& rows);
43// move the cursor the given columns left
44std::string cursor_left(const std::size_t& columns);
45// move the cursor the given columns right
46std::string cursor_right(const std::size_t& columns);
47// the ANSI code to generate a cursor position report
48std::string cursor_position_report();
49// turn off the cursor
50std::string cursor_off();
51// turn on the cursor
52std::string cursor_on();
53
54// clears the screen from the current cursor position to the end of the screen
55std::string clear_eol();
56
57} // namespace Term
std::size_t column() const
Definition cursor.cpp:16
Position m_position
Definition cursor.hpp:31
bool operator!=(const Term::Cursor &cursor) const
Definition cursor.cpp:22
Cursor()=default
bool empty() const
Definition cursor.cpp:18
std::size_t row() const
Definition cursor.cpp:14
bool operator==(const Term::Cursor &cursor) const
Definition cursor.cpp:20
Definition args.cpp:13
std::string clear_eol()
Definition cursor.cpp:40
std::string cursor_position_report()
Definition cursor.cpp:38
Term::Cursor cursor_position()
Definition cursor.cpp:26
std::string cursor_off()
Definition cursor.cpp:24
std::string cursor_left(const std::size_t &columns)
Definition cursor.cpp:36
std::string cursor_move(const std::size_t &row, const std::size_t &column)
Definition cursor.cpp:28
std::string cursor_on()
Definition cursor.cpp:26
std::string cursor_up(const std::size_t &rows)
Definition cursor.cpp:30
std::string cursor_right(const std::size_t &columns)
Definition cursor.cpp:34
std::string cursor_down(const std::size_t &rows)
Definition cursor.cpp:32