From c96e1c224d553b67cd8e459244388faa16258c52 Mon Sep 17 00:00:00 2001 From: SweetId <2630750+SweetId@users.noreply.github.com> Date: Sat, 21 Oct 2023 09:29:34 -0400 Subject: [PATCH] added comparison operators --- include/NazaraLocalization/LocalizedText.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/NazaraLocalization/LocalizedText.hpp b/include/NazaraLocalization/LocalizedText.hpp index ea27a2a..9b9a72d 100644 --- a/include/NazaraLocalization/LocalizedText.hpp +++ b/include/NazaraLocalization/LocalizedText.hpp @@ -44,6 +44,11 @@ namespace Nz const std::string& ToString() const; const std::string& GetBaseString() const { return m_str; } + // == operator compares the key only + friend auto operator==(const LocalizedText& A, const LocalizedText& B) { return A.m_str == B.m_str; } + // <=> operator compares localized string + friend auto operator<=>(const LocalizedText& A, const LocalizedText& B) { return A.ToString() <=> B.ToString(); } + friend std::ostream& operator<<(std::ostream& out, const Nz::LocalizedText& dt) { return out << dt.ToString();