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 // Usage: Darwin (base library)
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __WX_CFSTRINGHOLDER_H__
14 #define __WX_CFSTRINGHOLDER_H__
17 #include <CoreFoundation/CFString.h>
22 #include "wx/dlimpexp.h"
23 #include "wx/fontenc.h"
25 class WXDLLIMPEXP_FWD_BASE wxString
;
27 WXDLLIMPEXP_BASE
void wxMacConvertNewlines13To10( wxString
*data
) ;
28 WXDLLIMPEXP_BASE
void wxMacConvertNewlines10To13( wxString
*data
) ;
30 WXDLLIMPEXP_BASE
void wxMacConvertNewlines13To10( char * data
) ;
31 WXDLLIMPEXP_BASE
void wxMacConvertNewlines10To13( char * data
) ;
33 WXDLLIMPEXP_BASE wxUint32
wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding
) ;
34 WXDLLIMPEXP_BASE wxFontEncoding
wxMacGetFontEncFromSystemEnc(wxUint32 encoding
) ;
35 WXDLLIMPEXP_BASE
void wxMacWakeUp() ;
37 class WXDLLIMPEXP_BASE wxMacCFStringHolder
41 : m_cfs(NULL
) , m_release(false)
45 wxMacCFStringHolder(const wxString
&str
,
46 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
47 : m_cfs(NULL
) , m_release(false)
49 Assign( str
, encoding
) ;
52 wxMacCFStringHolder(CFStringRef ref
, bool release
= true )
53 : m_cfs(ref
) , m_release(release
)
57 ~wxMacCFStringHolder()
64 CFStringRef retval
= m_cfs
;
72 if ( m_release
&& m_cfs
)
77 void Assign(CFStringRef ref
, bool release
= true);
79 void Assign(const wxString
&str
,
80 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
82 operator CFStringRef () const { return m_cfs
; }
83 wxString
AsString( wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
90 DECLARE_NO_COPY_CLASS( wxMacCFStringHolder
)
93 // corresponding class for holding UniChars (native unicode characters)
95 class WXDLLIMPEXP_BASE wxMacUniCharBuffer
98 wxMacUniCharBuffer( const wxString
&str
) ;
100 ~wxMacUniCharBuffer() ;
102 UniChar
* GetBuffer() ;
104 UniCharCount
GetChars() ;
108 UniCharCount m_chars
;
110 #endif //__WXCFSTRINGHOLDER_H__