OpenASIP
2.0
|
#include <BaseLineReader.hh>
Public Member Functions | |
BaseLineReader (std::istream &iStream=std::cin, std::ostream &oStream=std::cout) | |
virtual | ~BaseLineReader () |
virtual void | initialize (std::string defPrompt="", FILE *in=stdin, FILE *out=stdout, FILE *err=stderr) |
virtual void | setPromptPrinting (bool flag) |
virtual std::string | readLine (std::string prompt="") |
virtual char | charQuestion (std::string question, std::string allowedChars, bool caseSensitive=false, char defaultAnswer='\0') |
Public Member Functions inherited from LineReader | |
LineReader (std::istream &iStream=std::cin, std::ostream &oStream=std::cout) | |
virtual | ~LineReader () |
virtual std::ostream & | outputStream () |
bool | confirmation (std::string question, char defaultAnswer='n', char yesChar='y', char noChar='n') |
virtual void | setSaveInputHistoryToFile (bool flag) |
virtual bool | saveInputHistoryToFile () const |
virtual void | setInputHistoryLog (const std::string &historyFilename) |
virtual void | setInputHistoryLength (std::size_t length) |
virtual size_t | inputHistoryMaxLength () const |
virtual std::size_t | inputsInHistory () const |
virtual std::string | inputHistoryEntry (std::size_t age) const |
Private Member Functions | |
BaseLineReader (const BaseLineReader &) | |
Copying not allowed. More... | |
BaseLineReader & | operator= (const BaseLineReader &) |
Assignment not allowed. More... | |
void | printPrompt () const |
Private Attributes | |
std::string | prompt_ |
Prompt of the reader. More... | |
FILE * | in_ |
Input stream. More... | |
FILE * | out_ |
Output stream. More... | |
FILE * | error_ |
Error stream. More... | |
std::istream & | iStream_ |
Input stream. More... | |
std::ostream & | oStream_ |
Output stream. More... | |
bool | promptPrinting_ |
Prompt printing flag. More... | |
Static Private Attributes | |
static const int | MAX_LINE_LENGTH = 256 |
Additional Inherited Members | |
Protected Member Functions inherited from LineReader | |
void | setInitialized () |
bool | initialized () const |
void | putInInputHistory (const std::string &inputLine) |
Handles the basic line reading without a use of any fancy libraries.
This LineReader is used only when nothing else is available. This LineReader supports only reading from std::cin and outputing to std::cout.
Definition at line 47 of file BaseLineReader.hh.
BaseLineReader::BaseLineReader | ( | std::istream & | iStream = std::cin , |
std::ostream & | oStream = std::cout |
||
) |
|
virtual |
|
private |
Copying not allowed.
|
virtual |
User is asked a question, and answer is excepted to be one character.
question | Question to be asked. |
allowedChars | Chars allowed in answer. |
caseSensitive | If true answer is treated case sensitive. |
defaultAnswer | Default answer for the question. |
ObjectNotInitialized | If LineReader is not initialized. |
Implements LineReader.
Definition at line 132 of file BaseLineReader.cc.
References assert, StringTools::containsChar(), LineReader::initialized(), iStream_, printPrompt(), and prompt_.
|
virtual |
Initializes the reader.
prompt | Prompt for the reader. |
in | Input stream. Not used, input is always cin. |
out | Output stream. Not used, output is always cout. |
err | Error stream. Not used, error output is always cerr. |
Implements LineReader.
Definition at line 65 of file BaseLineReader.cc.
References prompt_, and LineReader::setInitialized().
Referenced by DesignSpaceExplorer::simulate().
|
private |
Assignment not allowed.
|
private |
Prints the prompt.
Definition at line 177 of file BaseLineReader.cc.
References oStream_, and prompt_.
Referenced by charQuestion(), and readLine().
|
virtual |
Reads a line from the input stream.
prompt | The prompt to be used. |
ObjectNotInitialized | If LineReader is not initialized. |
EndOfFile | When end of file mark is received. |
Implements LineReader.
Definition at line 96 of file BaseLineReader.cc.
References __func__, LineReader::initialized(), iStream_, printPrompt(), prompt_, and promptPrinting_.
Referenced by DesignSpaceExplorer::simulate().
|
virtual |
Disables/enables printing of prompt altogether.
flag |
Definition at line 82 of file BaseLineReader.cc.
References promptPrinting_.
Referenced by DesignSpaceExplorer::simulate().
|
private |
Error stream.
Definition at line 84 of file BaseLineReader.hh.
|
private |
Input stream.
Definition at line 80 of file BaseLineReader.hh.
|
private |
Input stream.
Definition at line 86 of file BaseLineReader.hh.
Referenced by charQuestion(), and readLine().
|
staticprivate |
Definition at line 75 of file BaseLineReader.hh.
|
private |
|
private |
Output stream.
Definition at line 82 of file BaseLineReader.hh.
|
private |
Prompt of the reader.
Definition at line 78 of file BaseLineReader.hh.
Referenced by charQuestion(), initialize(), printPrompt(), and readLine().
|
private |
Prompt printing flag.
Definition at line 90 of file BaseLineReader.hh.
Referenced by readLine(), and setPromptPrinting().