diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-06-29 23:12:51 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-06-29 23:12:51 +0200 |
| commit | 5390c8e5a84aa4bbbf87981dbe13f60b0ee96655 (patch) | |
| tree | 8f3916d31c683cc6bae3ab65279a23e3688187f8 /src | |
| parent | b81ebe6cba109a215254bfae074f8fc6f334eca8 (diff) | |
| download | Project-Tick-5390c8e5a84aa4bbbf87981dbe13f60b0ee96655.tar.gz Project-Tick-5390c8e5a84aa4bbbf87981dbe13f60b0ee96655.zip | |
Implement tag_compound
Diffstat (limited to 'src')
| -rw-r--r-- | src/tag_compound.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/tag_compound.cpp b/src/tag_compound.cpp new file mode 100644 index 0000000000..af0d685826 --- /dev/null +++ b/src/tag_compound.cpp @@ -0,0 +1,77 @@ +/* + * libnbt++ - A library for the Minecraft Named Binary Tag format. + * Copyright (C) 2013, 2015 ljfa-ag + * + * This file is part of libnbt++. + * + * libnbt++ is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libnbt++ is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnbt++. If not, see <http://www.gnu.org/licenses/>. + */ +#include "tag_compound.h" + +namespace nbt +{ + +value& tag_compound::at(const std::string& key) +{ + return tags.at(key); +} + +const value& tag_compound::at(const std::string& key) const +{ + return tags.at(key); +} + +value& tag_compound::operator[](const std::string& key) +{ + return tags[key]; +} + +bool tag_compound::erase(const std::string& key) +{ + return tags.erase(key) != 0; +} + +bool tag_compound::has_key(const std::string& key) const +{ + return tags.find(key) != tags.end(); +} + +size_t tag_compound::size() const +{ + return tags.size(); +} + +void tag_compound::clear() +{ + tags.clear(); +} + +auto tag_compound::begin() -> iterator { return tags.begin(); } +auto tag_compound::end() -> iterator { return tags.end(); } +auto tag_compound::begin() const -> const_iterator { return tags.begin(); } +auto tag_compound::end() const -> const_iterator { return tags.end(); } +auto tag_compound::cbegin() const -> const_iterator { return tags.cbegin(); } +auto tag_compound::cend() const -> const_iterator { return tags.cend(); } + +tag_type tag_compound::get_type() const noexcept +{ + return type; +} + +bool tag_compound::equals(const tag& rhs) const +{ + return tags == static_cast<const tag_compound&>(rhs).tags; +} + +} |
