summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMartijn Otto <martijn.otto@copernica.com>2014-02-05 14:36:23 +0100
committerMartijn Otto <martijn.otto@copernica.com>2014-02-05 14:36:23 +0100
commit30aeb60818c9d4b0318848d7dc83062f9c78b804 (patch)
tree8cecc83d7b7c6d17078013b9e30792c71d52b8c6 /include
parent07d047f1645a79284ae45c0f809f59d615698df6 (diff)
Added include guard and allow array access operator on a const Value object
Diffstat (limited to 'include')
-rw-r--r--include/value.h33
1 files changed, 33 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