kicad-source/tools/utf8_tests.cpp
Dick Hollenbeck 19e6bde09a Rewrite class UTF8 to contain rather than extend std::string storage.
This forces the compiler class specific features rather than borrowing
from the base class's std::string.  In some cases prior to this,
wxString( std::string ) was being called rather than UTF8::operator
wxString() leading to garbled wxStrings.

Added function UTF8::wx_str() which is of great convenience also.

Implicit conversions still work as before, and hopefully more reliably.
2017-07-26 08:30:12 -04:00

38 lines
493 B
C++

#include <string>
#include <utf8.h>
#include <wx/string.h>
void callee( const wxString& aString )
{
UTF8 arg = aString;
printf( "%s: '%s'\n", __func__, arg.c_str() );
}
int main( int argc, char** argv )
{
UTF8 bozo = "ü";
callee( bozo );
wxString s = bozo;
wxString b = bozo;
if( s.IsEmpty() )
{
printf( "string is empty\n" );
}
if( s != bozo.wx_str() )
{
printf( "string miscompare\n" );
}
return 0;
}