Author Topic: .mb_str() and _U()  (Read 8814 times)

Offline me22

  • Official tester
  • Multiple posting newcomer
  • ***
  • Posts: 53
    • TA Universe
.mb_str() and _U()
« 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?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: .mb_str() and _U()
« Reply #1 on: August 15, 2005, 09:26:08 am »
Sounds good to me.

Offline me22

  • Official tester
  • Multiple posting newcomer
  • ***
  • Posts: 53
    • TA Universe
Re: .mb_str() and _U()
« Reply #2 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

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: .mb_str() and _U()
« Reply #3 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.

Offline me22

  • Official tester
  • Multiple posting newcomer
  • ***
  • Posts: 53
    • TA Universe
Re: .mb_str() and _U()
« Reply #4 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)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: .mb_str() and _U()
« Reply #5 on: August 16, 2005, 07:38:46 am »
I just finished the stability patches. Submitted yours to sourceforge (the official channel)