TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
tmk::app::tui Namespace Reference

Namespaces

namespace  key

Classes

struct  Field
 One command-line option as the screen shows it. More...
struct  Entry
 One line of an options file: name = value. More...
struct  Span
struct  Line
 One screen line: text is the plain text (what a test or a monochrome terminal sees), spans the same in pieces with their styles. More...
class  Model

Enumerations

enum class  Scope { run = 0 , global = 1 , project = 2 , file = 3 }
 Where a value comes from, lowest precedence first. More...
enum class  Action {
  none , quit , run , print ,
  save
}
enum class  Style {
  plain , frame , title , heading ,
  dim , label , key , code ,
  ok , warn , error , accent ,
  global , project , file , run ,
  tag_global , tag_project , tag_file , tag_run
}
 How a piece of text is painted. More...

Functions

const char * scope_name (Scope s)
 "this run", "global", "project", "file"
std::vector< Entry > parse_options (const std::string &text)
int truth (const std::string &value)
 A flag's value in an options file: 1 for true/on/yes/1, 0 for false/off/no/0, -1 for anything else.
std::size_t display_width (const std::string &s)
 Columns the text takes (UTF-8 characters count one each, which is right for the box-drawing characters).
void save_options (Model &m)
 Writes the target scope's options to its file (creating the folder) and reports the outcome in the status line.
Action run_terminal (Model &m)
 Runs the model on the controlling terminal (/dev/tty, so standard output stays free for print) until the user quits, runs or prints.
Action run_keys (Model &m, const std::string &keys)
 The same for a scripted key sequence (tests): characters stand for themselves, and <up> <down> <pgup> <pgdn> <home> <end> <enter> <space> <esc> <bs> <del> <lt> name the others.

Variables

constexpr int kScopes = 4

Enumeration Type Documentation

◆ Action

enum class tmk::app::tui::Action
strong
Enumerator
none 
quit 
run 
print 
save 

Definition at line 54 of file tui.hpp.

◆ Scope

enum class tmk::app::tui::Scope
strong

Where a value comes from, lowest precedence first.

run is what belongs to one run (board, output) and is never written to a file; global is the user's options for every board, project the options of the board's folder and file a file named with –config. A higher scope overrides a lower one.

Enumerator
run 
global 
project 
file 

Definition at line 18 of file tui.hpp.

◆ Style

enum class tmk::app::tui::Style
strong

How a piece of text is painted.

The terminal layer maps these to colours (or to bold, dim and reverse under NO_COLOR); the model only says what the text is.

Enumerator
plain 
frame 
title 
heading 
dim 
label 
key 
code 
ok 
warn 
error 
accent 
global 
project 
file 
run 

a value or a name of that scope

tag_global 
tag_project 
tag_file 
tag_run 

Definition at line 58 of file tui.hpp.

Function Documentation

◆ display_width()

std::size_t tmk::app::tui::display_width ( const std::string & s)

Columns the text takes (UTF-8 characters count one each, which is right for the box-drawing characters).

◆ parse_options()

std::vector< Entry > tmk::app::tui::parse_options ( const std::string & text)

◆ run_keys()

Action tmk::app::tui::run_keys ( Model & m,
const std::string & keys )

The same for a scripted key sequence (tests): characters stand for themselves, and <up> <down> <pgup> <pgdn> <home> <end> <enter> <space> <esc> <bs> <del> <lt> name the others.

Ends with print when the keys run out.

◆ run_terminal()

Action tmk::app::tui::run_terminal ( Model & m)

Runs the model on the controlling terminal (/dev/tty, so standard output stays free for print) until the user quits, runs or prints.

Options files are written here. Throws std::runtime_error without a terminal.

◆ save_options()

void tmk::app::tui::save_options ( Model & m)

Writes the target scope's options to its file (creating the folder) and reports the outcome in the status line.

◆ scope_name()

const char * tmk::app::tui::scope_name ( Scope s)

"this run", "global", "project", "file"

◆ truth()

int tmk::app::tui::truth ( const std::string & value)

A flag's value in an options file: 1 for true/on/yes/1, 0 for false/off/no/0, -1 for anything else.

Variable Documentation

◆ kScopes

int tmk::app::tui::kScopes = 4
inlineconstexpr

Definition at line 19 of file tui.hpp.