units.hpp file
Namespaces
- namespace nxt
Classes
- struct nxt::ch_unit
- Literal unit for terminal-cell widths.
- struct nxt::ln_unit
- Literal unit for terminal-line heights.
- struct nxt::one_unit
- Literal unit for dimensionless ratios.
- struct nxt::percent_unit
- Literal unit for percentages.
- struct nxt::width_t
- Strong type for horizontal extents measured in terminal cells.
- struct nxt::height_t
- Strong type for vertical extents measured in terminal lines.
- struct nxt::ratio_t
- Dimensionless flex or scale ratio.
- struct nxt::percent_t
- Percentage value, where 100 means one whole.
- struct nxt::terminal_origin_t
- Zero-based terminal-column origin tag.
- struct nxt::terminal_origin_v_t
- Zero-based terminal-row origin tag.
- struct nxt::ansi_origin_t
- One-based ANSI-column origin tag.
- struct nxt::ansi_origin_v_t
- One-based ANSI-row origin tag.
- struct nxt::col_t
- Strong type for a zero-based terminal column.
- struct nxt::row_t
- Strong type for a zero-based terminal row.
- struct nxt::Size
- Two-dimensional extent in terminal cells.
- struct nxt::Pos
- Two-dimensional zero-based terminal position.
Typedefs
- using ansi_col_t = col_t
- ANSI columns share the same representation but are interpreted one-based.
- using ansi_row_t = row_t
- ANSI rows share the same representation but are interpreted one-based.
Functions
-
template <numeric T>auto operator*(T n, ch_unit) → width_t constexpr noexcept
- Create a width from a number of terminal cells.
-
template <numeric T>auto operator*(T n, ln_unit) → height_t constexpr noexcept
- Create a height from a number of terminal lines.
-
template <numeric T>auto operator*(T n, one_unit) → ratio_t constexpr noexcept
- Create a dimensionless ratio.
-
template <numeric T>auto operator*(T n, percent_unit) → percent_t constexpr noexcept
- Create a percentage value.
- auto operator*(width_t a, double b) → width_t constexpr noexcept
- Scale a width by a floating-point factor.
- auto operator*(double a, width_t b) → width_t constexpr noexcept
- Scale a width by a floating-point factor.
- auto operator*(height_t a, double b) → height_t constexpr noexcept
- Scale a height by a floating-point factor.
- auto operator*(double a, height_t b) → height_t constexpr noexcept
- Scale a height by a floating-point factor.
- auto operator*(percent_t a, double b) → percent_t constexpr noexcept
- Scale a percentage by a scalar.
- auto operator*(double a, percent_t b) → percent_t constexpr noexcept
- Scale a percentage by a scalar.
- auto operator+(width_t a, width_t b) → width_t constexpr noexcept
- Add widths.
- auto operator+(height_t a, height_t b) → height_t constexpr noexcept
- Add heights.
- auto operator+(ratio_t a, ratio_t b) → ratio_t constexpr noexcept
- Add ratios.
- auto operator+(percent_t a, percent_t b) → percent_t constexpr noexcept
- Add percentages.
- auto operator+(terminal_origin_t, width_t dx) → col_t constexpr noexcept
- Offset the terminal column origin by a width.
- auto operator+(terminal_origin_v_t, height_t dy) → row_t constexpr noexcept
- Offset the terminal row origin by a height.
- auto operator+(col_t p, width_t dx) → col_t constexpr noexcept
- Move a column to the right.
- auto operator+(row_t p, height_t dy) → row_t constexpr noexcept
- Move a row down.
- auto operator-(width_t a, width_t b) → width_t constexpr noexcept
- Subtract widths.
- auto operator-(height_t a, height_t b) → height_t constexpr noexcept
- Subtract heights.
- auto operator-(ratio_t a, ratio_t b) → ratio_t constexpr noexcept
- Subtract ratios.
- auto operator-(percent_t a, percent_t b) → percent_t constexpr noexcept
- Subtract percentages.
- auto operator-(col_t p, width_t dx) → col_t constexpr noexcept
- Move a column to the left.
- auto operator-(col_t a, col_t b) → width_t constexpr noexcept
- Distance between two columns.
- auto operator-(col_t p, terminal_origin_t) → width_t constexpr noexcept
- Convert a column back to a zero-based width from terminal origin.
- auto operator-(col_t p, ansi_origin_t) → width_t constexpr noexcept
- Convert a zero-based column to a one-based ANSI column value.
- auto operator-(row_t p, height_t dy) → row_t constexpr noexcept
- Move a row up.
- auto operator-(row_t a, row_t b) → height_t constexpr noexcept
- Distance between two rows.
- auto operator-(row_t p, terminal_origin_v_t) → height_t constexpr noexcept
- Convert a row back to a zero-based height from terminal origin.
- auto operator-(row_t p, ansi_origin_v_t) → height_t constexpr noexcept
- Convert a zero-based row to a one-based ANSI row value.
- auto operator/(percent_t a, double b) → percent_t constexpr noexcept
- Divide a percentage by a scalar.
-
template <numeric T>auto operator<(ratio_t a, T b) → bool constexpr noexcept
- Compare a ratio against a numeric value.
- auto operator<(percent_t a, ratio_t b) → bool constexpr noexcept
- Compare a percentage with a ratio after converting to a ratio.
-
template <numeric T>auto operator<=(ratio_t a, T b) → bool constexpr noexcept
- Compare a ratio against a numeric value.
- auto operator<=(percent_t a, ratio_t b) → bool constexpr noexcept
- Compare a percentage with a ratio after converting to a ratio.
-
template <numeric T>auto operator>(ratio_t a, T b) → bool constexpr noexcept
- Compare a ratio against a numeric value.
- auto operator>(percent_t a, ratio_t b) → bool constexpr noexcept
- Compare a percentage with a ratio after converting to a ratio.
-
template <numeric T>auto operator>=(ratio_t a, T b) → bool constexpr noexcept
- Compare a ratio against a numeric value.
- auto operator>=(percent_t a, ratio_t b) → bool constexpr noexcept
- Compare a percentage with a ratio after converting to a ratio.
- auto to_ansi(col_t col) → ansi_col_t constexpr noexcept
- Convert a terminal column to the representation used by ANSI writer calls.
- auto to_ansi(row_t row) → ansi_row_t constexpr noexcept
- Convert a terminal row to the representation used by ANSI writer calls.
- auto to_ansi_x(Pos pos) → ansi_col_t constexpr noexcept
- Convert a position's column for ANSI writer calls.
- auto to_ansi_y(Pos pos) → ansi_row_t constexpr noexcept
- Convert a position's row for ANSI writer calls.
Variables
- ansi_origin_t ansi_origin constexpr
- One-based ANSI-column origin.
- ansi_origin_v_t ansi_origin_v constexpr
- One-based ANSI-row origin.
- ch_unit ch constexpr
- Character-cell width unit.
- ln_unit ln constexpr
- Terminal line-height unit.
- one_unit one constexpr
- Dimensionless ratio unit.
- percent_unit percent constexpr
- Percent unit. A value of
100 * percentis equivalent to1 * one. - terminal_origin_t terminal_origin constexpr
- Zero-based terminal-column origin.
- terminal_origin_v_t terminal_origin_v constexpr
- Zero-based terminal-row origin.