summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-06-29 22:49:30 +0200
committerljfa-ag <ljfa-ag@web.de>2015-06-29 22:49:30 +0200
commit8525040283ddb6190903b2a1d00481123daf4004 (patch)
treec790815255dda3fd91dd5b8b380988141d2e70bc /src
parent66b64d57b711dd4b3bf805bc4a325d9448378fe3 (diff)
downloadProject-Tick-8525040283ddb6190903b2a1d00481123daf4004.tar.gz
Project-Tick-8525040283ddb6190903b2a1d00481123daf4004.zip
Implement tag_string
Diffstat (limited to 'src')
-rw-r--r--src/tag_string.cpp80
1 files changed, 80 insertions, 0 deletions
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;
+}
+
+}