Read input lines with bash-like line editing when possible.
More...
#include <tsEditLine.h>
Read input lines with bash-like line editing when possible.
◆ EditLine()
Constructor.
- Parameters
-
[in] | prompt | Command line prompt. |
[in] | next_prompt | Command line prompt. |
[in] | history_file | File to load/save the history. The history is loaded in the constructor and saved in the destructor. If empty, no history is loaded. |
[in] | history_size | Maximum number of history lines to save. |
◆ DefaultHistoryFile()
static UString ts::EditLine::DefaultHistoryFile |
( |
| ) |
|
|
inlinestatic |
Get the default history file name.
The default initial file location depends on the operating system:
- Windows:
%APPDATA%\tsduck\
.tshistory
- Unix:
$HOME/
.tshistory - Returns
- The default history file name.
◆ SetDefaultHistoryFile()
static void ts::EditLine::SetDefaultHistoryFile |
( |
const UString & |
history_file | ) |
|
|
inlinestatic |
Set the default history file name.
- Parameters
-
[in] | history_file | The default history file name. |
◆ DefaultHistorySize()
static size_t ts::EditLine::DefaultHistorySize |
( |
| ) |
|
|
inlinestatic |
Get the default maximum number of history lines to save.
The initial default is 100 lines.
- Returns
- The default maximum number of history lines to save.
◆ SetDefaultHistorySize()
static void ts::EditLine::SetDefaultHistorySize |
( |
size_t |
history_size | ) |
|
|
inlinestatic |
Set the default maximum number of history lines to save.
- Parameters
-
[in] | history_size | The default maximum number of history lines to save. |
◆ DefaultPrompt()
static UString ts::EditLine::DefaultPrompt |
( |
| ) |
|
|
inlinestatic |
Get the default command line prompt.
The initial default is "> ".
- Returns
- The default command line prompt.
◆ setDefaultPrompt()
static void ts::EditLine::setDefaultPrompt |
( |
const UString & |
prompt | ) |
|
|
inlinestatic |
Set the default command line prompt.
- Parameters
-
[in] | prompt | Command line prompt. |
◆ DefaultNextPrompt()
static UString ts::EditLine::DefaultNextPrompt |
( |
| ) |
|
|
inlinestatic |
Get the default command line prompt for continuation lines (after a backslash).
The initial default is ">>> ".
- Returns
- The default command line prompt for continuation lines.
◆ setDefaultNextPrompt()
static void ts::EditLine::setDefaultNextPrompt |
( |
const UString & |
prompt | ) |
|
|
inlinestatic |
Set the default command line prompt for continuation lines (after a backslash).
- Parameters
-
[in] | prompt | Command line prompt for continuation lines. |
◆ readLine()
bool ts::EditLine::readLine |
( |
UString & |
line, |
|
|
bool |
skip_empty = true , |
|
|
bool |
trim = true , |
|
|
bool |
continuing = true |
|
) |
| |
Read one line of input.
- Parameters
-
[out] | line | Returned line. |
[in] | skip_empty | Skip empty lines, continue reading until a non-empty line is read. |
[in] | trim | Trim leading and trailing spaces. |
[in] | continuing | Continue reading lines when the end of line is a backslash and return a full rebuilt line. |
- Returns
- True on success, false on error (typically end of input).
The documentation for this class was generated from the following file: