1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/core/cfstring.h
3 // Purpose: wxCFStringRef and other string functions
4 // Author: Stefan Csomor
6 // Created: 2004-10-29 (from code in wx/mac/carbon/private.h)
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 // Usage: Darwin (base library)
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_CFSTRINGHOLDER_H__
13 #define __WX_CFSTRINGHOLDER_H__
15 #include <CoreFoundation/CFString.h>
17 #include "wx/dlimpexp.h"
18 #include "wx/fontenc.h"
19 #include "wx/osx/core/cfref.h"
21 #ifdef WORDS_BIGENDIAN
22 #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32BE
24 #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32LE
27 class WXDLLIMPEXP_FWD_BASE wxString
;
29 WXDLLIMPEXP_BASE
void wxMacConvertNewlines13To10( wxString
*data
) ;
30 WXDLLIMPEXP_BASE
void wxMacConvertNewlines10To13( wxString
*data
) ;
32 WXDLLIMPEXP_BASE
void wxMacConvertNewlines13To10( char * data
) ;
33 WXDLLIMPEXP_BASE
void wxMacConvertNewlines10To13( char * data
) ;
35 WXDLLIMPEXP_BASE wxUint32
wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding
) ;
36 WXDLLIMPEXP_BASE wxFontEncoding
wxMacGetFontEncFromSystemEnc(wxUint32 encoding
) ;
37 WXDLLIMPEXP_BASE
void wxMacWakeUp() ;
39 class WXDLLIMPEXP_BASE wxCFStringRef
: public wxCFRef
< CFStringRef
>
46 wxCFStringRef(const wxString
&str
,
47 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
49 #if wxOSX_USE_COCOA_OR_IPHONE
50 wxCFStringRef(NSString
* ref
)
51 : wxCFRef
< CFStringRef
>((CFStringRef
) ref
)
56 wxCFStringRef(CFStringRef ref
)
57 : wxCFRef
< CFStringRef
>(ref
)
61 wxCFStringRef(const wxCFStringRef
& otherRef
)
62 : wxCFRef
< CFStringRef
>(otherRef
)
70 wxString
AsString( wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) const;
72 static wxString
AsString( CFStringRef ref
, wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
73 static wxString
AsStringWithNormalizationFormC( CFStringRef ref
, wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
74 #if wxOSX_USE_COCOA_OR_IPHONE
75 static wxString
AsString( NSString
* ref
, wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
76 static wxString
AsStringWithNormalizationFormC( NSString
* ref
, wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
79 #if wxOSX_USE_COCOA_OR_IPHONE
80 NSString
* AsNSString() const { return (NSString
*)(CFStringRef
) *this; }
85 // corresponding class for holding UniChars (native unicode characters)
87 class WXDLLIMPEXP_BASE wxMacUniCharBuffer
90 wxMacUniCharBuffer( const wxString
&str
) ;
92 ~wxMacUniCharBuffer() ;
94 UniCharPtr
GetBuffer() ;
96 UniCharCount
GetChars() ;
100 UniCharCount m_chars
;
102 #endif //__WXCFSTRINGHOLDER_H__