]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/corefoundation/cfstring.h
Support for G_FILENAME_ENCODING=@locale
[wxWidgets.git] / include / wx / mac / corefoundation / cfstring.h
CommitLineData
5185263f
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/mac/corefoundation/cfstring.h
3// Purpose: wxMacCFStringHolder and other string functions
4// Author: Stefan Csomor
5// Modified by:
6// Created: 2004-10-29 (from code in wx/mac/carbon/private.h)
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __DARWIN__
13 #include <CoreFoundation/CFString.h>
14#else
15 #include <CFString.h>
16#endif
17
18void wxMacConvertNewlines13To10( char * data ) ;
19void wxMacConvertNewlines10To13( char * data ) ;
20void wxMacConvertNewlines13To10( wxString *data ) ;
21void wxMacConvertNewlines10To13( wxString *data ) ;
22
23#if wxUSE_UNICODE
24void wxMacConvertNewlines13To10( wxChar * data ) ;
25void wxMacConvertNewlines10To13( wxChar * data ) ;
26#endif
27
28wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
29wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
30void wxMacWakeUp() ;
31
32class wxMacCFStringHolder
33{
34public:
69ea41a7
SC
35 wxMacCFStringHolder()
36 : m_cfs(NULL) , m_release(false)
5185263f 37 {
5185263f
DE
38 }
39
40 wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding )
69ea41a7 41 : m_cfs(NULL) , m_release(false)
5185263f 42 {
5185263f
DE
43 Assign( str , encoding ) ;
44 }
45
46 wxMacCFStringHolder(CFStringRef ref , bool release = true )
69ea41a7 47 : m_cfs(ref) , m_release(release)
5185263f 48 {
5185263f
DE
49 }
50
51 ~wxMacCFStringHolder()
52 {
53 Release() ;
54 }
55
56 CFStringRef Detach()
57 {
58 CFStringRef retval = m_cfs ;
59 m_release = false ;
60 m_cfs = NULL ;
61 return retval ;
62 }
63
64 void Release()
65 {
66 if ( m_release && m_cfs)
67 CFRelease( m_cfs ) ;
68 m_cfs = NULL ;
69 }
70
71 void Assign( const wxString &str , wxFontEncoding encoding ) ;
72
2a32f173 73 operator CFStringRef () { return m_cfs; }
5185263f
DE
74 wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
75
76private:
77
78 CFStringRef m_cfs;
79 bool m_release ;
69ea41a7
SC
80
81 DECLARE_NO_COPY_CLASS( wxMacCFStringHolder )
5185263f
DE
82} ;
83