Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: me22 on August 15, 2005, 07:45:38 am

Title: .mb_str() and _U()
Post by: me22 on August 15, 2005, 07:45:38 am
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)

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)

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?
Title: Re: .mb_str() and _U()
Post by: rickg22 on August 15, 2005, 09:26:08 am
Sounds good to me.
Title: Re: .mb_str() and _U()
Post by: me22 on August 16, 2005, 03:46:21 am
I'll even do the changes, but only if rickg22 starts to actually apply my patches :P
Title: Re: .mb_str() and _U()
Post by: rickg22 on August 16, 2005, 06:25:23 am
Hey, take it easy... I'm applying some stability patches right now. When I finish them I'll begin with yours.
Title: Re: .mb_str() and _U()
Post by: me22 on August 16, 2005, 07:24:11 am
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)
Title: Re: .mb_str() and _U()
Post by: rickg22 on August 16, 2005, 07:38:46 am
I just finished the stability patches. Submitted yours to sourceforge (the official channel)