News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

.mb_str() and _U()

Started by me22, August 15, 2005, 07:45:38 AM

Previous topic - Next topic

me22

I've noticed that there are a number of calls to mb_str() in the code, as the opposite action to _U.

Take a look at the following, however:
/usr/include/wx/string.h:    const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const
./src/sdk/settings.h:  #define _U(x) wxString((x),wxConvUTF8)


This makes it seem to me that we're setting up for some huge problems.  I propose 2 new macros to go with _U and _UU:
#ifdef wxUSE_UNICODE
  #define _UU(x,y) wxString((x),(y))
  #define _CC(x,y) (x).mb_str((y))
#else
  #define _UU(x,y) (x)
  #define _CC(x,y) (x)
#endif
#define _U(x) _UU((x),wxConvUTF8)
#define _C(x) _CC((x),wxConvUTF8)


The rational for C is c-string or char-string as opposed to unicode-string.

Additionally, this would be a much simpler transition to make (than the one to unicode), since it's easy to search for .mb_str(

Opinions?

rickg22


me22

I'll even do the changes, but only if rickg22 starts to actually apply my patches :P

rickg22

Hey, take it easy... I'm applying some stability patches right now. When I finish them I'll begin with yours.

me22

Well, in some other thread you said you were "too lazy to apply my patches" some other time, so I figure I just need to hound you into it 8)

rickg22

I just finished the stability patches. Submitted yours to sourceforge (the official channel)