summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-11-24 23:57:38 +0100
committerCarl Hetherington <cth@carlh.net>2022-11-24 23:59:36 +0100
commit785c03546ae8276a1f0cd54c44b26513d6ed91d2 (patch)
treef9908e06df10b6d21cfc93e12b6eda999daa61ce /src
parente46870be9e7544d102b9612680b321fbf52c73f2 (diff)
Tidy up some operators, made possible by the previous-but-one commit.
Diffstat (limited to 'src')
-rw-r--r--src/language_tag.cc27
-rw-r--r--src/language_tag.h18
2 files changed, 12 insertions, 33 deletions
diff --git a/src/language_tag.cc b/src/language_tag.cc
index 532dd557..8faf226c 100644
--- a/src/language_tag.cc
+++ b/src/language_tag.cc
@@ -332,33 +332,6 @@ LanguageTag::subtag_type_name (SubtagType type)
return {};
}
-bool
-dcp::LanguageTag::VariantSubtag::operator== (VariantSubtag const & other) const
-{
- return subtag() == other.subtag();
-}
-
-
-bool
-dcp::LanguageTag::VariantSubtag::operator< (VariantSubtag const & other) const
-{
- return subtag() < other.subtag();
-}
-
-
-bool
-dcp::LanguageTag::ExtlangSubtag::operator== (ExtlangSubtag const & other) const
-{
- return subtag() == other.subtag();
-}
-
-
-bool
-dcp::LanguageTag::ExtlangSubtag::operator< (ExtlangSubtag const & other) const
-{
- return subtag() < other.subtag();
-}
-
bool
dcp::operator== (dcp::LanguageTag const& a, dcp::LanguageTag const& b)
diff --git a/src/language_tag.h b/src/language_tag.h
index 1c7faa44..6f46c16b 100644
--- a/src/language_tag.h
+++ b/src/language_tag.h
@@ -71,6 +71,10 @@ public:
bool operator== (SubtagData const& other) const {
return subtag == other.subtag && description == other.description;
}
+
+ bool operator!=(SubtagData const& other) const {
+ return subtag != other.subtag || description != other.description;
+ }
};
enum class SubtagType
@@ -97,6 +101,14 @@ public:
return _subtag == other._subtag;
}
+ bool operator!=(Subtag const& other) const {
+ return _subtag != other._subtag;
+ }
+
+ bool operator<(Subtag const& other) const {
+ return _subtag < other._subtag;
+ }
+
protected:
Subtag (std::string subtag, SubtagType type);
@@ -154,9 +166,6 @@ public:
SubtagType type () const override {
return SubtagType::VARIANT;
}
-
- bool operator== (VariantSubtag const& other) const;
- bool operator< (VariantSubtag const& other) const;
};
@@ -171,9 +180,6 @@ public:
SubtagType type () const override {
return SubtagType::EXTLANG;
}
-
- bool operator== (ExtlangSubtag const& other) const;
- bool operator< (ExtlangSubtag const& other) const;
};
LanguageTag () {}