Changing datatransfer implementation from CFPasteboard to NSPasteboard API (#1264)
* changing datatransfer from CFPasteboard to NSPasteboard API * factoring and cleaning up * Switching back naming * missed file * getting wxCFStringRef to be independent of system headers * add unichar include * using wxCFStringRef in header * moving to private headers, change method name * adapting to lesser content in cfstring.h * Removing malloc/free usage * use wxScopedArray throughout * using wxMemoryBuffer instead of char[] * fixing nonprecomp headers * missing forward decl in non-precomp builds
This commit is contained in:
@@ -233,6 +233,41 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding)
|
||||
return usedBufLen;
|
||||
}
|
||||
|
||||
//
|
||||
// wxMacUniCharBuffer
|
||||
//
|
||||
|
||||
wxMacUniCharBuffer::wxMacUniCharBuffer( const wxString &str )
|
||||
{
|
||||
wxMBConvUTF16 converter ;
|
||||
#if wxUSE_UNICODE
|
||||
size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
|
||||
m_ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
|
||||
converter.WC2MB( (char*) m_ubuf , str.wc_str(), unicharlen + 2 ) ;
|
||||
#else
|
||||
const wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ;
|
||||
size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 ) ;
|
||||
m_ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
|
||||
converter.WC2MB( (char*) m_ubuf , wchar.data() , unicharlen + 2 ) ;
|
||||
#endif
|
||||
m_chars = unicharlen / 2 ;
|
||||
}
|
||||
|
||||
wxMacUniCharBuffer::~wxMacUniCharBuffer()
|
||||
{
|
||||
free( m_ubuf ) ;
|
||||
}
|
||||
|
||||
UniCharPtr wxMacUniCharBuffer::GetBuffer()
|
||||
{
|
||||
return m_ubuf ;
|
||||
}
|
||||
|
||||
UniCharCount wxMacUniCharBuffer::GetChars()
|
||||
{
|
||||
return m_chars ;
|
||||
}
|
||||
|
||||
#endif // __DARWIN__
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user