BAM
Abstract Machine for Bottom-Up Evaluation with the Push Method
in_cgi.h
Go to the documentation of this file.
1 // ============================================================================
2 // Project: Deductive Database
3 // Filename: in_cgi.h
4 // Purpose: Get Input Via Common Gateway Interface (CGI) - Method POST
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) 1998-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_CGI_INCLUDED
27 #define IN_CGI_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_cgi_c : public in_c {
50 
51  public:
52 
53 //-----------------------------------------------------------------------------
54 // Constructor:
55 //-----------------------------------------------------------------------------
56 
57  in_cgi_c();
58 
59 //-----------------------------------------------------------------------------
60 // Destructor:
61 //-----------------------------------------------------------------------------
62 
63  ~in_cgi_c();
64 
65 //-----------------------------------------------------------------------------
66 // close: Close input explicitly.
67 //-----------------------------------------------------------------------------
68 
69  bool close();
70 
71 //-----------------------------------------------------------------------------
72 // read: Read characters from input file into buffer.
73 //-----------------------------------------------------------------------------
74 
75  int read(char *buf, int size);
76 
77 //-----------------------------------------------------------------------------
78 // is_open: Is this input stream currently open?
79 //-----------------------------------------------------------------------------
80 
81  inline bool is_open()
82  { return(BufPtr != 0); }
83 
84 //-----------------------------------------------------------------------------
85 // filename: Name of this "file" (None).
86 //-----------------------------------------------------------------------------
87 
88  inline str_t filename()
89  { return STR_NULL; }
90 
91 //=============================================================================
92 // Private Class Members:
93 //=============================================================================
94 
95  private:
96 
97 //-----------------------------------------------------------------------------
98 // Buf: Input buffer.
99 //-----------------------------------------------------------------------------
100 
101  char* Buf;
102 
103 //-----------------------------------------------------------------------------
104 // BufSize: Size of input buffer.
105 //-----------------------------------------------------------------------------
106 
107  int BufSize;
108 
109 //-----------------------------------------------------------------------------
110 // BufPtr: Pointer to character in buffer which will be returned on next read.
111 //-----------------------------------------------------------------------------
112 
113  char* BufPtr;
114 
115 //=============================================================================
116 // Auxillary Functions:
117 //=============================================================================
118 
119  private:
120 
121 //-----------------------------------------------------------------------------
122 // input_size: Check the relevant environment variables, return input size.
123 //-----------------------------------------------------------------------------
124 
125  int input_size();
126 
127 //-----------------------------------------------------------------------------
128 // decode: Decode a HTTP-string.
129 //-----------------------------------------------------------------------------
130 
131  bool decode(char* buf);
132 
133 //-----------------------------------------------------------------------------
134 // hex: Return value of hexadecimal digit (-1000 if not valid).
135 //-----------------------------------------------------------------------------
136 
137  int hex(char c);
138 
139 //=============================================================================
140 // End of Class:
141 //=============================================================================
142 
143 };
144 
145 //-----------------------------------------------------------------------------
146 // Define pointer type:
147 //-----------------------------------------------------------------------------
148 
149 typedef in_cgi_c *in_cgi_t;
150 
151 //-----------------------------------------------------------------------------
152 // Define null pointer:
153 //-----------------------------------------------------------------------------
154 
155 #define IN_CGI_NULL (static_cast<in_cgi_t>(0))
156 
157 
158 //=============================================================================
159 // End of File:
160 //=============================================================================
161 
162 #endif
163 
Definition: in_cgi.h:49
Definition: in.h:50
Superclass of input sources (e.g., file)
const char * str_t
Definition: str.h:41
#define STR_NULL
Definition: str.h:52