summaryrefslogtreecommitdiffabout
path: root/include/kingate/cgi_interface.h
Side-by-side diff
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 @@
+#ifndef __KINGATE_CGI_INTERFACE_H
+#define __KINGATE_CGI_INTERFACE_H
+
+#include <iostream>
+#include <string>
+#include <map>
+
+/**
+ * @file
+ * @brief the abstract base for various interfaces to CGI.
+ */
+
+namespace kingate {
+ using namespace std;
+
+ /**
+ * The abstract base class for interface to CGI subsystem.
+ */
+ class cgi_interface {
+ public:
+ /**
+ * The type for map holding 'environment' meta-variables.
+ */
+ typedef map<string,string> metavars_t;
+ /**
+ * The environment variables.
+ */
+ metavars_t metavars;
+
+ cgi_interface() { }
+ virtual ~cgi_interface() { }
+
+ /**
+ * Check to see whether there is a particular 'environment'
+ * meta-variable passed.
+ * @param n the variable name.
+ * @return true if yes.
+ */
+ bool has_meta(const string& n) const;
+ /**
+ * Retrieve the 'environment' variable.
+ * @param n the variable name.
+ * @return the variable contents.
+ * @see exception_notfound
+ */
+ const string& get_meta(const string& n) const;
+
+ /**
+ * Fetch reference to CGI 'stdout' stream.
+ * @return reference to the corresponding ostream object.
+ */
+ virtual ostream& out() = 0;
+ /**
+ * Fetch reference to CGI 'stdin' stream.
+ * @return reference to the corresponding istream object.
+ */
+ virtual istream& in() = 0;
+ /**
+ * Fetch reference to CGI 'stderr' stream.
+ * @return reference to the corresponding ostream object.
+ */
+ virtual ostream& err() = 0;
+ };
+
+}
+
+#endif /* __KINGATE_CGI_INTERFACE_H */
+/*
+ * vim:set ft=cpp:
+ */