diff options
author | Eike Rathke <erack@redhat.com> | 2012-11-21 19:11:56 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-11-21 19:12:09 +0100 |
commit | 6a05d3f816df5cbcaa88bed5bce445c6a78f9ca6 (patch) | |
tree | 336b40ea5281c64f7cc43362b73c22235f218d7c | |
parent | 4cf30c6c2a27edfe12016e1306a033d1db071b43 (diff) |
added operator==() and operator!=() to LanguageTag
Change-Id: I4f339ecaeb147a05f8882065e859902f8c14ac47
-rw-r--r-- | i18npool/inc/i18npool/languagetag.hxx | 6 | ||||
-rw-r--r-- | i18npool/source/languagetag/languagetag.cxx | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx index c5ce23254bea..cefb0de81c9a 100644 --- a/i18npool/inc/i18npool/languagetag.hxx +++ b/i18npool/inc/i18npool/languagetag.hxx @@ -196,6 +196,12 @@ public: */ LanguageTag & makeFallback(); + /* Test equality of two LangageTag. */ + bool operator==( const LanguageTag & rLanguageTag ) const; + + /* Test inequality of two LangageTag. */ + bool operator!=( const LanguageTag & rLanguageTag ) const; + private: enum Decision diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx index 07b494f03106..cc9fc557ab0d 100644 --- a/i18npool/source/languagetag/languagetag.cxx +++ b/i18npool/source/languagetag/languagetag.cxx @@ -839,4 +839,17 @@ LanguageTag & LanguageTag::makeFallback() } +bool LanguageTag::operator==( const LanguageTag & rLanguageTag ) const +{ + // Compare full language tag strings but SYSTEM unresolved. + return getBcp47( false) == rLanguageTag.getBcp47( false); +} + + +bool LanguageTag::operator!=( const LanguageTag & rLanguageTag ) const +{ + return !operator==( rLanguageTag); +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |