Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

.mb_str() and _U()

(1/2) > >>

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:

--- Code: ---/usr/include/wx/string.h:    const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const
./src/sdk/settings.h:  #define _U(x) wxString((x),wxConvUTF8)
--- End code ---

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:

--- Code: ---#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)

--- End code ---

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:
Sounds good to me.

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)

Navigation

[0] Message Index

[#] Next page

Go to full version