Itasca C++ Interface
Loading...
Searching...
No Matches
iinputitem.h
1#pragma once
2
3#include "utility/interface/itextinput.h"
4
5namespace itascaxd {
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 // Returns TRUE if this is an input type than can be interrupted safely (and recover in a repeatable manner)
24 virtual bool canSafeInterrupt() const=0;
25 // Sets the suppress status of the input item.
26 // The idea is that echoing of command processing is suspended while reading input from this source.
27 // echo_at_start is the echo state when called, which is what the echo state should be restored
28 // to when done processing this input source.
29 virtual void suppressEcho(bool echo_at_start)=0;
30 // Return TRUE if echo during input processing should be suspended for this input source.
31 virtual bool isEchoSuppressed() const=0;
32 // Returns the state of echo when suppressEcho() was specfied, assuming it was specified.
33 virtual bool getEchoAtStart() const=0;
34 // Returns TRUE if this input item should be kept on the stack in the event of an error.
35 virtual bool getKeepOnError() const=0;
36 // If not null, this will be presented at the command line instead of the prompt supplied with input.
37 virtual string getPromptOverride() const=0;
38 // Returns the path associated with input from this item, or NULL if no path is.
39 virtual IString getPath() const=0;
40 // Returns the string that will be used by the CALL command to open this input item *at it's current location*.
41 virtual std::tuple<string,StringList> getOpenString() const=0;
42 // Add all files associated with this input item to the list of files associated with the model state.
43 virtual void addFiles() const=0;
44 virtual bool supportsInterruptState() const=0;
45 virtual bool getErrorExpected() const =0;
46 virtual void setErrorExpected(bool b) =0;
47
48 // Communication
49 // Note that Open and Close will be called if the source calls another input source.
50 // Like a data file calling a new data file. So the InputItem should be prepared
51 // to respond to a close() followed by an open() by continuing input from where
52 // it left off.
53 virtual bool open()=0;
54 virtual bool close()=0;
55 // Returns a single String. Prompt is for interactive input, and start
56 // represents the initial String (also for interactive input).
57 virtual InputLine input(const InputContext &context)=0;
58 // Return TRUE to indicate that there is nothing left in the item to read.
59 virtual bool empty() const=0;
60
61 virtual void destroy()=0;
62 };
63} // namespace itascaxd
64// EoF
Definition istring.h:14
Definition iinputitem.h:9
EXPORT_TAG const char * getName()
Definition fishexample.cpp:43
Itasca Library standard namespace, specific to 2D or 3D.
Definition icontactmodule.h:4
Definition itextinput.h:24
Provides a interface for getting text.
Definition itextinput.h:10