From 7a7bc5dad218904c00102af251c69a4c887302ce Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Sep 2021 19:00:49 +0200 Subject: [PATCH] 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. --- include/wx/localedefs.h | 77 ----------------------------------------- include/wx/uilocale.h | 77 +++++++++++++++++++++++++++++++++++++++++ src/unix/uilocale.cpp | 1 + 3 files changed, 78 insertions(+), 77 deletions(-) diff --git a/include/wx/localedefs.h b/include/wx/localedefs.h index f97a1f669e..d5b43b2eff 100644 --- a/include/wx/localedefs.h +++ b/include/wx/localedefs.h @@ -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_ diff --git a/include/wx/uilocale.h b/include/wx/uilocale.h index 77b9d82abd..1341dd4d00 100644 --- a/include/wx/uilocale.h +++ b/include/wx/uilocale.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/src/unix/uilocale.cpp b/src/unix/uilocale.cpp index 1b32c4b943..a1f7205807 100644 --- a/src/unix/uilocale.cpp +++ b/src/unix/uilocale.cpp @@ -20,6 +20,7 @@ #if wxUSE_INTL +#include "wx/uilocale.h" #include "wx/private/uilocale.h" #include "wx/unix/private/uilocale.h"