Kaydet (Commit) fb26196c authored tarafından Eike Rathke's avatar Eike Rathke

added LanguageTag::equals(), fdo#62278 related

Change-Id: I6471f8eaa46d9203c75569436b233a09fe337910
üst 6ecfbf15
...@@ -236,10 +236,30 @@ public: ...@@ -236,10 +236,30 @@ public:
*/ */
::std::vector< OUString > getFallbackStrings() const; ::std::vector< OUString > getFallbackStrings() const;
/* 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; 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; bool operator!=( const LanguageTag & rLanguageTag ) const;
private: private:
......
...@@ -1094,6 +1094,13 @@ LanguageTag & LanguageTag::makeFallback() ...@@ -1094,6 +1094,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 bool LanguageTag::operator==( const LanguageTag & rLanguageTag ) const
{ {
// Compare full language tag strings but SYSTEM unresolved. // Compare full language tag strings but SYSTEM unresolved.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment