diff --git a/build/cmake/setup.h.in b/build/cmake/setup.h.in index c36aa1ff0b..3fb7112a52 100644 --- a/build/cmake/setup.h.in +++ b/build/cmake/setup.h.in @@ -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. diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h index 336f80fcbc..9b8b458969 100644 --- a/include/wx/android/setup.h +++ b/include/wx/android/setup.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/include/wx/gtk/setup.h b/include/wx/gtk/setup.h index 210944074a..fd554c0aba 100644 --- a/include/wx/gtk/setup.h +++ b/include/wx/gtk/setup.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/setup.h b/include/wx/msw/setup.h index d72f9de5d8..112f62f7ec 100644 --- a/include/wx/msw/setup.h +++ b/include/wx/msw/setup.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/include/wx/osx/setup.h b/include/wx/osx/setup.h index 9be31964d4..f5619fad6f 100644 --- a/include/wx/osx/setup.h +++ b/include/wx/osx/setup.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index b5515be609..63198eb5bc 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/include/wx/univ/setup.h b/include/wx/univ/setup.h index e04243c292..442cd570e1 100644 --- a/include/wx/univ/setup.h +++ b/include/wx/univ/setup.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/setup.h.in b/setup.h.in index f61b356607..41321542dc 100644 --- a/setup.h.in +++ b/setup.h.in @@ -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. diff --git a/setup.h_vms b/setup.h_vms index 5eb0ff9c56..7b8dea5026 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -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.