summaryrefslogtreecommitdiff
path: root/include/super.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-14 09:47:54 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-14 09:47:54 +0100
commit159781ee8257329ca9c40306f7495a8c2f31f710 (patch)
tree4d465797f334e27a836c0c41b4aa82d4fe5586ab /include/super.h
parentc9274ab3c422390998e628820afc6a27c12a1a57 (diff)
update documentation, added super.h and super.cpp files that I forgot in previous commit
Diffstat (limited to 'include/super.h')
-rw-r--r--include/super.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/include/super.h b/include/super.h
new file mode 100644
index 0000000..73e3761
--- /dev/null
+++ b/include/super.h
@@ -0,0 +1,76 @@
+/**
+ * Super.h
+ *
+ * The Super class is used to implement one of the super variables $_POST,
+ * $_GET, $_SERVER, et cetera
+ *
+ * @copyright 2014 Copernica BV
+ * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
+ */
+
+/**
+ * Set up namespace
+ */
+namespace Php {
+
+/**
+ * Class definition
+ */
+class Super
+{
+public:
+ /**
+ * Constructor
+ *
+ * Extension writers do not have to access the super-globals themselves.
+ * They are always accessible via Php::POST, Php::GET, et cetera.
+ *
+ * @param index number
+ */
+ Super(int index) : _index(index) {}
+
+ /**
+ * Destructor
+ */
+ virtual ~Super() {}
+
+ /**
+ * Array access operator
+ * This can be used for accessing associative arrays
+ * @param key
+ * @return Value
+ */
+ Value operator[](const std::string &key) const;
+
+ /**
+ * Array access operator
+ * This can be used for accessing associative arrays
+ * @param key
+ * @return Value
+ */
+ Value operator[](const char *key) const;
+
+private:
+ /**
+ * Index number
+ * @var int
+ */
+ int _index;
+};
+
+/**
+ * A number of super-globals are always accessible
+ */
+extern Super POST;
+extern Super GET;
+extern Super COOKIE;
+extern Super SERVER;
+extern Super ENV;
+extern Super FILES;
+extern Super REQUEST;
+
+/**
+ * End namespace
+ */
+}
+