Move wxLocaleIdent to wx/uilocale.h

No real changes, just move this class declaration as it seems more
logical to have it in the same header with wxUILocale which is the only
place where it's used.

This commit is best viewed with --color-moved git option.
This commit is contained in:
Vadim Zeitlin 2021-09-04 19:00:49 +02:00
parent f2cd6344af
commit 7a7bc5dad2
3 changed files with 78 additions and 77 deletions

View File

@ -108,83 +108,6 @@ struct WXDLLIMPEXP_BASE wxLanguageInfo
const char* TrySetLocale() const;
};
// ----------------------------------------------------------------------------
// wxLocaleIdent: allows to fully identify a locale under all platforms
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxLocaleIdent
{
public:
// Leave language empty
wxLocaleIdent() { }
// Construct from language, i.e. a two-letter ISO 639-1 code (or a
// three-letter ISO 639-2 code if there is no ISO 639-1 code for this
// language).
wxLocaleIdent(const char* language)
: m_language(wxString::FromAscii(language))
{
}
// Set language
wxLocaleIdent& Language(const wxString& language)
{
m_language = language;
return *this;
}
// Set region
wxLocaleIdent& Region(const wxString& region)
{
m_region = region;
return *this;
}
// Set script (not supported under Unix)
wxLocaleIdent& Script(const wxString& script)
{
m_script = script;
return *this;
}
// Set charset (only supported under Unix)
wxLocaleIdent& Charset(const wxString& charset)
{
m_charset = charset;
return *this;
}
// Set modifier (only supported under Unix)
wxLocaleIdent& Modifier(const wxString& modifier)
{
m_modifier = modifier;
return *this;
}
// Accessors for the individual fields.
const wxString& GetLanguage() const { return m_language; }
const wxString& GetRegion() const { return m_region; }
const wxString& GetScript() const { return m_script; }
const wxString& GetCharset() const { return m_charset; }
const wxString& GetModifier() const { return m_modifier; }
// Construct platform dependent name
wxString GetName() const;
// Empty language represents user's default language
bool IsDefault() const
{
return m_language.empty();
}
private:
wxString m_language;
wxString m_region;
wxString m_script;
wxString m_charset;
wxString m_modifier;
};
#endif // wxUSE_INTL
#endif // _WX_LOCALEDEFS_H_

View File

@ -26,6 +26,83 @@ enum
wxCompare_CaseInsensitive = 1
};
// ----------------------------------------------------------------------------
// wxLocaleIdent: allows to fully identify a locale under all platforms
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxLocaleIdent
{
public:
// Leave language empty
wxLocaleIdent() { }
// Construct from language, i.e. a two-letter ISO 639-1 code (or a
// three-letter ISO 639-2 code if there is no ISO 639-1 code for this
// language).
wxLocaleIdent(const char* language)
: m_language(wxString::FromAscii(language))
{
}
// Set language
wxLocaleIdent& Language(const wxString& language)
{
m_language = language;
return *this;
}
// Set region
wxLocaleIdent& Region(const wxString& region)
{
m_region = region;
return *this;
}
// Set script (not supported under Unix)
wxLocaleIdent& Script(const wxString& script)
{
m_script = script;
return *this;
}
// Set charset (only supported under Unix)
wxLocaleIdent& Charset(const wxString& charset)
{
m_charset = charset;
return *this;
}
// Set modifier (only supported under Unix)
wxLocaleIdent& Modifier(const wxString& modifier)
{
m_modifier = modifier;
return *this;
}
// Accessors for the individual fields.
const wxString& GetLanguage() const { return m_language; }
const wxString& GetRegion() const { return m_region; }
const wxString& GetScript() const { return m_script; }
const wxString& GetCharset() const { return m_charset; }
const wxString& GetModifier() const { return m_modifier; }
// Construct platform dependent name
wxString GetName() const;
// Empty language represents user's default language
bool IsDefault() const
{
return m_language.empty();
}
private:
wxString m_language;
wxString m_region;
wxString m_script;
wxString m_charset;
wxString m_modifier;
};
// ----------------------------------------------------------------------------
// wxUILocale allows to use the default UI locale and get information about it
// ----------------------------------------------------------------------------

View File

@ -20,6 +20,7 @@
#if wxUSE_INTL
#include "wx/uilocale.h"
#include "wx/private/uilocale.h"
#include "wx/unix/private/uilocale.h"