summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/tag.h6
-rw-r--r--include/tag_compound.h2
-rw-r--r--include/tag_primitive.h8
-rw-r--r--include/tag_string.h2
4 files changed, 18 insertions, 0 deletions
diff --git a/include/tag.h b/include/tag.h
index 56d3594474..2bca595f9d 100644
--- a/include/tag.h
+++ b/include/tag.h
@@ -51,6 +51,12 @@ public:
///Returns the type of the tag
virtual tag_type get_type() const noexcept = 0;
+
+ friend bool operator==(const tag& lhs, const tag& rhs);
+ friend bool operator!=(const tag& lhs, const tag& rhs);
+
+private:
+ virtual bool equals(const tag& rhs) const = 0;
};
}
diff --git a/include/tag_compound.h b/include/tag_compound.h
index 8fdc2f6617..51f0cd2709 100644
--- a/include/tag_compound.h
+++ b/include/tag_compound.h
@@ -92,6 +92,8 @@ public:
private:
+
+ bool equals(const tag& rhs) const override;
};
}
diff --git a/include/tag_primitive.h b/include/tag_primitive.h
index 5704da4430..4c210ff0a8 100644
--- a/include/tag_primitive.h
+++ b/include/tag_primitive.h
@@ -55,6 +55,8 @@ public:
private:
T value;
+
+ bool equals(const tag& rhs) const override;
};
//Typedefs that should be used instead of the template tag_primitive.
@@ -107,6 +109,12 @@ tag_type tag_primitive<T>::get_type() const noexcept
return type;
}
+template<class T>
+bool tag_primitive<T>::equals(const tag& rhs) const
+{
+ return value == static_cast<const tag_primitive<T>&>(rhs).value;
+}
+
}
#endif // TAG_PRIMITIVE_H_INCLUDED
diff --git a/include/tag_string.h b/include/tag_string.h
index 28d1b77085..1daa0c2c6b 100644
--- a/include/tag_string.h
+++ b/include/tag_string.h
@@ -52,6 +52,8 @@ public:
private:
std::string value;
+
+ bool equals(const tag& rhs) const override;
};
}