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