Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
itextinput.h
1 #ifndef _ITEXTINPUT_H
2 #define _ITEXTINPUT_H
3 
4 namespace itasca {
10  struct InputLine {
11  inline InputLine(const QString &t,const QString &s,uint l,bool us,bool in=false)
12  : text_(t), source_(s), line_(l), undoStart_(us), interactive_(in), newAllowed_(true),
13  safeInterruptAllowed_(true), undone_(false) { }
14  QString text_; // Actual text line input.
15  QString source_; // Description of where the input came from, terminal, file, etc.
16  uint line_; // Line number of where the input came from, if applicable.
17  bool undoStart_; // TRUE if this line is a start of a block of 1 or more lines that
18  // can be undone.
19  bool interactive_; // TRUE if this line came from an interactive source.
20  bool newAllowed_; // TRUE if a model reset is allowed while processing this input
21  bool safeInterruptAllowed_; // TRUE if the input source supports repeatable interrupting.
22  bool undone_; // TRUE if a command that has been undone with smart undo, or a smart
23  // undo command.
24  };
25 
26  struct InputContext {
27  inline InputContext() : wait_(true), undoAllowed_(true), continuation_(false) { }
28  QString prompt_; // Prompt to use for interactive sources.
29  QString starting_; // Starting contents (if any) for prompted input.
30  bool wait_; // If TRUE will wait till input available, otherwise if none
31  // available will return with a null string immediately.
32  bool undoAllowed_; // If FALSE this input cannot be used as a starting mark for an UNDO
33  // operation, must skip over.
34  bool continuation_; // If TRUE this input is considered a continuation of a previous
35  // input, for the purposes of collecting input lines
36  // representing a single operation.
37  bool checkExpectedError_ = true; // Check each line of input for first '!' character, and tag input source if present.
38  };
39 
40  class ITextInput {
41  public:
47  virtual InputLine getInput(const InputContext &context)=0;
48  };
49 } // /namespace itasca
50 #endif
51 // EOF
52 
Provides a interface for getting text.
Definition: itextinput.h:10
Definition: itextinput.h:26
namespace Itasca
Definition: basememory.cpp:9
virtual InputLine getInput(const InputContext &context)=0
Definition: itextinput.h:40