Go to the documentation of this file.
35 #ifndef TTA_LINE_READER_HH
36 #define TTA_LINE_READER_HH
55 std::istream& iStream = std::cin, std::ostream& oStream = std::cout);
59 std::string defPrompt =
"",
62 FILE* err = stderr) = 0;
64 virtual std::string
readLine(std::string prompt =
"") = 0;
69 std::string question, std::string allowedChars,
70 bool caseSensitive =
false,
char defaultAnswer =
'\0') = 0;
73 std::string question,
char defaultAnswer =
'n',
char yesChar =
'y',
112 #define DEFAULT_INPUT_HISTORY_SIZE 50
std::deque< std::string > inputHistory_
The input history.
LineReader & operator=(const LineReader &)
Assignment not allowed.
void putInInputHistory(const std::string &inputLine)
virtual void setInputHistoryLog(const std::string &historyFilename)
bool saveHistoryToFile_
Should the history be appended in a file?
virtual char charQuestion(std::string question, std::string allowedChars, bool caseSensitive=false, char defaultAnswer='\0')=0
virtual size_t inputHistoryMaxLength() const
virtual std::string readLine(std::string prompt="")=0
std::string historyFilename_
The filename to write the command history to.
std::size_t inputHistorySize_
The maximum size for input history.
virtual std::size_t inputsInHistory() const
virtual void setSaveInputHistoryToFile(bool flag)
std::ostream & oStream_
The output stream.
LineReader(std::istream &iStream=std::cin, std::ostream &oStream=std::cout)
virtual std::string inputHistoryEntry(std::size_t age) const
virtual void setInputHistoryLength(std::size_t length)
bool initialized_
Flag indicating whether LineReader is initialized.
virtual std::ostream & outputStream()
virtual void initialize(std::string defPrompt="", FILE *in=stdin, FILE *out=stdout, FILE *err=stderr)=0
std::istream & iStream_
The input stream.
virtual bool saveInputHistoryToFile() const
bool confirmation(std::string question, char defaultAnswer='n', char yesChar='y', char noChar='n')
std::ofstream * historyFile_
The output stream to write the command history to.