diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-12 17:04:26 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-12 17:04:26 +0200 |
| commit | bd1ae77694bf3257f02f2d16ce58481115fe14db (patch) | |
| tree | ba7c8f66285ee9da84560b405b7955429657bd45 /include | |
| parent | 63460f29957ed2e28ee35ee8a92432fe446e0936 (diff) | |
| download | Project-Tick-bd1ae77694bf3257f02f2d16ce58481115fe14db.tar.gz Project-Tick-bd1ae77694bf3257f02f2d16ce58481115fe14db.zip | |
Add list accessors to value
Diffstat (limited to 'include')
| -rw-r--r-- | include/value.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/value.h b/include/value.h index 02937c8f5e..a03395c2d1 100644 --- a/include/value.h +++ b/include/value.h @@ -125,11 +125,34 @@ public: * @brief In case of a tag_compound, accesses a tag by key * * If the value is uninitialized, the behavior is undefined. + * @throw std::bad_cast if the tag type is not tag_compound * @sa tag_compound::operator[] */ value& operator[](const std::string& key); value& operator[](const char* key); //need this overload because of conflict with built-in operator[] + /** + * @brief In case of a tag_list, accesses a tag by index with bounds checking + * + * If the value is uninitialized, the behavior is undefined. + * @throw std::bad_cast if the tag type is not tag_list + * @throw std::out_of_range if the index is out of range + * @sa tag_list::at + */ + value& at(size_t i); + const value& at(size_t i) const; + + /** + * @brief In case of a tag_list, accesses a tag by index + * + * No bounds checking is performed. If the value is uninitialized, the + * behavior is undefined. + * @throw std::bad_cast if the tag type is not tag_list + * @sa tag_list::operator[] + */ + value& operator[](size_t i); + const value& operator[](size_t i) const; + std::unique_ptr<tag>& get_ptr(); const std::unique_ptr<tag>& get_ptr() const; void set_ptr(std::unique_ptr<tag>&& t); |
