summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-06-30 19:38:22 +0200
committerljfa-ag <ljfa-ag@web.de>2015-06-30 19:38:22 +0200
commit8fef19528e0f6a68621d58ef9dd9cb75fc163657 (patch)
treeb14f3b3123c3ad76fcd9b102505573ba6051c781
parent5f157da65896a8dc0a6c326255dd8bb7405df82e (diff)
downloadProject-Tick-8fef19528e0f6a68621d58ef9dd9cb75fc163657.tar.gz
Project-Tick-8fef19528e0f6a68621d58ef9dd9cb75fc163657.zip
Implement operator== for tag
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/tag.cpp38
2 files changed, 39 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c4ab33380..8f49a64ff7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@ set(libnbt++_VERSION_MINOR 0)
add_definitions(-std=c++11)
include_directories(include)
add_library(nbt++ STATIC
+ src/tag.cpp
src/tag_compound.cpp
src/tag_string.cpp
src/value.cpp)
diff --git a/src/tag.cpp b/src/tag.cpp
new file mode 100644
index 0000000000..40565226cf
--- /dev/null
+++ b/src/tag.cpp
@@ -0,0 +1,38 @@
+/*
+ * 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.h"
+#include <typeinfo>
+
+namespace nbt
+{
+
+bool operator==(const tag& lhs, const tag& rhs)
+{
+ if(typeid(lhs) != typeid(rhs))
+ return false;
+ return lhs.equals(rhs);
+}
+
+bool operator!=(const tag& lhs, const tag& rhs)
+{
+ return !(lhs == rhs);
+}
+
+}