Document the macro and its usage
This commit is contained in:
committed by
Vadim Zeitlin
parent
860f6076b8
commit
34c130abfa
@@ -375,6 +375,11 @@ more details.
|
|||||||
set to 1 for compatibility reasons as @c -DwxNO_UNSAFE_WXSTRING_CONV
|
set to 1 for compatibility reasons as @c -DwxNO_UNSAFE_WXSTRING_CONV
|
||||||
can be used only compiling the application code, without rebuilding the
|
can be used only compiling the application code, without rebuilding the
|
||||||
library. Support for this option appeared in wxWidgets 3.1.1.}
|
library. Support for this option appeared in wxWidgets 3.1.1.}
|
||||||
|
@itemdef{wxNO_IMPLICIT_WXSTRING_ENCODING,
|
||||||
|
this symbol is not defined by wxWidgets itself, but can be defined by
|
||||||
|
the applications using the library to disable implicit
|
||||||
|
conversions from and to <tt>const char*</tt> in wxString class.
|
||||||
|
Support for this option appeared in wxWidgets 3.1.4.}
|
||||||
@itemdef{WXMAKINGDLL_XXX,
|
@itemdef{WXMAKINGDLL_XXX,
|
||||||
used internally and defined when building the
|
used internally and defined when building the
|
||||||
library @c XXX as a DLL; when a monolithic wxWidgets build is used only a
|
library @c XXX as a DLL; when a monolithic wxWidgets build is used only a
|
||||||
|
@@ -242,6 +242,28 @@ and for the return value of c_str().
|
|||||||
For this conversion, the @a wxConvLibc class instance is used.
|
For this conversion, the @a wxConvLibc class instance is used.
|
||||||
See wxCSConv and wxMBConv.
|
See wxCSConv and wxMBConv.
|
||||||
|
|
||||||
|
It is also possible to disable any automatic conversions from C
|
||||||
|
strings to Unicode. This can be useful when the @a wxConvLibc encoding
|
||||||
|
is not appropriate for the current software and platform. The macro @c
|
||||||
|
wxNO_IMPLICIT_WXSTRING_ENCODING disables all implicit conversions, and
|
||||||
|
forces the code to explicitly indicate the encoding of all C strings.
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxString s;
|
||||||
|
// s = "world"; does not compile with wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
s = wxString::FromAscii("world"); // Always compiles
|
||||||
|
s = wxASCII_STR("world"); // shorthand for the above
|
||||||
|
s = wxString::FromUTF8("world"); // Always compiles
|
||||||
|
s = wxString("world", wxConvLibc); // Always compiles, explicit encoding
|
||||||
|
|
||||||
|
const char *c;
|
||||||
|
// c = s.c_str(); does not compile with wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
// c = s.mb_str(); does not compile with wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
c = s.ToAscii(); // Always compiles
|
||||||
|
c = s.ToUTF8(); // Always compiles
|
||||||
|
c = s.utf8_str(); // Alias for the above
|
||||||
|
c = s.mb_str(wxConvLibc); // Always compiles, explicit encoding
|
||||||
|
@endcode
|
||||||
|
|
||||||
@subsection overview_string_iterating Iterating wxString Characters
|
@subsection overview_string_iterating Iterating wxString Characters
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user