diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-29 01:51:07 -0700 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-29 01:51:07 -0700 |
commit | 8cb852a298cf8aa260883c5bc474bcf8cb7f9a76 (patch) | |
tree | fe34d039154dc9406ff4295d1dfe94d052052955 /include | |
parent | 05c421983a0a57fa735fcccee76ad67ca6c67ea4 (diff) |
Initial implementation for array access operators in Value class
Diffstat (limited to 'include')
-rw-r--r-- | include/value.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/include/value.h b/include/value.h index bf4beef..bc25eab 100644 --- a/include/value.h +++ b/include/value.h @@ -204,13 +204,19 @@ public: * The number of members in case of an array or object * @return int */ - int count(); + int count() + { + return size(); + } /** * The number of members in case of an array or object * @return int */ - int length(); + int length() + { + return size(); + } /** * Cast to an int @@ -255,7 +261,7 @@ public: * @param index * @return Value */ - Value &operator[](int index); + Value operator[](int index); /** * Array access operator @@ -264,7 +270,17 @@ public: * @param key * @return Value */ - Value &operator[](const std::string &key); + Value operator[](const std::string &key); + + /** + * Array access operator + * This can be used for adding a record to the array + * Be aware: if the 'this' object is not already an array, it will be converted into one! + * @param key + * @return Value + */ + //Value operator[](); + protected: /** |