]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/corefoundation/cfstring.h
use -Wunused-parameter with gcc for consistency with MSVC and other compilers which...
[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
ac7f7b51
RN
12#ifndef __WX_CFSTRINGHOLDER_H__
13#define __WX_CFSTRINGHOLDER_H__
14
5185263f
DE
15#ifdef __DARWIN__
16 #include <CoreFoundation/CFString.h>
17#else
18 #include <CFString.h>
19#endif
20
e17206f7 21#include "wx/dlimpexp.h"
dd0d56f5
PC
22#include "wx/fontenc.h"
23
b5dbe15d 24class WXDLLIMPEXP_FWD_BASE wxString;
dd0d56f5 25
e17206f7
VS
26WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ;
27WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ;
5185263f 28
e17206f7
VS
29WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ;
30WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ;
5185263f 31
e17206f7
VS
32WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
33WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
34WXDLLIMPEXP_BASE void wxMacWakeUp() ;
5185263f 35
e17206f7 36class WXDLLIMPEXP_BASE wxMacCFStringHolder
5185263f
DE
37{
38public:
a8d69700
VZ
39 wxMacCFStringHolder()
40 : m_cfs(NULL) , m_release(false)
5185263f 41 {
5185263f
DE
42 }
43
a8d69700
VZ
44 wxMacCFStringHolder(const wxString &str,
45 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
46 : m_cfs(NULL) , m_release(false)
5185263f 47 {
5185263f
DE
48 Assign( str , encoding ) ;
49 }
50
51 wxMacCFStringHolder(CFStringRef ref , bool release = true )
a8d69700 52 : m_cfs(ref) , m_release(release)
5185263f 53 {
5185263f
DE
54 }
55
56 ~wxMacCFStringHolder()
57 {
58 Release() ;
59 }
60
61 CFStringRef Detach()
62 {
63 CFStringRef retval = m_cfs ;
64 m_release = false ;
65 m_cfs = NULL ;
66 return retval ;
67 }
68
69 void Release()
70 {
71 if ( m_release && m_cfs)
72 CFRelease( m_cfs ) ;
73 m_cfs = NULL ;
74 }
75
a8d69700
VZ
76 void Assign(const wxString &str,
77 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
5185263f 78
ac7f7b51 79 operator CFStringRef () const { return m_cfs; }
5185263f
DE
80 wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
81
82private:
83
84 CFStringRef m_cfs;
85 bool m_release ;
a8d69700 86
69ea41a7 87 DECLARE_NO_COPY_CLASS( wxMacCFStringHolder )
5185263f
DE
88} ;
89
dfd468aa
SC
90// corresponding class for holding UniChars (native unicode characters)
91
e17206f7 92class WXDLLIMPEXP_BASE wxMacUniCharBuffer
dfd468aa
SC
93{
94public :
95 wxMacUniCharBuffer( const wxString &str ) ;
a8d69700 96
dfd468aa 97 ~wxMacUniCharBuffer() ;
a8d69700 98
dfd468aa 99 UniChar* GetBuffer() ;
a8d69700 100
dfd468aa 101 UniCharCount GetChars() ;
a8d69700 102
dfd468aa
SC
103private :
104 UniChar* m_ubuf ;
105 UniCharCount m_chars ;
106};
ac7f7b51 107#endif //__WXCFSTRINGHOLDER_H__