summaryrefslogtreecommitdiffabout
path: root/include/kingate/cgi_interface.h
Unidiff
Diffstat (limited to 'include/kingate/cgi_interface.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/kingate/cgi_interface.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/include/kingate/cgi_interface.h b/include/kingate/cgi_interface.h
new file mode 100644
index 0000000..84ea6dd
--- a/dev/null
+++ b/include/kingate/cgi_interface.h
@@ -0,0 +1,70 @@
1#ifndef __KINGATE_CGI_INTERFACE_H
2#define __KINGATE_CGI_INTERFACE_H
3
4#include <iostream>
5#include <string>
6#include <map>
7
8/**
9 * @file
10 * @brief the abstract base for various interfaces to CGI.
11 */
12
13namespace kingate {
14 using namespace std;
15
16 /**
17 * The abstract base class for interface to CGI subsystem.
18 */
19 class cgi_interface {
20 public:
21 /**
22 * The type for map holding 'environment' meta-variables.
23 */
24 typedef map<string,string> metavars_t;
25 /**
26 * The environment variables.
27 */
28 metavars_t metavars;
29
30 cgi_interface() { }
31 virtual ~cgi_interface() { }
32
33 /**
34 * Check to see whether there is a particular 'environment'
35 * meta-variable passed.
36 * @param n the variable name.
37 * @return true if yes.
38 */
39 bool has_meta(const string& n) const;
40 /**
41 * Retrieve the 'environment' variable.
42 * @param n the variable name.
43 * @return the variable contents.
44 * @see exception_notfound
45 */
46 const string& get_meta(const string& n) const;
47
48 /**
49 * Fetch reference to CGI 'stdout' stream.
50 * @return reference to the corresponding ostream object.
51 */
52 virtual ostream& out() = 0;
53 /**
54 * Fetch reference to CGI 'stdin' stream.
55 * @return reference to the corresponding istream object.
56 */
57 virtual istream& in() = 0;
58 /**
59 * Fetch reference to CGI 'stderr' stream.
60 * @return reference to the corresponding ostream object.
61 */
62 virtual ostream& err() = 0;
63 };
64
65}
66
67#endif /* __KINGATE_CGI_INTERFACE_H */
68/*
69 * vim:set ft=cpp:
70 */