cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
position.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
12#include <cstddef>
13#include <cstdint>
14
15namespace Term
16{
17
18class Row
19{
20public:
21 Row() = default;
22 explicit Row(const std::uint16_t& row) : m_row(row) {}
23 operator std::size_t() const noexcept { return m_row; }
24
25private:
26 std::uint16_t m_row{0};
27};
28
29class Column
30{
31public:
32 Column() = default;
33 explicit Column(const std::uint16_t& column) : m_column(column) {}
34 operator std::size_t() const noexcept { return m_column; }
35
36private:
37 std::uint16_t m_column{0};
38};
39
41{
42public:
43 Position() = default;
44 Position(const Row& row, const Column& column) : m_row(row), m_column(column) {};
45 Position(const Column& column, const Row& row) : m_row(row), m_column(column) {};
46 const Row& row() const noexcept { return m_row; }
47 const Column& column() const noexcept { return m_column; }
48
49private:
52};
53
54} // namespace Term
Column()=default
Column(const std::uint16_t &column)
Definition position.hpp:33
std::uint16_t m_column
Definition position.hpp:37
Position()=default
Position(const Row &row, const Column &column)
Definition position.hpp:44
Column m_column
Definition position.hpp:51
const Column & column() const noexcept
Definition position.hpp:47
Position(const Column &column, const Row &row)
Definition position.hpp:45
const Row & row() const noexcept
Definition position.hpp:46
std::uint16_t m_row
Definition position.hpp:26
Row(const std::uint16_t &row)
Definition position.hpp:22
Row()=default
Definition args.cpp:13