[wx-dev] Re: Improving wxString proposal (Re: #9672: wx 2.9
Ansi/Unicode Combi-wxString)
Vaclav Slavik
vslavik at fastmail.fm
Mon Jul 7 08:29:32 PDT 2008
Hi,
(omitting replies to things Vadim already dealt with)
On Mon, 2008-07-07 at 13:19 +0200, Hajo Kirchhoff wrote:
> > wxWindow::GetLabel() would return wxUString (according to what you
> > wrote) and so win->GetLabel()[0] would only be compatible with Unicode
> > version of wxString (and it would _still_ require wxUniChar).
>
> a) why would it require wxUniChar?
In addition to what Vadim wrote, simply because there's no other way you
could implement the same wxUString API on top of either UTF-8 or wchar_t
representations. You may not realize it, but implementing writable
iterator in particular is not trivial in UTF-8 case.
> > Passing wx API return values to functions taking char* (or even
> > wchar_t*, for UTF-8 build): likewise.
> How? I don't see that.
You said c_str() would return raw pointer. You said wxUString would be
Unicode string. You said wxUString would be the type returned from
functions. Therefore, wxUString::c_str() -- or the implicit conversion
-- cannot return char* on Windows. Therefore,
puts(win->GetValue().c_str()) no longer compiles.
> You have the same problem at the moment when you are using char* in your
> application.
>
> If you want to avoid that, use the UNICODE define in your application.
As I and others said, the goal is to merge ANSI and Unicode builds. So
if you want us to take this proposal seriously, dismissing this grave
breakage with "then use Unicode build" won't help.
Vaclav
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.wxwidgets.org/pipermail/wx-dev/attachments/20080707/194d7f59/attachment.pgp
More information about the wx-dev
mailing list