1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/corefoundation/cfstring.cpp
3 // Purpose: wxCFStringHolder and other string functions
4 // Author: Stefan Csomor
6 // Created: 2004-10-29 (from code in src/mac/carbon/utils.cpp)
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 // Usage: Darwin (base library)
11 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/wxprec.h"
16 #include "wx/string.h"
23 #include "wx/mac/corefoundation/cfstring.h"
25 #include <CoreServices/CoreServices.h>
27 void wxMacConvertNewlines13To10( char * data
)
30 while( (buf
=strchr(buf
,0x0d)) != NULL
)
37 void wxMacConvertNewlines10To13( char * data
)
40 while( (buf
=strchr(buf
,0x0a)) != NULL
)
47 const wxString
sCR((wxChar
)13);
48 const wxString
sLF((wxChar
)10);
50 void wxMacConvertNewlines13To10( wxString
* data
)
52 data
->Replace( sCR
,sLF
);
55 void wxMacConvertNewlines10To13( wxString
* data
)
57 data
->Replace( sLF
,sCR
);
60 wxUint32
wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding
)
62 TextEncodingBase enc
= 0 ;
63 if ( encoding
== wxFONTENCODING_DEFAULT
)
66 encoding
= wxFont::GetDefaultEncoding() ;
68 encoding
= wxFONTENCODING_SYSTEM
; // to be set below
72 if ( encoding
== wxFONTENCODING_SYSTEM
)
74 enc
= CFStringGetSystemEncoding();
79 case wxFONTENCODING_ISO8859_1
:
80 enc
= kTextEncodingISOLatin1
;
82 case wxFONTENCODING_ISO8859_2
:
83 enc
= kTextEncodingISOLatin2
;
85 case wxFONTENCODING_ISO8859_3
:
86 enc
= kTextEncodingISOLatin3
;
88 case wxFONTENCODING_ISO8859_4
:
89 enc
= kTextEncodingISOLatin4
;
91 case wxFONTENCODING_ISO8859_5
:
92 enc
= kTextEncodingISOLatinCyrillic
;
94 case wxFONTENCODING_ISO8859_6
:
95 enc
= kTextEncodingISOLatinArabic
;
97 case wxFONTENCODING_ISO8859_7
:
98 enc
= kTextEncodingISOLatinGreek
;
100 case wxFONTENCODING_ISO8859_8
:
101 enc
= kTextEncodingISOLatinHebrew
;
103 case wxFONTENCODING_ISO8859_9
:
104 enc
= kTextEncodingISOLatin5
;
106 case wxFONTENCODING_ISO8859_10
:
107 enc
= kTextEncodingISOLatin6
;
109 case wxFONTENCODING_ISO8859_13
:
110 enc
= kTextEncodingISOLatin7
;
112 case wxFONTENCODING_ISO8859_14
:
113 enc
= kTextEncodingISOLatin8
;
115 case wxFONTENCODING_ISO8859_15
:
116 enc
= kTextEncodingISOLatin9
;
119 case wxFONTENCODING_KOI8
:
120 enc
= kTextEncodingKOI8_R
;
122 case wxFONTENCODING_ALTERNATIVE
: // MS-DOS CP866
123 enc
= kTextEncodingDOSRussian
;
126 case wxFONTENCODING_BULGARIAN :
130 case wxFONTENCODING_CP437
:
131 enc
=kTextEncodingDOSLatinUS
;
133 case wxFONTENCODING_CP850
:
134 enc
= kTextEncodingDOSLatin1
;
136 case wxFONTENCODING_CP852
:
137 enc
= kTextEncodingDOSLatin2
;
139 case wxFONTENCODING_CP855
:
140 enc
= kTextEncodingDOSCyrillic
;
142 case wxFONTENCODING_CP866
:
143 enc
=kTextEncodingDOSRussian
;
145 case wxFONTENCODING_CP874
:
146 enc
= kTextEncodingDOSThai
;
148 case wxFONTENCODING_CP932
:
149 enc
= kTextEncodingDOSJapanese
;
151 case wxFONTENCODING_CP936
:
152 enc
= kTextEncodingDOSChineseSimplif
;
154 case wxFONTENCODING_CP949
:
155 enc
= kTextEncodingDOSKorean
;
157 case wxFONTENCODING_CP950
:
158 enc
= kTextEncodingDOSChineseTrad
;
161 case wxFONTENCODING_CP1250
:
162 enc
= kTextEncodingWindowsLatin2
;
164 case wxFONTENCODING_CP1251
:
165 enc
=kTextEncodingWindowsCyrillic
;
167 case wxFONTENCODING_CP1252
:
168 enc
=kTextEncodingWindowsLatin1
;
170 case wxFONTENCODING_CP1253
:
171 enc
= kTextEncodingWindowsGreek
;
173 case wxFONTENCODING_CP1254
:
174 enc
= kTextEncodingWindowsLatin5
;
176 case wxFONTENCODING_CP1255
:
177 enc
=kTextEncodingWindowsHebrew
;
179 case wxFONTENCODING_CP1256
:
180 enc
=kTextEncodingWindowsArabic
;
182 case wxFONTENCODING_CP1257
:
183 enc
= kTextEncodingWindowsBalticRim
;
186 case wxFONTENCODING_UTF7
:
187 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicodeUTF7Format
) ;
189 case wxFONTENCODING_UTF8
:
190 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicodeUTF8Format
) ;
192 case wxFONTENCODING_EUC_JP
:
193 enc
= kTextEncodingEUC_JP
;
195 case wxFONTENCODING_UTF16BE
:
196 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode16BitFormat
) ;
198 case wxFONTENCODING_UTF16LE
:
199 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode16BitFormat
) ;
201 case wxFONTENCODING_UTF32BE
:
202 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode32BitFormat
) ;
204 case wxFONTENCODING_UTF32LE
:
205 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode32BitFormat
) ;
208 case wxFONTENCODING_MACROMAN
:
209 enc
= kTextEncodingMacRoman
;
211 case wxFONTENCODING_MACJAPANESE
:
212 enc
= kTextEncodingMacJapanese
;
214 case wxFONTENCODING_MACCHINESETRAD
:
215 enc
= kTextEncodingMacChineseTrad
;
217 case wxFONTENCODING_MACKOREAN
:
218 enc
= kTextEncodingMacKorean
;
220 case wxFONTENCODING_MACARABIC
:
221 enc
= kTextEncodingMacArabic
;
223 case wxFONTENCODING_MACHEBREW
:
224 enc
= kTextEncodingMacHebrew
;
226 case wxFONTENCODING_MACGREEK
:
227 enc
= kTextEncodingMacGreek
;
229 case wxFONTENCODING_MACCYRILLIC
:
230 enc
= kTextEncodingMacCyrillic
;
232 case wxFONTENCODING_MACDEVANAGARI
:
233 enc
= kTextEncodingMacDevanagari
;
235 case wxFONTENCODING_MACGURMUKHI
:
236 enc
= kTextEncodingMacGurmukhi
;
238 case wxFONTENCODING_MACGUJARATI
:
239 enc
= kTextEncodingMacGujarati
;
241 case wxFONTENCODING_MACORIYA
:
242 enc
= kTextEncodingMacOriya
;
244 case wxFONTENCODING_MACBENGALI
:
245 enc
= kTextEncodingMacBengali
;
247 case wxFONTENCODING_MACTAMIL
:
248 enc
= kTextEncodingMacTamil
;
250 case wxFONTENCODING_MACTELUGU
:
251 enc
= kTextEncodingMacTelugu
;
253 case wxFONTENCODING_MACKANNADA
:
254 enc
= kTextEncodingMacKannada
;
256 case wxFONTENCODING_MACMALAJALAM
:
257 enc
= kTextEncodingMacMalayalam
;
259 case wxFONTENCODING_MACSINHALESE
:
260 enc
= kTextEncodingMacSinhalese
;
262 case wxFONTENCODING_MACBURMESE
:
263 enc
= kTextEncodingMacBurmese
;
265 case wxFONTENCODING_MACKHMER
:
266 enc
= kTextEncodingMacKhmer
;
268 case wxFONTENCODING_MACTHAI
:
269 enc
= kTextEncodingMacThai
;
271 case wxFONTENCODING_MACLAOTIAN
:
272 enc
= kTextEncodingMacLaotian
;
274 case wxFONTENCODING_MACGEORGIAN
:
275 enc
= kTextEncodingMacGeorgian
;
277 case wxFONTENCODING_MACARMENIAN
:
278 enc
= kTextEncodingMacArmenian
;
280 case wxFONTENCODING_MACCHINESESIMP
:
281 enc
= kTextEncodingMacChineseSimp
;
283 case wxFONTENCODING_MACTIBETAN
:
284 enc
= kTextEncodingMacTibetan
;
286 case wxFONTENCODING_MACMONGOLIAN
:
287 enc
= kTextEncodingMacMongolian
;
289 case wxFONTENCODING_MACETHIOPIC
:
290 enc
= kTextEncodingMacEthiopic
;
292 case wxFONTENCODING_MACCENTRALEUR
:
293 enc
= kTextEncodingMacCentralEurRoman
;
295 case wxFONTENCODING_MACVIATNAMESE
:
296 enc
= kTextEncodingMacVietnamese
;
298 case wxFONTENCODING_MACARABICEXT
:
299 enc
= kTextEncodingMacExtArabic
;
301 case wxFONTENCODING_MACSYMBOL
:
302 enc
= kTextEncodingMacSymbol
;
304 case wxFONTENCODING_MACDINGBATS
:
305 enc
= kTextEncodingMacDingbats
;
307 case wxFONTENCODING_MACTURKISH
:
308 enc
= kTextEncodingMacTurkish
;
310 case wxFONTENCODING_MACCROATIAN
:
311 enc
= kTextEncodingMacCroatian
;
313 case wxFONTENCODING_MACICELANDIC
:
314 enc
= kTextEncodingMacIcelandic
;
316 case wxFONTENCODING_MACROMANIAN
:
317 enc
= kTextEncodingMacRomanian
;
319 case wxFONTENCODING_MACCELTIC
:
320 enc
= kTextEncodingMacCeltic
;
322 case wxFONTENCODING_MACGAELIC
:
323 enc
= kTextEncodingMacGaelic
;
325 case wxFONTENCODING_MACKEYBOARD
:
326 enc
= kTextEncodingMacKeyboardGlyphs
;
328 default : // to make gcc happy
334 wxFontEncoding
wxMacGetFontEncFromSystemEnc(wxUint32 encoding
)
336 wxFontEncoding enc
= wxFONTENCODING_DEFAULT
;
340 case kTextEncodingISOLatin1
:
341 enc
= wxFONTENCODING_ISO8859_1
;
343 case kTextEncodingISOLatin2
:
344 enc
= wxFONTENCODING_ISO8859_2
;
346 case kTextEncodingISOLatin3
:
347 enc
= wxFONTENCODING_ISO8859_3
;
349 case kTextEncodingISOLatin4
:
350 enc
= wxFONTENCODING_ISO8859_4
;
352 case kTextEncodingISOLatinCyrillic
:
353 enc
= wxFONTENCODING_ISO8859_5
;
355 case kTextEncodingISOLatinArabic
:
356 enc
= wxFONTENCODING_ISO8859_6
;
358 case kTextEncodingISOLatinGreek
:
359 enc
= wxFONTENCODING_ISO8859_7
;
361 case kTextEncodingISOLatinHebrew
:
362 enc
= wxFONTENCODING_ISO8859_8
;
364 case kTextEncodingISOLatin5
:
365 enc
= wxFONTENCODING_ISO8859_9
;
367 case kTextEncodingISOLatin6
:
368 enc
= wxFONTENCODING_ISO8859_10
;
370 case kTextEncodingISOLatin7
:
371 enc
= wxFONTENCODING_ISO8859_13
;
373 case kTextEncodingISOLatin8
:
374 enc
= wxFONTENCODING_ISO8859_14
;
376 case kTextEncodingISOLatin9
:
377 enc
=wxFONTENCODING_ISO8859_15
;
380 case kTextEncodingKOI8_R
:
381 enc
= wxFONTENCODING_KOI8
;
385 enc = wxFONTENCODING_BULGARIAN;
388 case kTextEncodingDOSLatinUS
:
389 enc
= wxFONTENCODING_CP437
;
391 case kTextEncodingDOSLatin1
:
392 enc
= wxFONTENCODING_CP850
;
394 case kTextEncodingDOSLatin2
:
395 enc
=wxFONTENCODING_CP852
;
397 case kTextEncodingDOSCyrillic
:
398 enc
= wxFONTENCODING_CP855
;
400 case kTextEncodingDOSRussian
:
401 enc
= wxFONTENCODING_CP866
;
403 case kTextEncodingDOSThai
:
404 enc
=wxFONTENCODING_CP874
;
406 case kTextEncodingDOSJapanese
:
407 enc
= wxFONTENCODING_CP932
;
409 case kTextEncodingDOSChineseSimplif
:
410 enc
= wxFONTENCODING_CP936
;
412 case kTextEncodingDOSKorean
:
413 enc
= wxFONTENCODING_CP949
;
415 case kTextEncodingDOSChineseTrad
:
416 enc
= wxFONTENCODING_CP950
;
419 case kTextEncodingWindowsLatin2
:
420 enc
= wxFONTENCODING_CP1250
;
422 case kTextEncodingWindowsCyrillic
:
423 enc
= wxFONTENCODING_CP1251
;
425 case kTextEncodingWindowsLatin1
:
426 enc
= wxFONTENCODING_CP1252
;
428 case kTextEncodingWindowsGreek
:
429 enc
= wxFONTENCODING_CP1253
;
431 case kTextEncodingWindowsLatin5
:
432 enc
= wxFONTENCODING_CP1254
;
434 case kTextEncodingWindowsHebrew
:
435 enc
= wxFONTENCODING_CP1255
;
437 case kTextEncodingWindowsArabic
:
438 enc
= wxFONTENCODING_CP1256
;
440 case kTextEncodingWindowsBalticRim
:
441 enc
=wxFONTENCODING_CP1257
;
443 case kTextEncodingEUC_JP
:
444 enc
= wxFONTENCODING_EUC_JP
;
447 case wxFONTENCODING_UTF7
:
448 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicodeUTF7Format
) ;
450 case wxFONTENCODING_UTF8
:
451 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicodeUTF8Format
) ;
453 case wxFONTENCODING_UTF16BE
:
454 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode16BitFormat
) ;
456 case wxFONTENCODING_UTF16LE
:
457 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode16BitFormat
) ;
459 case wxFONTENCODING_UTF32BE
:
460 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode32BitFormat
) ;
462 case wxFONTENCODING_UTF32LE
:
463 enc
= CreateTextEncoding(kTextEncodingUnicodeDefault
,0,kUnicode32BitFormat
) ;
466 case kTextEncodingMacRoman
:
467 enc
= wxFONTENCODING_MACROMAN
;
469 case kTextEncodingMacJapanese
:
470 enc
= wxFONTENCODING_MACJAPANESE
;
472 case kTextEncodingMacChineseTrad
:
473 enc
= wxFONTENCODING_MACCHINESETRAD
;
475 case kTextEncodingMacKorean
:
476 enc
= wxFONTENCODING_MACKOREAN
;
478 case kTextEncodingMacArabic
:
479 enc
=wxFONTENCODING_MACARABIC
;
481 case kTextEncodingMacHebrew
:
482 enc
= wxFONTENCODING_MACHEBREW
;
484 case kTextEncodingMacGreek
:
485 enc
= wxFONTENCODING_MACGREEK
;
487 case kTextEncodingMacCyrillic
:
488 enc
= wxFONTENCODING_MACCYRILLIC
;
490 case kTextEncodingMacDevanagari
:
491 enc
= wxFONTENCODING_MACDEVANAGARI
;
493 case kTextEncodingMacGurmukhi
:
494 enc
= wxFONTENCODING_MACGURMUKHI
;
496 case kTextEncodingMacGujarati
:
497 enc
= wxFONTENCODING_MACGUJARATI
;
499 case kTextEncodingMacOriya
:
500 enc
=wxFONTENCODING_MACORIYA
;
502 case kTextEncodingMacBengali
:
503 enc
=wxFONTENCODING_MACBENGALI
;
505 case kTextEncodingMacTamil
:
506 enc
= wxFONTENCODING_MACTAMIL
;
508 case kTextEncodingMacTelugu
:
509 enc
= wxFONTENCODING_MACTELUGU
;
511 case kTextEncodingMacKannada
:
512 enc
= wxFONTENCODING_MACKANNADA
;
514 case kTextEncodingMacMalayalam
:
515 enc
= wxFONTENCODING_MACMALAJALAM
;
517 case kTextEncodingMacSinhalese
:
518 enc
= wxFONTENCODING_MACSINHALESE
;
520 case kTextEncodingMacBurmese
:
521 enc
= wxFONTENCODING_MACBURMESE
;
523 case kTextEncodingMacKhmer
:
524 enc
= wxFONTENCODING_MACKHMER
;
526 case kTextEncodingMacThai
:
527 enc
= wxFONTENCODING_MACTHAI
;
529 case kTextEncodingMacLaotian
:
530 enc
= wxFONTENCODING_MACLAOTIAN
;
532 case kTextEncodingMacGeorgian
:
533 enc
= wxFONTENCODING_MACGEORGIAN
;
535 case kTextEncodingMacArmenian
:
536 enc
= wxFONTENCODING_MACARMENIAN
;
538 case kTextEncodingMacChineseSimp
:
539 enc
= wxFONTENCODING_MACCHINESESIMP
;
541 case kTextEncodingMacTibetan
:
542 enc
= wxFONTENCODING_MACTIBETAN
;
544 case kTextEncodingMacMongolian
:
545 enc
= wxFONTENCODING_MACMONGOLIAN
;
547 case kTextEncodingMacEthiopic
:
548 enc
= wxFONTENCODING_MACETHIOPIC
;
550 case kTextEncodingMacCentralEurRoman
:
551 enc
= wxFONTENCODING_MACCENTRALEUR
;
553 case kTextEncodingMacVietnamese
:
554 enc
= wxFONTENCODING_MACVIATNAMESE
;
556 case kTextEncodingMacExtArabic
:
557 enc
= wxFONTENCODING_MACARABICEXT
;
559 case kTextEncodingMacSymbol
:
560 enc
= wxFONTENCODING_MACSYMBOL
;
562 case kTextEncodingMacDingbats
:
563 enc
= wxFONTENCODING_MACDINGBATS
;
565 case kTextEncodingMacTurkish
:
566 enc
= wxFONTENCODING_MACTURKISH
;
568 case kTextEncodingMacCroatian
:
569 enc
= wxFONTENCODING_MACCROATIAN
;
571 case kTextEncodingMacIcelandic
:
572 enc
= wxFONTENCODING_MACICELANDIC
;
574 case kTextEncodingMacRomanian
:
575 enc
= wxFONTENCODING_MACROMANIAN
;
577 case kTextEncodingMacCeltic
:
578 enc
= wxFONTENCODING_MACCELTIC
;
580 case kTextEncodingMacGaelic
:
581 enc
= wxFONTENCODING_MACGAELIC
;
583 case kTextEncodingMacKeyboardGlyphs
:
584 enc
= wxFONTENCODING_MACKEYBOARD
;
595 // converts this string into a core foundation string with optional pc 2 mac encoding
597 wxCFStringRef::wxCFStringRef( const wxString
&st
, wxFontEncoding
WXUNUSED_IN_UNICODE(encoding
) )
601 reset( wxCFRetain( CFSTR("") ) );
606 wxMacConvertNewlines13To10( &str
) ;
608 #if SIZEOF_WCHAR_T == 2
609 reset( CFStringCreateWithCharacters( kCFAllocatorDefault
,
610 (UniChar
*)str
.wc_str() , str
.Len() ) );
612 wxMBConvUTF16 converter
;
613 size_t unicharbytes
= converter
.FromWChar( NULL
, 0 , str
.wc_str() , str
.Length() ) ;
614 wxASSERT( unicharbytes
!= wxCONV_FAILED
);
615 if ( unicharbytes
== wxCONV_FAILED
)
617 // create an empty string
618 reset( wxCFRetain( CFSTR("") ) );
622 // unicharbytes: number of bytes needed for UTF-16 encoded string (without terminating null)
623 // unichars: number of UTF-16 characters (without terminating null)
624 size_t unichars
= unicharbytes
/ sizeof(UniChar
) ;
625 UniChar
*unibuf
= new UniChar
[ unichars
] ;
626 converter
.FromWChar( (char*)unibuf
, unicharbytes
, str
.wc_str() , str
.Length() ) ;
627 reset( CFStringCreateWithCharacters( kCFAllocatorDefault
, unibuf
, unichars
) ) ;
631 #else // not wxUSE_UNICODE
632 reset( CFStringCreateWithCString( kCFAllocatorSystemDefault
, str
.c_str() ,
633 wxMacGetSystemEncFromFontEnc( encoding
) ) );
638 wxString
wxCFStringRef::AsString(wxFontEncoding
WXUNUSED_IN_UNICODE(encoding
))
641 return wxEmptyString
;
643 Size cflen
= CFStringGetLength( get() ) ;
648 #if SIZEOF_WCHAR_T == 2
649 buf
= new wxChar
[ cflen
+ 1 ] ;
650 CFStringGetCharacters( get() , CFRangeMake( 0 , cflen
) , (UniChar
*) buf
) ;
653 UniChar
* unibuf
= new UniChar
[ cflen
+ 1 ] ;
654 CFStringGetCharacters( get() , CFRangeMake( 0 , cflen
) , (UniChar
*) unibuf
) ;
656 wxMBConvUTF16 converter
;
657 noChars
= converter
.MB2WC( NULL
, (const char*)unibuf
, 0 ) ;
658 wxASSERT_MSG( noChars
!= wxCONV_FAILED
, _T("Unable to count the number of characters in this string!") );
659 buf
= new wxChar
[ noChars
+ 1 ] ;
660 noChars
= converter
.MB2WC( buf
, (const char*)unibuf
, noChars
+ 1 ) ;
661 wxASSERT_MSG( noChars
!= wxCONV_FAILED
, _T("Conversion of string failed!") );
666 CFStringGetBytes( get() , CFRangeMake(0, cflen
) , wxMacGetSystemEncFromFontEnc( encoding
) ,
667 '?' , false , NULL
, 0 , &cStrLen
) ;
668 buf
= new wxChar
[ cStrLen
+ 1 ] ;
669 CFStringGetBytes( get() , CFRangeMake(0, cflen
) , wxMacGetSystemEncFromFontEnc( encoding
) ,
670 '?' , false , (unsigned char*) buf
, cStrLen
, &cStrLen
) ;
675 wxString
result(buf
) ;
677 wxMacConvertNewlines10To13( &result
);
682 // wxMacUniCharBuffer
685 wxMacUniCharBuffer::wxMacUniCharBuffer( const wxString
&str
)
687 m_chars
= str
.length() ;
690 #if SIZEOF_WCHAR_T == 4
691 wxMBConvUTF16 converter
;
693 size_t unicharlen
= converter
.WC2MB( NULL
, str
.wc_str() , 0 ) ;
694 m_ubuf
= (UniChar
*) malloc( unicharlen
+ 2 ) ;
695 converter
.WC2MB( (char*) m_ubuf
, str
.wc_str(), unicharlen
+ 2 ) ;
697 const wxWCharBuffer wchar
= str
.wc_str( wxConvLocal
) ;
698 size_t unicharlen
= converter
.WC2MB( NULL
, wchar
.data() , 0 ) ;
699 m_ubuf
= (UniChar
*) malloc( unicharlen
+ 2 ) ;
700 converter
.WC2MB( (char*) m_ubuf
, wchar
.data() , unicharlen
+ 2 ) ;
702 m_chars
= unicharlen
/ 2 ;
703 #else // SIZEOF_WCHAR_T is then 2
705 m_ubuf
= malloc( m_chars
* 2 + 2 ) ;
706 memcpy( m_ubuf
, (UniChar
*) str
.wc_str() , m_chars
* 2 + 2 ) ;
708 wxWCharBuffer wchar
= str
.wc_str( wxConvLocal
) ;
709 m_chars
= wxWcslen( wchar
.data() ) ;
710 m_ubuf
= malloc( m_chars
* 2 + 2 ) ;
711 memcpy( m_ubuf
, (UniChar
*) wchar
.data() , m_chars
* 2 + 2 ) ;
716 wxMacUniCharBuffer::~wxMacUniCharBuffer()
721 UniCharArrayPtr
wxMacUniCharBuffer::GetBuffer()
726 UniCharCount
wxMacUniCharBuffer::GetChars()