diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-14 09:47:54 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-14 09:47:54 +0100 |
commit | 159781ee8257329ca9c40306f7495a8c2f31f710 (patch) | |
tree | 4d465797f334e27a836c0c41b4aa82d4fe5586ab /src/super.cpp | |
parent | c9274ab3c422390998e628820afc6a27c12a1a57 (diff) |
update documentation, added super.h and super.cpp files that I forgot in previous commit
Diffstat (limited to 'src/super.cpp')
-rw-r--r-- | src/super.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/super.cpp b/src/super.cpp new file mode 100644 index 0000000..6b02916 --- /dev/null +++ b/src/super.cpp @@ -0,0 +1,59 @@ +/** + * Super.cpp + * + * @copyright 2014 Copernica BV + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + */ +#include "includes.h" + +/** + * Set up namespace + */ +namespace Php { + +/** + * A number of super-globals are always accessible + */ +Super POST (TRACK_VARS_POST); +Super GET (TRACK_VARS_GET); +Super COOKIE (TRACK_VARS_COOKIE); +Super SERVER (TRACK_VARS_SERVER); +Super ENV (TRACK_VARS_ENV); +Super FILES (TRACK_VARS_FILES); +Super REQUEST (TRACK_VARS_REQUEST); + +/** + * Array access operator + * This can be used for accessing associative arrays + * @param key + * @return Value + */ +Value Super::operator[](const std::string &key) const +{ + // create a value object that wraps around the actual zval + Value value(PG(http_globals)[_index]); + + // pass on the call + return value[key]; +} + +/** + * Array access operator + * This can be used for accessing associative arrays + * @param key + * @return Value + */ +Value Super::operator[](const char *key) const +{ + // create a value object that wraps around the actual zval + Value value(PG(http_globals)[_index]); + + // pass on the call + return value[key]; +} + +/** + * End namespace + */ +} + |