diff options
author | Martijn Otto <martijn.otto@copernica.com> | 2014-02-05 14:36:23 +0100 |
---|---|---|
committer | Martijn Otto <martijn.otto@copernica.com> | 2014-02-05 14:36:23 +0100 |
commit | 30aeb60818c9d4b0318848d7dc83062f9c78b804 (patch) | |
tree | 8cecc83d7b7c6d17078013b9e30792c71d52b8c6 | |
parent | 07d047f1645a79284ae45c0f809f59d615698df6 (diff) |
Added include guard and allow array access operator on a const Value object
-rw-r--r-- | include/value.h | 33 | ||||
-rw-r--r-- | phpcpp.h | 4 |
2 files changed, 37 insertions, 0 deletions
diff --git a/include/value.h b/include/value.h index 09392ad..6b764a2 100644 --- a/include/value.h +++ b/include/value.h @@ -514,6 +514,17 @@ public: /** * Array access operator + * This can be used for accessing arrays + * @param index + * @return Value + */ + Value operator[](int index) const + { + return get(index); + } + + /** + * Array access operator * This can be used for accessing associative arrays * @param key * @return Member @@ -524,11 +535,33 @@ public: * Array access operator * This can be used for accessing associative arrays * @param key + * @return Value + */ + Value operator[](const std::string &key) const + { + return get(key); + } + + /** + * Array access operator + * This can be used for accessing associative arrays + * @param key * @return HashMember */ HashMember<std::string> operator[](const char *key); /** + * Array access operator + * This can be used for accessing associative arrays + * @param key + * @return Value + */ + Value operator[](const char *key) const + { + return get(key); + } + + /** * Call the function in PHP * We have ten variants of this function, depending on the number of parameters * This call operator is only useful when the variable represents a callable @@ -7,6 +7,9 @@ * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> */ +#ifndef PHPCPP_H +#define PHPCPP_H + /** * Other C and C++ libraries that PhpCpp depends on */ @@ -55,3 +58,4 @@ # define PHPCPP_EXPORT #endif +#endif /* phpcpp.h */ |