size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
);
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
);
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
);
// use wxTextOutputStream to exercise wxMBConv interface
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
);
#endif
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
const char* utf8Buffer, // the same character sequence as multiBuffer, encoded as UTF-8
size_t utf8Bytes, // the byte length of the UTF-8 encoded character sequence
- wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // the number of bytes occupied by a terminating null in the converter's encoding
);
CPPUNIT_TEST_SUITE_REGISTRATION( MBConvTestCase );
// also include in it's own registry so that these tests can be run alone
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConvTestCase" );
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConv" );
void MBConvTestCase::WC2CP1250()
}
}
-// print an unsigned character array as a C unsigned character array
+// Print an unsigned character array as a C unsigned character array.
+// NB: Please don't remove this function even though it's not used anywhere,
+// it's very useful when debugging a failed test.
wxString CByteArrayFormat( const void* data, size_t len, const wxChar* name )
{
const unsigned char* bytes = (unsigned char*)data;
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_iconv,
sizeof(welcome_utf7_iconv),
- &wxConvUTF7,
+ wxConvUTF7,
1
);
TestDecoder
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_wx,
sizeof(welcome_utf7_wx),
- &wxConvUTF7,
+ wxConvUTF7,
1
);
#if 0
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_iconv,
sizeof(welcome_utf7_iconv),
- &wxConvUTF7,
+ wxConvUTF7,
1
);
#endif
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf7_wx,
sizeof(welcome_utf7_wx),
- &wxConvUTF7,
+ wxConvUTF7,
1
);
}
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf8,
sizeof(welcome_utf8),
- &wxConvUTF8,
+ wxConvUTF8,
1
);
TestEncoder
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf8,
sizeof(welcome_utf8),
- &wxConvUTF8,
+ wxConvUTF8,
1
);
}
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16le,
sizeof(welcome_utf16le),
- &convUTF16LE,
+ convUTF16LE,
2
);
TestEncoder
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16le,
sizeof(welcome_utf16le),
- &convUTF16LE,
+ convUTF16LE,
2
);
}
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16be,
sizeof(welcome_utf16be),
- &convUTF16BE,
+ convUTF16BE,
2
);
TestEncoder
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf16be,
sizeof(welcome_utf16be),
- &convUTF16BE,
+ convUTF16BE,
2
);
}
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32le,
sizeof(welcome_utf32le),
- &convUTF32LE,
+ convUTF32LE,
4
);
TestEncoder
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32le,
sizeof(welcome_utf32le),
- &convUTF32LE,
+ convUTF32LE,
4
);
}
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32be,
sizeof(welcome_utf32be),
- &convUTF32BE,
+ convUTF32BE,
4
);
TestEncoder
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_utf32be,
sizeof(welcome_utf32be),
- &convUTF32BE,
+ convUTF32BE,
4
);
}
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_cp932,
sizeof(welcome_cp932),
- &convCP932,
+ convCP932,
1
);
TestEncoder
sizeof(welcome_wchar_t)/sizeof(wchar_t),
(const char*)welcome_cp932,
sizeof(welcome_cp932),
- &convCP932,
+ convCP932,
1
);
}
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
const char* utf8Buffer, // the same character sequence as multiBuffer, encoded as UTF-8
size_t utf8Bytes, // the byte length of the UTF-8 encoded character sequence
- wxMBConv* converter, // the wxMBConv object thta can decode multiBuffer into a wide character sequence
+ wxMBConv& converter, // the wxMBConv object thta can decode multiBuffer into a wide character sequence
int sizeofNull // the number of bytes occupied by a terminating null in the converter's encoding
)
{
}
-WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const wxChar* name );
+WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const char* name );
void MBConvTestCase::FontmapTests()
{
#ifdef wxUSE_FONTMAP
- wxMBConv* converter = new_wxMBConv_wxwin( _T("CP1252") );
+ wxMBConv* converter = new_wxMBConv_wxwin("CP1252");
if ( !converter )
{
return;
sizeof(CP1252),
(const char*)CP1252_utf8,
sizeof(CP1252_utf8),
- converter,
+ *converter,
1
);
delete converter;
}
-WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const wxChar* name );
+WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const char* name );
void MBConvTestCase::IconvTests()
{
#ifdef HAVE_ICONV
- wxMBConv* converter = new_wxMBConv_iconv( _T("CP932") );
+ wxMBConv* converter = new_wxMBConv_iconv("CP932");
if ( !converter )
{
return;
sizeof(welcome_cp932),
(const char*)welcome_utf8,
sizeof(welcome_utf8),
- converter,
+ *converter,
1
);
delete converter;
sizeof(CP1252),
(const char*)CP1252_utf8,
sizeof(CP1252_utf8),
- &convCP1252,
+ convCP1252,
1
);
}
systemMB_size,
(const char*)systemMB_utf8,
systemMB_utf8_size,
- &convLibc,
+ convLibc,
1
);
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
)
{
memset( &inputCopy.data()[multiBytes], 0, sizeofNull );
// calculate the output size
- size_t outputWritten = converter->MB2WC
+ size_t outputWritten = converter.MB2WC
(
0,
(const char*)inputCopy.data(),
wxWCharBuffer outputBuffer(outputBufferChars);
memset( outputBuffer.data(), UNINITIALIZED, outputBufferChars*sizeof(wchar_t) );
- outputWritten = converter->MB2WC
+ outputWritten = converter.MB2WC
(
outputBuffer.data(),
(const char*)inputCopy.data(),
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter, // the wxMBConv object that can decode multiBuffer into a wide character sequence
int sizeofNull // number of bytes occupied by terminating null in this encoding
)
{
inputCopy.data()[wideChars] = 0;
// calculate the output size
- size_t outputWritten = converter->WC2MB
+ size_t outputWritten = converter.WC2MB
(
0,
(const wchar_t*)inputCopy.data(),
wxCharBuffer outputBuffer(outputBufferSize);
memset( outputBuffer.data(), UNINITIALIZED, outputBufferSize );
- outputWritten = converter->WC2MB
+ outputWritten = converter.WC2MB
(
outputBuffer.data(),
(const wchar_t*)inputCopy.data(),
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
)
{
// this isn't meant to test wxMemoryInputStream or wxTextInputStream
// it's meant to test the way wxTextInputStream uses wxMBConv
// (which has exposed some problems with wxMBConv)
wxMemoryInputStream memoryInputStream( multiBuffer, multiBytes );
- wxTextInputStream textInputStream( memoryInputStream, wxT(""), *converter );
+ wxTextInputStream textInputStream( memoryInputStream, wxT(""), converter );
for ( size_t i = 0; i < wideChars; i++ )
{
wxChar wc = textInputStream.GetChar();
size_t wideChars, // the number of wide characters at wideBuffer
const char* multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
size_t multiBytes, // the byte length of the multibyte character sequence that can be decoded by "converter"
- wxMBConv* converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
+ wxMBConv& converter // the wxMBConv object that can decode multiBuffer into a wide character sequence
)
{
// this isn't meant to test wxMemoryOutputStream or wxTextOutputStream
// (which has exposed some problems with wxMBConv)
wxMemoryOutputStream memoryOutputStream;
// wxEOL_UNIX will pass \n \r unchanged
- wxTextOutputStream textOutputStream( memoryOutputStream, wxEOL_UNIX, *converter );
+ wxTextOutputStream textOutputStream( memoryOutputStream, wxEOL_UNIX, converter );
for ( size_t i = 0; i < wideChars; i++ )
{
textOutputStream.PutChar( wideBuffer[i] );