]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/core/cfstring.h
implement const rbegin/rend() versions (closes #3866)
[wxWidgets.git] / include / wx / osx / core / cfstring.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/corefoundation/cfstring.h
3 // Purpose: wxCFStringRef 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 // Usage: Darwin (base library)
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef __WX_CFSTRINGHOLDER_H__
14 #define __WX_CFSTRINGHOLDER_H__
15
16 #include <CoreFoundation/CFString.h>
17
18 #include "wx/dlimpexp.h"
19 #include "wx/fontenc.h"
20 #include "wx/osx/core/cfref.h"
21
22 class WXDLLIMPEXP_FWD_BASE wxString;
23
24 WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ;
25 WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ;
26
27 WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ;
28 WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ;
29
30 WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
31 WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
32 WXDLLIMPEXP_BASE void wxMacWakeUp() ;
33
34 class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef >
35 {
36 public:
37 wxCFStringRef()
38 {
39 }
40
41 wxCFStringRef(const wxString &str,
42 wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ;
43
44 #if wxOSX_USE_COCOA_OR_IPHONE
45 wxCFStringRef(NSString* ref)
46 : wxCFRef< CFStringRef >((CFStringRef) ref)
47 {
48 }
49 #endif
50
51 wxCFStringRef(CFStringRef ref)
52 : wxCFRef< CFStringRef >(ref)
53 {
54 }
55
56 wxCFStringRef(const wxCFStringRef& otherRef )
57 : wxCFRef< CFStringRef >(otherRef)
58 {
59 }
60
61 ~wxCFStringRef()
62 {
63 }
64
65 wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
66
67 #if wxOSX_USE_COCOA_OR_IPHONE
68 NSString* AsNSString() const { return (NSString*)(CFStringRef) *this; }
69 #endif
70 private:
71 } ;
72
73 // corresponding class for holding UniChars (native unicode characters)
74
75 class WXDLLIMPEXP_BASE wxMacUniCharBuffer
76 {
77 public :
78 wxMacUniCharBuffer( const wxString &str ) ;
79
80 ~wxMacUniCharBuffer() ;
81
82 UniCharPtr GetBuffer() ;
83
84 UniCharCount GetChars() ;
85
86 private :
87 UniCharPtr m_ubuf ;
88 UniCharCount m_chars ;
89 };
90 #endif //__WXCFSTRINGHOLDER_H__