Add wxUSE_UNICODE_UTF8 to wx/setup.h

This option can also be used under MSW, so move it to the common setup.h
instead of having it in setup.h.in only.

Also do the same thing for wxUSE_UTF8_LOCALE_ONLY, even if it's less
clear if this one is really useful in non-Unix environment.
This commit is contained in:
Vadim Zeitlin 2023-03-05 16:23:50 +01:00
parent 0f0ac39800
commit 0677d493df
9 changed files with 302 additions and 9 deletions

View file

@ -119,6 +119,11 @@
#cmakedefine01 wxUSE_REPRODUCIBLE_BUILD
#cmakedefine01 wxUSE_UNICODE_UTF8
#cmakedefine01 wxUSE_UTF8_LOCALE_ONLY
#cmakedefine01 wxUSE_ON_FATAL_EXCEPTION
@ -591,9 +596,6 @@
#cmakedefine01 wxUSE_SELECT_DISPATCHER
#cmakedefine01 wxUSE_EPOLL_DISPATCHER
#cmakedefine01 wxUSE_UNICODE_UTF8
#cmakedefine01 wxUSE_UTF8_LOCALE_ONLY
/*
Use GStreamer for Unix.

View file

@ -77,6 +77,54 @@
// Recommended setting: 0
#define wxUSE_REPRODUCIBLE_BUILD 0
// ----------------------------------------------------------------------------
// wxString encoding settings
// ----------------------------------------------------------------------------
// If set to 1, wxString uses UTF-8 internally instead of UTF-32 (Unix) or
// UTF-16 (MSW).
//
// This option can be set to 1 if you want to avoid the overhead of converting
// between wchar_t encoding (UTF-32 or UTF-16) used by wxString by default and
// UTF-8, i.e. it makes functions such as wxString::FromUTF8() and utf8_str()
// much more efficient and constant time, as they don't perform any conversion
// any longer, which is especially interesting in wxGTK where these functions
// are used every time a GTK function is called. But this is compensated by
// making all the non-UTF-8 functions less efficient, notably requiring a
// conversion when passing any string to Win32 API.
//
// Moreover, accessing strings by character index becomes, in general, a O(N)
// iteration, where N is the index, so only enable this option if you don't use
// index access for arbitrary characters (unless it is done inside a loop
// consecutively for all characters as this special access pattern is optimized
// by caching the last accessed index -- but using iterate, or range for loop,
// is still better even in this case), as otherwise you may observe significant
// slowdown in your program performance.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 for optimization purposes and if
// you're sure that you're not using loops using indices to iterate over
// strings in your code.
#define wxUSE_UNICODE_UTF8 0
// If set to 1, assume that all narrow strings use UTF-8.
//
// By default, wxWidgets assumes that all "char*" strings use the encoding of
// the current locale, which is commonly, but not always, UTF-8 under Unix but
// rarely UTF-8 under MSW. This option tells the library that all strings
// always use UTF-8, avoiding the need to perform any conversions between them
// and wxString internal representation when wxUSE_UNICODE_UTF8 is set to 1.
//
// In fact, using this option only makes sense when wxUSE_UNICODE_UTF8==1 and
// it must not be enabled without the other option.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 if your program is always run in
// an UTF-8 locale.
#define wxUSE_UTF8_LOCALE_ONLY 0
// ----------------------------------------------------------------------------
// debugging settings
// ----------------------------------------------------------------------------

View file

@ -78,6 +78,54 @@
// Recommended setting: 0
#define wxUSE_REPRODUCIBLE_BUILD 0
// ----------------------------------------------------------------------------
// wxString encoding settings
// ----------------------------------------------------------------------------
// If set to 1, wxString uses UTF-8 internally instead of UTF-32 (Unix) or
// UTF-16 (MSW).
//
// This option can be set to 1 if you want to avoid the overhead of converting
// between wchar_t encoding (UTF-32 or UTF-16) used by wxString by default and
// UTF-8, i.e. it makes functions such as wxString::FromUTF8() and utf8_str()
// much more efficient and constant time, as they don't perform any conversion
// any longer, which is especially interesting in wxGTK where these functions
// are used every time a GTK function is called. But this is compensated by
// making all the non-UTF-8 functions less efficient, notably requiring a
// conversion when passing any string to Win32 API.
//
// Moreover, accessing strings by character index becomes, in general, a O(N)
// iteration, where N is the index, so only enable this option if you don't use
// index access for arbitrary characters (unless it is done inside a loop
// consecutively for all characters as this special access pattern is optimized
// by caching the last accessed index -- but using iterate, or range for loop,
// is still better even in this case), as otherwise you may observe significant
// slowdown in your program performance.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 for optimization purposes and if
// you're sure that you're not using loops using indices to iterate over
// strings in your code.
#define wxUSE_UNICODE_UTF8 0
// If set to 1, assume that all narrow strings use UTF-8.
//
// By default, wxWidgets assumes that all "char*" strings use the encoding of
// the current locale, which is commonly, but not always, UTF-8 under Unix but
// rarely UTF-8 under MSW. This option tells the library that all strings
// always use UTF-8, avoiding the need to perform any conversions between them
// and wxString internal representation when wxUSE_UNICODE_UTF8 is set to 1.
//
// In fact, using this option only makes sense when wxUSE_UNICODE_UTF8==1 and
// it must not be enabled without the other option.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 if your program is always run in
// an UTF-8 locale.
#define wxUSE_UTF8_LOCALE_ONLY 0
// ----------------------------------------------------------------------------
// debugging settings
// ----------------------------------------------------------------------------

View file

@ -78,6 +78,54 @@
// Recommended setting: 0
#define wxUSE_REPRODUCIBLE_BUILD 0
// ----------------------------------------------------------------------------
// wxString encoding settings
// ----------------------------------------------------------------------------
// If set to 1, wxString uses UTF-8 internally instead of UTF-32 (Unix) or
// UTF-16 (MSW).
//
// This option can be set to 1 if you want to avoid the overhead of converting
// between wchar_t encoding (UTF-32 or UTF-16) used by wxString by default and
// UTF-8, i.e. it makes functions such as wxString::FromUTF8() and utf8_str()
// much more efficient and constant time, as they don't perform any conversion
// any longer, which is especially interesting in wxGTK where these functions
// are used every time a GTK function is called. But this is compensated by
// making all the non-UTF-8 functions less efficient, notably requiring a
// conversion when passing any string to Win32 API.
//
// Moreover, accessing strings by character index becomes, in general, a O(N)
// iteration, where N is the index, so only enable this option if you don't use
// index access for arbitrary characters (unless it is done inside a loop
// consecutively for all characters as this special access pattern is optimized
// by caching the last accessed index -- but using iterate, or range for loop,
// is still better even in this case), as otherwise you may observe significant
// slowdown in your program performance.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 for optimization purposes and if
// you're sure that you're not using loops using indices to iterate over
// strings in your code.
#define wxUSE_UNICODE_UTF8 0
// If set to 1, assume that all narrow strings use UTF-8.
//
// By default, wxWidgets assumes that all "char*" strings use the encoding of
// the current locale, which is commonly, but not always, UTF-8 under Unix but
// rarely UTF-8 under MSW. This option tells the library that all strings
// always use UTF-8, avoiding the need to perform any conversions between them
// and wxString internal representation when wxUSE_UNICODE_UTF8 is set to 1.
//
// In fact, using this option only makes sense when wxUSE_UNICODE_UTF8==1 and
// it must not be enabled without the other option.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 if your program is always run in
// an UTF-8 locale.
#define wxUSE_UTF8_LOCALE_ONLY 0
// ----------------------------------------------------------------------------
// debugging settings
// ----------------------------------------------------------------------------

View file

@ -84,6 +84,54 @@
// Recommended setting: 0
#define wxUSE_REPRODUCIBLE_BUILD 0
// ----------------------------------------------------------------------------
// wxString encoding settings
// ----------------------------------------------------------------------------
// If set to 1, wxString uses UTF-8 internally instead of UTF-32 (Unix) or
// UTF-16 (MSW).
//
// This option can be set to 1 if you want to avoid the overhead of converting
// between wchar_t encoding (UTF-32 or UTF-16) used by wxString by default and
// UTF-8, i.e. it makes functions such as wxString::FromUTF8() and utf8_str()
// much more efficient and constant time, as they don't perform any conversion
// any longer, which is especially interesting in wxGTK where these functions
// are used every time a GTK function is called. But this is compensated by
// making all the non-UTF-8 functions less efficient, notably requiring a
// conversion when passing any string to Win32 API.
//
// Moreover, accessing strings by character index becomes, in general, a O(N)
// iteration, where N is the index, so only enable this option if you don't use
// index access for arbitrary characters (unless it is done inside a loop
// consecutively for all characters as this special access pattern is optimized
// by caching the last accessed index -- but using iterate, or range for loop,
// is still better even in this case), as otherwise you may observe significant
// slowdown in your program performance.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 for optimization purposes and if
// you're sure that you're not using loops using indices to iterate over
// strings in your code.
#define wxUSE_UNICODE_UTF8 0
// If set to 1, assume that all narrow strings use UTF-8.
//
// By default, wxWidgets assumes that all "char*" strings use the encoding of
// the current locale, which is commonly, but not always, UTF-8 under Unix but
// rarely UTF-8 under MSW. This option tells the library that all strings
// always use UTF-8, avoiding the need to perform any conversions between them
// and wxString internal representation when wxUSE_UNICODE_UTF8 is set to 1.
//
// In fact, using this option only makes sense when wxUSE_UNICODE_UTF8==1 and
// it must not be enabled without the other option.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 if your program is always run in
// an UTF-8 locale.
#define wxUSE_UTF8_LOCALE_ONLY 0
// ----------------------------------------------------------------------------
// debugging settings
// ----------------------------------------------------------------------------

View file

@ -74,6 +74,54 @@
// Recommended setting: 0
#define wxUSE_REPRODUCIBLE_BUILD 0
// ----------------------------------------------------------------------------
// wxString encoding settings
// ----------------------------------------------------------------------------
// If set to 1, wxString uses UTF-8 internally instead of UTF-32 (Unix) or
// UTF-16 (MSW).
//
// This option can be set to 1 if you want to avoid the overhead of converting
// between wchar_t encoding (UTF-32 or UTF-16) used by wxString by default and
// UTF-8, i.e. it makes functions such as wxString::FromUTF8() and utf8_str()
// much more efficient and constant time, as they don't perform any conversion
// any longer, which is especially interesting in wxGTK where these functions
// are used every time a GTK function is called. But this is compensated by
// making all the non-UTF-8 functions less efficient, notably requiring a
// conversion when passing any string to Win32 API.
//
// Moreover, accessing strings by character index becomes, in general, a O(N)
// iteration, where N is the index, so only enable this option if you don't use
// index access for arbitrary characters (unless it is done inside a loop
// consecutively for all characters as this special access pattern is optimized
// by caching the last accessed index -- but using iterate, or range for loop,
// is still better even in this case), as otherwise you may observe significant
// slowdown in your program performance.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 for optimization purposes and if
// you're sure that you're not using loops using indices to iterate over
// strings in your code.
#define wxUSE_UNICODE_UTF8 0
// If set to 1, assume that all narrow strings use UTF-8.
//
// By default, wxWidgets assumes that all "char*" strings use the encoding of
// the current locale, which is commonly, but not always, UTF-8 under Unix but
// rarely UTF-8 under MSW. This option tells the library that all strings
// always use UTF-8, avoiding the need to perform any conversions between them
// and wxString internal representation when wxUSE_UNICODE_UTF8 is set to 1.
//
// In fact, using this option only makes sense when wxUSE_UNICODE_UTF8==1 and
// it must not be enabled without the other option.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 if your program is always run in
// an UTF-8 locale.
#define wxUSE_UTF8_LOCALE_ONLY 0
// ----------------------------------------------------------------------------
// debugging settings
// ----------------------------------------------------------------------------

View file

@ -77,6 +77,54 @@
// Recommended setting: 0
#define wxUSE_REPRODUCIBLE_BUILD 0
// ----------------------------------------------------------------------------
// wxString encoding settings
// ----------------------------------------------------------------------------
// If set to 1, wxString uses UTF-8 internally instead of UTF-32 (Unix) or
// UTF-16 (MSW).
//
// This option can be set to 1 if you want to avoid the overhead of converting
// between wchar_t encoding (UTF-32 or UTF-16) used by wxString by default and
// UTF-8, i.e. it makes functions such as wxString::FromUTF8() and utf8_str()
// much more efficient and constant time, as they don't perform any conversion
// any longer, which is especially interesting in wxGTK where these functions
// are used every time a GTK function is called. But this is compensated by
// making all the non-UTF-8 functions less efficient, notably requiring a
// conversion when passing any string to Win32 API.
//
// Moreover, accessing strings by character index becomes, in general, a O(N)
// iteration, where N is the index, so only enable this option if you don't use
// index access for arbitrary characters (unless it is done inside a loop
// consecutively for all characters as this special access pattern is optimized
// by caching the last accessed index -- but using iterate, or range for loop,
// is still better even in this case), as otherwise you may observe significant
// slowdown in your program performance.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 for optimization purposes and if
// you're sure that you're not using loops using indices to iterate over
// strings in your code.
#define wxUSE_UNICODE_UTF8 0
// If set to 1, assume that all narrow strings use UTF-8.
//
// By default, wxWidgets assumes that all "char*" strings use the encoding of
// the current locale, which is commonly, but not always, UTF-8 under Unix but
// rarely UTF-8 under MSW. This option tells the library that all strings
// always use UTF-8, avoiding the need to perform any conversions between them
// and wxString internal representation when wxUSE_UNICODE_UTF8 is set to 1.
//
// In fact, using this option only makes sense when wxUSE_UNICODE_UTF8==1 and
// it must not be enabled without the other option.
//
// Default is 0
//
// Recommended setting: 0 but can be set to 1 if your program is always run in
// an UTF-8 locale.
#define wxUSE_UTF8_LOCALE_ONLY 0
// ----------------------------------------------------------------------------
// debugging settings
// ----------------------------------------------------------------------------

View file

@ -122,6 +122,11 @@
#define wxUSE_REPRODUCIBLE_BUILD 0
#define wxUSE_UNICODE_UTF8 0
#define wxUSE_UTF8_LOCALE_ONLY 0
#define wxUSE_ON_FATAL_EXCEPTION 0
@ -594,9 +599,6 @@
#define wxUSE_SELECT_DISPATCHER 0
#define wxUSE_EPOLL_DISPATCHER 0
#define wxUSE_UNICODE_UTF8 0
#define wxUSE_UTF8_LOCALE_ONLY 0
/*
Use GStreamer for Unix.

View file

@ -169,6 +169,10 @@ typedef pid_t GPid;
#define wxUSE_REPRODUCIBLE_BUILD 1
#define wxUSE_UNICODE_UTF8 0
#define wxUSE_UTF8_LOCALE_ONLY 0
#define wxUSE_EXCEPTIONS 1
#define wxUSE_EXTENDED_RTTI 0
@ -652,9 +656,6 @@ typedef pid_t GPid;
#define wxUSE_SELECT_DISPATCHER 1
#define wxUSE_EPOLL_DISPATCHER 0
#define wxUSE_UNICODE_UTF8 0
#define wxUSE_UTF8_LOCALE_ONLY 0
/*
Use GStreamer for Unix.