diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-06-29 22:49:30 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-06-29 22:49:30 +0200 |
| commit | 8525040283ddb6190903b2a1d00481123daf4004 (patch) | |
| tree | c790815255dda3fd91dd5b8b380988141d2e70bc | |
| parent | 66b64d57b711dd4b3bf805bc4a325d9448378fe3 (diff) | |
| download | Project-Tick-8525040283ddb6190903b2a1d00481123daf4004.tar.gz Project-Tick-8525040283ddb6190903b2a1d00481123daf4004.zip | |
Implement tag_string
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/tag_string.cpp | 80 |
2 files changed, 81 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f105284ea..576f0a5b5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(libnbt++_VERSION_MINOR 0) add_definitions(-std=c++11) include_directories(include) add_library(nbt++ STATIC - ) + src/tag_string.cpp) enable_testing() add_subdirectory(test) diff --git a/src/tag_string.cpp b/src/tag_string.cpp new file mode 100644 index 0000000000..6a759088e5 --- /dev/null +++ b/src/tag_string.cpp @@ -0,0 +1,80 @@ +/* + * 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_string.h" + +namespace nbt +{ + +tag_string::tag_string(const std::string& str): + value(str) +{} + +tag_string::tag_string(std::string&& str): + value(std::move(str)) +{} + +tag_string::operator std::string&() +{ + return value; +} + +tag_string::operator const std::string&() const +{ + return value; + +} +const std::string& tag_string::get() const +{ + return value; +} + +tag_string& tag_string::operator=(const std::string& str) +{ + value = str; + return *this; +} + +tag_string& tag_string::operator=(std::string&& str) +{ + value = std::move(str); + return *this; +} + +void tag_string::set(const std::string& str) +{ + value = str; +} + +void tag_string::set(std::string&& str) +{ + value = std::move(str); +} + +tag_type tag_string::get_type() const noexcept +{ + return type; +} + +bool tag_string::equals(const tag& rhs) const +{ + return value == static_cast<const tag_string&>(rhs).value; +} + +} |
