![]() |
TSDuck v3.46-4930
MPEG Transport Stream Toolkit
|
#include <tsEditLine.h>
Public Member Functions | |
| EditLine (const UString &prompt=DefaultPrompt(), const UString &next_prompt=DefaultNextPrompt(), const UString &history_file=DefaultHistoryFile(), size_t history_size=DefaultHistorySize()) | |
| ~EditLine () | |
| bool | readLine (UString &line, bool skip_empty=true, bool trim=true, bool continuing=true) |
Static Public Member Functions | |
| static UString | DefaultHistoryFile () |
| static size_t | DefaultHistorySize () |
| static UString | DefaultNextPrompt () |
| static UString | DefaultPrompt () |
| static void | SetDefaultHistoryFile (const UString &history_file) |
| static void | SetDefaultHistorySize (size_t history_size) |
| static void | setDefaultNextPrompt (const UString &prompt) |
| static void | setDefaultPrompt (const UString &prompt) |
Read input lines with bash-like line editing when possible.
| ts::EditLine::EditLine | ( | const UString & | prompt = DefaultPrompt(), |
| const UString & | next_prompt = DefaultNextPrompt(), | ||
| const UString & | history_file = DefaultHistoryFile(), | ||
| size_t | history_size = DefaultHistorySize() ) |
Constructor.
| [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. |
| ts::EditLine::~EditLine | ( | ) |
Destructor.
|
inlinestatic |
Get the default history file name. The default initial file location depends on the operating system:
%APPDATA%\tsduck\.tshistory$HOME/.tshistory
|
inlinestatic |
Set the default history file name.
| [in] | history_file | The default history file name. |
|
inlinestatic |
Get the default maximum number of history lines to save. The initial default is 100 lines.
|
inlinestatic |
Set the default maximum number of history lines to save.
| [in] | history_size | The default maximum number of history lines to save. |
|
inlinestatic |
Get the default command line prompt. The initial default is "> ".
|
inlinestatic |
Set the default command line prompt.
| [in] | prompt | Command line prompt. |
|
inlinestatic |
Get the default command line prompt for continuation lines (after a backslash). The initial default is ">>> ".
|
inlinestatic |
Set the default command line prompt for continuation lines (after a backslash).
| [in] | prompt | Command line prompt for continuation lines. |
| bool ts::EditLine::readLine | ( | UString & | line, |
| bool | skip_empty = true, | ||
| bool | trim = true, | ||
| bool | continuing = true ) |
Read one line of input.
| [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. |