1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/corefoundation/cfstring.h
3 // Purpose: wxMacCFStringHolder and other string functions
4 // Author: Stefan Csomor
6 // Created: 2004-10-29 (from code in wx/mac/carbon/private.h)
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_CFSTRINGHOLDER_H__
13 #define __WX_CFSTRINGHOLDER_H__
16 #include <CoreFoundation/CFString.h>
21 #include "wx/fontenc.h"
23 class WXDLLIMPEXP_FWD_BASE wxString
;
25 void wxMacConvertNewlines13To10( wxString
*data
) ;
26 void wxMacConvertNewlines10To13( wxString
*data
) ;
28 void wxMacConvertNewlines13To10( char * data
) ;
29 void wxMacConvertNewlines10To13( char * data
) ;
31 wxUint32
wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding
) ;
32 wxFontEncoding
wxMacGetFontEncFromSystemEnc(wxUint32 encoding
) ;
35 class wxMacCFStringHolder
39 : m_cfs(NULL
) , m_release(false)
43 wxMacCFStringHolder(const wxString
&str
,
44 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
45 : m_cfs(NULL
) , m_release(false)
47 Assign( str
, encoding
) ;
50 wxMacCFStringHolder(CFStringRef ref
, bool release
= true )
51 : m_cfs(ref
) , m_release(release
)
55 ~wxMacCFStringHolder()
62 CFStringRef retval
= m_cfs
;
70 if ( m_release
&& m_cfs
)
75 void Assign(const wxString
&str
,
76 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
78 operator CFStringRef () const { return m_cfs
; }
79 wxString
AsString( wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
86 DECLARE_NO_COPY_CLASS( wxMacCFStringHolder
)
89 // corresponding class for holding UniChars (native unicode characters)
91 class wxMacUniCharBuffer
94 wxMacUniCharBuffer( const wxString
&str
) ;
96 ~wxMacUniCharBuffer() ;
98 UniChar
* GetBuffer() ;
100 UniCharCount
GetChars() ;
104 UniCharCount m_chars
;
106 #endif //__WXCFSTRINGHOLDER_H__