X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dfd468aafd8c2b0c6db2c8d56ddca04e26c45715..469c3bcb7141e880d07792fc5f7fb67e605f9856:/include/wx/mac/corefoundation/cfstring.h?ds=sidebyside diff --git a/include/wx/mac/corefoundation/cfstring.h b/include/wx/mac/corefoundation/cfstring.h index 4024ce62a7..4a8ea3b503 100644 --- a/include/wx/mac/corefoundation/cfstring.h +++ b/include/wx/mac/corefoundation/cfstring.h @@ -1,106 +1,78 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/mac/corefoundation/cfstring.h -// Purpose: wxMacCFStringHolder and other string functions +// Purpose: wxCFStringRef and other string functions // Author: Stefan Csomor // Modified by: // Created: 2004-10-29 (from code in wx/mac/carbon/private.h) // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence +// Usage: Darwin (base library) ///////////////////////////////////////////////////////////////////////////// #ifndef __WX_CFSTRINGHOLDER_H__ #define __WX_CFSTRINGHOLDER_H__ -#ifdef __DARWIN__ - #include -#else - #include -#endif +#include +#include "wx/dlimpexp.h" #include "wx/fontenc.h" +#include "wx/mac/corefoundation/cfref.h" -class WXDLLIMPEXP_BASE wxString; +class WXDLLIMPEXP_FWD_BASE wxString; -void wxMacConvertNewlines13To10( char * data ) ; -void wxMacConvertNewlines10To13( char * data ) ; -void wxMacConvertNewlines13To10( wxString *data ) ; -void wxMacConvertNewlines10To13( wxString *data ) ; +WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ; +WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ; -#if wxUSE_UNICODE -void wxMacConvertNewlines13To10( wxChar * data ) ; -void wxMacConvertNewlines10To13( wxChar * data ) ; -#endif +WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ; +WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ; -wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; -wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; -void wxMacWakeUp() ; +WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; +WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; +WXDLLIMPEXP_BASE void wxMacWakeUp() ; -class wxMacCFStringHolder +class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef > { public: - wxMacCFStringHolder() - : m_cfs(NULL) , m_release(false) + wxCFStringRef() { } - wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding ) - : m_cfs(NULL) , m_release(false) - { - Assign( str , encoding ) ; - } - - wxMacCFStringHolder(CFStringRef ref , bool release = true ) - : m_cfs(ref) , m_release(release) - { - } + wxCFStringRef(const wxString &str, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ; - ~wxMacCFStringHolder() + wxCFStringRef(CFStringRef ref) + : wxCFRef< CFStringRef >(ref) { - Release() ; } - CFStringRef Detach() + wxCFStringRef(const wxCFStringRef& otherRef ) + : wxCFRef< CFStringRef >(otherRef) { - CFStringRef retval = m_cfs ; - m_release = false ; - m_cfs = NULL ; - return retval ; } - void Release() + ~wxCFStringRef() { - if ( m_release && m_cfs) - CFRelease( m_cfs ) ; - m_cfs = NULL ; } - void Assign( const wxString &str , wxFontEncoding encoding ) ; - - operator CFStringRef () const { return m_cfs; } wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; private: - - CFStringRef m_cfs; - bool m_release ; - - DECLARE_NO_COPY_CLASS( wxMacCFStringHolder ) } ; // corresponding class for holding UniChars (native unicode characters) -class wxMacUniCharBuffer +class WXDLLIMPEXP_BASE wxMacUniCharBuffer { public : wxMacUniCharBuffer( const wxString &str ) ; - + ~wxMacUniCharBuffer() ; - + UniChar* GetBuffer() ; - + UniCharCount GetChars() ; - + private : UniChar* m_ubuf ; UniCharCount m_chars ;