summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-03-13 16:35:46 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-03-13 17:00:32 +0000
commit1e81d7220990765c0cbc1bdede6ad96bbb399cff (patch)
tree3b8be05a6b4d0b150c3d90a9be740c469c7fce68 /i18npool
parent2f13a6e26d6741688c62decdee91e821ee1bd471 (diff)
resolved fdo#62278 test for LanguageTag equality resolving system locale
added LanguageTag::equals(), fdo#62278 related (cherry picked from commit fb26196ce64979ab6dc6c82c0fbdeedb126a3433) Conflicts: i18npool/inc/i18npool/languagetag.hxx i18npool/source/languagetag/languagetag.cxx resolved fdo#62278 test for LanguageTag equality resolving system locale (cherry picked from commit dde0dcd553b676abcb41eaf3f9f1bf797907e22f) Change-Id: I7c6e91518b3afd7a42d21bcae41283b0e00b833a Reviewed-on: https://gerrit.libreoffice.org/2707 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/inc/i18npool/languagetag.hxx24
-rw-r--r--i18npool/source/languagetag/languagetag.cxx7
2 files changed, 29 insertions, 2 deletions
diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx
index bb86b72262f0..1e0ae65c4b4a 100644
--- a/i18npool/inc/i18npool/languagetag.hxx
+++ b/i18npool/inc/i18npool/languagetag.hxx
@@ -204,10 +204,30 @@ public:
*/
LanguageTag & makeFallback();
- /* Test equality of two LangageTag. */
+ /** Test equality of two LanguageTag, possibly resolving system locale.
+
+ @param bResolveSystem
+ If TRUE, resolve empty language tags denoting the system
+ locale to the real locale used before comparing.
+ If FALSE, the behavior is identical to operator==(), system
+ locales are not resolved first.
+ */
+ bool equals( const LanguageTag & rLanguageTag, bool bResolveSystem = false ) const;
+
+ /** Test equality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")==LanguageTag("en-US") returns false! Use
+ equals(...,true) instead if system locales shall be resolved.
+ */
bool operator==( const LanguageTag & rLanguageTag ) const;
- /* Test inequality of two LangageTag. */
+ /** Test inequality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")!=LanguageTag("en-US") returns true! Use
+ !equals(,...true) instead if system locales shall be resolved.
+ */
bool operator!=( const LanguageTag & rLanguageTag ) const;
private:
diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index bab244371063..9055d2b5dc20 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -995,6 +995,13 @@ LanguageTag & LanguageTag::makeFallback()
}
+bool LanguageTag::equals( const LanguageTag & rLanguageTag, bool bResolveSystem ) const
+{
+ // Compare full language tag strings.
+ return getBcp47( bResolveSystem) == rLanguageTag.getBcp47( bResolveSystem);
+}
+
+
bool LanguageTag::operator==( const LanguageTag & rLanguageTag ) const
{
// Compare full language tag strings but SYSTEM unresolved.