Terminal++ 3.1.0.4
A C++ library for interacting with ANSI terminal windows
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
terminalpp::terminal Class Referencefinal

A class that encapsulates a terminal. More...

#include <terminal.hpp>

Public Types

using read_function = std::function< void(terminalpp::tokens)>
 
using write_function = std::function< void(terminalpp::bytes)>
 

Public Member Functions

template<typename Channel >
 terminal (Channel &channel, behaviour beh=behaviour{})
 Constructor.
 
 terminal (terminal const &)=delete
 Copy Constructor.
 
 ~terminal ()
 Destructor.
 
terminaloperator= (terminal const &)=delete
 Copy Assignment.
 
void async_read (std::function< void(tokens)> const &callback)
 Request that data be read from the terminal.
 
void write (bytes data)
 Write data to the terminal.
 
bool is_alive () const
 Returns whether the terminal is alive or not.
 
void close ()
 Closes the terminal.
 
void set_size (extent size)
 Sets the size of the terminal. This is used to determine cursor locations when writing text that wraps at the end of the line, etc.
 
terminaloperator<< (terminal_manipulator auto &&manip)
 Write to the terminal.
 
terminaloperator<< (terminalpp::element const &elem)
 Write a single element to the terminal.
 
terminaloperator<< (terminalpp::string const &text)
 Write an attributed string to the terminal.
 

Detailed Description

A class that encapsulates a terminal.

A class that is used to stream data in and out of a terminal.

Member Function Documentation

◆ operator<<()

terminal & terminalpp::terminal::operator<< ( terminal_manipulator auto &&  manip)
inline

Write to the terminal.

Usage
Stream in text, or use manipulators to modify the state of the terminal.
void raw_read(terminalpp::tokens);
void raw_write(terminalpp::bytes);
term << "Hello, world!"
<< move_cursor({17, 29});
A manipulator that outputs ANSI protocol bytes to move the cursor to the specified location.
Definition terminal.hpp:287
A class that encapsulates a terminal.
Definition terminal.hpp:30
A structure representing an ANSI graphics effect (e.g. intensity, underlining)
Definition effect.hpp:27
Writing your own manipulators.
A manipulator is streamable to a writer if is has a member function with the following signature:
void operator()(
terminalpp::terminal::write_function const &write_fn) const;
A set of flags that determine how a terminal should behave over a datastream.
Definition behaviour.hpp:12
The state of a terminal, which manipulators are allowed to use and edit.
Definition terminal_state.hpp:17

The documentation for this class was generated from the following files: