Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
iinputitem.h
1 #pragma once
2 
3 #include "utility/interface/itextinput.h"
4 
5 namespace itascaxd {
6  using itasca::InputLine;
8 
9  class IInputItem {
10  public:
11  // Informational
12  // Type identifier constant.
13  virtual const char *getType() const=0;
14  // Return TRUE if the input source represents an interactive input
15  // (Keyboard, GUI, etc.)
16  // This activates things like pagination and prompts.
17  virtual bool isInteractive() const=0;
18  // Return a description of the input source.
19  virtual QString getName() const=0;
20  // Returns the number of lines input from this source.
21  virtual int getLineNumber() const=0;
22  // Should return TRUE if one can execute a NEW statement while reading from this source.
23  // FISH command/end_command blocks, for instance, do not allow a NEW.
24  virtual bool isNewAllowed() const=0;
25  // Returns TRUE if this is an input type than can be interrupted safely (and recover in a repeatable manner)
26  virtual bool canSafeInterrupt() const=0;
27  // Sets the suppress status of the input item.
28  // The idea is that echoing of command processing is suspended while reading input from this source.
29  // echo_at_start is the echo state when called, which is what the echo state should be restored
30  // to when done processing this input source.
31  virtual void suppressEcho(bool echo_at_start)=0;
32  // Return TRUE if echo during input processing should be suspended for this input source.
33  virtual bool isEchoSuppressed() const=0;
34  // Returns the state of echo when suppressEcho() was specfied, assuming it was specified.
35  virtual bool getEchoAtStart() const=0;
36  // Returns TRUE if this input item should be kept on the stack in the event of an error.
37  virtual bool getKeepOnError() const=0;
38  // If not null, this will be presented at the command line instead of the prompt supplied with input.
39  virtual QString getPromptOverride() const=0;
40  // Returns the path associated with input from this item, or NULL if no path is.
41  virtual QString getPath() const=0;
42  // Returns the string that will be used by the CALL command to open this input item *at it's current location*.
43  virtual QString getOpenString(QFileInfoList *list=nullptr) const=0;
44  // Add all files associated with this input item to the list of files associated with the model state.
45  virtual void addFiles() const=0;
46  virtual bool supportsInterruptState() const=0;
47  virtual bool getErrorExpected() const =0;
48  virtual void setErrorExpected(bool b) =0;
49 
50  // Communication
51  // Note that Open and Close will be called if the source calls another input source.
52  // Like a data file calling a new data file. So the InputItem should be prepared
53  // to respond to a close() followed by an open() by continuing input from where
54  // it left off.
55  virtual bool open()=0;
56  virtual bool close()=0;
57  // Returns a single String. Prompt is for interactive input, and start
58  // represents the initial String (also for interactive input).
59  virtual InputLine input(const InputContext &context)=0;
60  // Return TRUE to indicate that there is nothing left in the item to read.
61  virtual bool empty() const=0;
62 
63  virtual void destroy()=0;
64  };
65 } // namespace itascaxd
66 // EoF
Provides a interface for getting text.
Definition: itextinput.h:10
Definition: itextinput.h:26
Definition: iinputitem.h:9
Itasca Library standard namespace, specific to 2D or 3D.
Definition: icontactmodule.h:4