summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/tag_compound.h3
-rw-r--r--include/tag_primitive.h17
-rw-r--r--include/tag_string.h3
3 files changed, 22 insertions, 1 deletions
diff --git a/include/tag_compound.h b/include/tag_compound.h
index 435fdbdff6..fb2d27123a 100644
--- a/include/tag_compound.h
+++ b/include/tag_compound.h
@@ -115,6 +115,9 @@ private:
std::map<std::string, value> tags;
bool equals(const tag& rhs) const override;
+
+ friend bool operator==(const tag_compound& lhs, const tag_compound& rhs);
+ friend bool operator!=(const tag_compound& lhs, const tag_compound& rhs);
};
template<class T, class... Args>
diff --git a/include/tag_primitive.h b/include/tag_primitive.h
index e35d462c48..73c7b1e727 100644
--- a/include/tag_primitive.h
+++ b/include/tag_primitive.h
@@ -61,6 +61,9 @@ private:
bool equals(const tag& rhs) const override;
};
+template<class T> bool operator==(const tag_primitive<T>& lhs, const tag_primitive<T>& rhs);
+template<class T> bool operator!=(const tag_primitive<T>& lhs, const tag_primitive<T>& rhs);
+
//Typedefs that should be used instead of the template tag_primitive.
typedef tag_primitive<int8_t> tag_byte;
typedef tag_primitive<int16_t> tag_short;
@@ -120,7 +123,19 @@ std::unique_ptr<tag> tag_primitive<T>::move_clone() &&
template<class T>
bool tag_primitive<T>::equals(const tag& rhs) const
{
- return value == static_cast<const tag_primitive<T>&>(rhs).value;
+ return *this == static_cast<const tag_primitive<T>&>(rhs);
+}
+
+template<class T>
+bool operator==(const tag_primitive<T>& lhs, const tag_primitive<T>& rhs)
+{
+ return lhs.get() == rhs.get();
+}
+
+template<class T>
+bool operator!=(const tag_primitive<T>& lhs, const tag_primitive<T>& rhs)
+{
+ return !(lhs == rhs);
}
}
diff --git a/include/tag_string.h b/include/tag_string.h
index 456fa8ad08..f1b622eee9 100644
--- a/include/tag_string.h
+++ b/include/tag_string.h
@@ -55,6 +55,9 @@ private:
bool equals(const tag& rhs) const override;
};
+bool operator==(const tag_string& lhs, const tag_string& rhs);
+bool operator!=(const tag_string& lhs, const tag_string& rhs);
+
}
#endif // TAG_STRING_H_INCLUDED