From 159781ee8257329ca9c40306f7495a8c2f31f710 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Fri, 14 Mar 2014 09:47:54 +0100 Subject: update documentation, added super.h and super.cpp files that I forgot in previous commit --- include/super.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 include/super.h (limited to 'include/super.h') 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 + */ + +/** + * 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 + */ +} + -- cgit v1.2.3