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/dlimpexp.h"
22 #include "wx/fontenc.h"
24 class WXDLLIMPEXP_FWD_BASE wxString
;
26 WXDLLIMPEXP_BASE
void wxMacConvertNewlines13To10( wxString
*data
) ;
27 WXDLLIMPEXP_BASE
void wxMacConvertNewlines10To13( wxString
*data
) ;
29 WXDLLIMPEXP_BASE
void wxMacConvertNewlines13To10( char * data
) ;
30 WXDLLIMPEXP_BASE
void wxMacConvertNewlines10To13( char * data
) ;
32 WXDLLIMPEXP_BASE wxUint32
wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding
) ;
33 WXDLLIMPEXP_BASE wxFontEncoding
wxMacGetFontEncFromSystemEnc(wxUint32 encoding
) ;
34 WXDLLIMPEXP_BASE
void wxMacWakeUp() ;
36 class WXDLLIMPEXP_BASE wxMacCFStringHolder
40 : m_cfs(NULL
) , m_release(false)
44 wxMacCFStringHolder(const wxString
&str
,
45 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
46 : m_cfs(NULL
) , m_release(false)
48 Assign( str
, encoding
) ;
51 wxMacCFStringHolder(CFStringRef ref
, bool release
= true )
52 : m_cfs(ref
) , m_release(release
)
56 ~wxMacCFStringHolder()
63 CFStringRef retval
= m_cfs
;
71 if ( m_release
&& m_cfs
)
76 void Assign(const wxString
&str
,
77 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
79 operator CFStringRef () const { return m_cfs
; }
80 wxString
AsString( wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
87 DECLARE_NO_COPY_CLASS( wxMacCFStringHolder
)
90 // corresponding class for holding UniChars (native unicode characters)
92 class WXDLLIMPEXP_BASE wxMacUniCharBuffer
95 wxMacUniCharBuffer( const wxString
&str
) ;
97 ~wxMacUniCharBuffer() ;
99 UniChar
* GetBuffer() ;
101 UniCharCount
GetChars() ;
105 UniCharCount m_chars
;
107 #endif //__WXCFSTRINGHOLDER_H__