diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-03 16:51:34 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-03 16:51:34 +0200 |
| commit | b64e3db8d02ba4668a3175163fe438c57cff16e4 (patch) | |
| tree | 9ff72a1d683cf33f34edbb2568c68dce978e575c /src/value.cpp | |
| parent | 33c26a33d1cf30f36c1d9c641f6ffc4dd77a5861 (diff) | |
| download | Project-Tick-b64e3db8d02ba4668a3175163fe438c57cff16e4.tar.gz Project-Tick-b64e3db8d02ba4668a3175163fe438c57cff16e4.zip | |
Implement at and operator[] for value
Diffstat (limited to 'src/value.cpp')
| -rw-r--r-- | src/value.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/value.cpp b/src/value.cpp index 90a67b79f3..8196ce16e2 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -314,6 +314,21 @@ value::operator bool() const return tag_ != nullptr; } +value& value::at(const std::string& key) +{ + return dynamic_cast<tag_compound&>(*tag_).at(key); +} + +const value& value::at(const std::string& key) const +{ + return dynamic_cast<const tag_compound&>(*tag_).at(key); +} + +value& value::operator[](const std::string& key) +{ + return dynamic_cast<tag_compound&>(*tag_)[key]; +} + std::unique_ptr<tag>& value::get_ptr() { return tag_; |
