BAM
Abstract Machine for Bottom-Up Evaluation with the Push Method
in_kbd.h
Go to the documentation of this file.
1 // ============================================================================
2 // Project: Deductive Database
3 // Filename: in_kbd.h
4 // Purpose: Get Input Interactively (From Keyboard)
5 // Last Change: 03.08.2017
6 // Language: C++
7 // EMail: brass@informatik.uni-halle.de
8 // WWW: http://www.informatik.uni-halle.de/~brass/
9 // Address: Feldschloesschen 15, D-06120 Halle (Saale), GERMANY
10 // Copyright: (c) 1997-2017 by Stefan Brass
11 // License: See file "LICENSE" for copying conditions.
12 // Note: There is no warranty at all - this code may contain bugs.
13 // ============================================================================
14 
15 
22 //=============================================================================
23 // Include File Frame:
24 //=============================================================================
25 
26 #ifndef IN_KBD_INCLUDED
27 #define IN_KBD_INCLUDED
28 
29 //=============================================================================
30 // Used Types and Macros:
31 //=============================================================================
32 
33 #ifndef STR_INCLUDED
34 #include "../base/str.h"
35 #endif
36 
37 #ifndef CHECK_INCLUDED
38 #include "../base/check.h"
39 #endif
40 
41 #ifndef IN_INCLUDED
42 #include "in.h"
43 #endif
44 
45 //=============================================================================
46 // Class for Input File:
47 //=============================================================================
48 
49 class in_kbd_c : public in_c {
50 
51  public:
52 
53 //-----------------------------------------------------------------------------
54 // Methods:
55 //-----------------------------------------------------------------------------
56 
57 
58  // Constructor:
59  in_kbd_c();
60 
61  // Destructor:
62  ~in_kbd_c();
63 
64  // close: Close input explicitly.
65  bool close();
66 
67  // read: Read characters from input file into buffer.
68  int read(char *buf, int size);
69 
70  // is_open: Is this input stream currently open?
71  inline bool is_open()
72  { return Open; }
73 
74  // filename: Name of this "file".
75  inline str_t filename()
76  { return STR_NULL; }
77 
78 //-----------------------------------------------------------------------------
79 // Private Members:
80 //-----------------------------------------------------------------------------
81 
82  private:
83 
84  // Open: Remember whether input was closed.
85  bool Open;
86 
87  // AtEOF: Was an end of file seen already?
88  bool AtEOF;
89 
90 //=============================================================================
91 // End of Class:
92 //=============================================================================
93 
94 };
95 
96 //-----------------------------------------------------------------------------
97 // Define pointer type:
98 //-----------------------------------------------------------------------------
99 
100 typedef in_kbd_c *in_kbd_t;
101 
102 //-----------------------------------------------------------------------------
103 // Define null pointer:
104 //-----------------------------------------------------------------------------
105 
106 #define IN_KBD_NULL (static_cast<in_kbd_t>(0))
107 
108 //=============================================================================
109 // End of File:
110 //=============================================================================
111 
112 #endif
113 
Definition: in.h:50
Superclass of input sources (e.g., file)
int read(char *buf, int size)
Definition: in_kbd.cpp:73
Definition: in_kbd.h:49
const char * str_t
Definition: str.h:41
#define STR_NULL
Definition: str.h:52