← Back to team overview

kicad-developers team mailing list archive

macros.h's GetChars()

 

/**
 * Function GetChars
 * returns a wxChar* to the actual character data within a wxString, and is
 * helpful for passing strings to wxString::Printf(wxT("%s"),
GetChars(wxString) )
 * <p>
 * wxChar is defined to be <ul>
 * <li> standard C style char when wxUSE_UNICODE==0 </li>
 * <li> wchar_t when wxUSE_UNICODE==1 (the default). </li>
 * <ul>
 * i.e. it depends on how the wxWidgets library was compiled.  There was
a period
 * during the development of wxWidgets 2.9 when GetData() was missing,
so this
 * no longer be needed, and is harmless.  GetData() seems to be an
acceptable
 * alternative in all cases now.
 */
static inline const wxChar* GetChars( const wxString& s )
{
#if wxCHECK_VERSION( 2, 9, 0 )
    return (const wxChar*) s.c_str();
#else
    return s.GetData();
#endif
}



Something like this will be committed soon.  It is a revision of the
commentary on the function.

It seems there were some discussions/riots that righted some design
decisions within the wxWidgets team.

Dick