]>
Commit | Line | Data |
---|---|---|
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 | #ifdef WORDS_BIGENDIAN | |
23 | #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32BE | |
24 | #else | |
25 | #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32LE | |
26 | #endif | |
27 | ||
28 | class WXDLLIMPEXP_FWD_BASE wxString; | |
29 | ||
30 | WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ; | |
31 | WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ; | |
32 | ||
33 | WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ; | |
34 | WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ; | |
35 | ||
36 | WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; | |
37 | WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; | |
38 | WXDLLIMPEXP_BASE void wxMacWakeUp() ; | |
39 | ||
40 | class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef > | |
41 | { | |
42 | public: | |
43 | wxCFStringRef() | |
44 | { | |
45 | } | |
46 | ||
47 | wxCFStringRef(const wxString &str, | |
48 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ; | |
49 | ||
50 | #if wxOSX_USE_COCOA_OR_IPHONE | |
51 | wxCFStringRef(NSString* ref) | |
52 | : wxCFRef< CFStringRef >((CFStringRef) ref) | |
53 | { | |
54 | } | |
55 | #endif | |
56 | ||
57 | wxCFStringRef(CFStringRef ref) | |
58 | : wxCFRef< CFStringRef >(ref) | |
59 | { | |
60 | } | |
61 | ||
62 | wxCFStringRef(const wxCFStringRef& otherRef ) | |
63 | : wxCFRef< CFStringRef >(otherRef) | |
64 | { | |
65 | } | |
66 | ||
67 | ~wxCFStringRef() | |
68 | { | |
69 | } | |
70 | ||
71 | wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; | |
72 | ||
73 | #if wxOSX_USE_COCOA_OR_IPHONE | |
74 | NSString* AsNSString() const { return (NSString*)(CFStringRef) *this; } | |
75 | #endif | |
76 | private: | |
77 | } ; | |
78 | ||
79 | // corresponding class for holding UniChars (native unicode characters) | |
80 | ||
81 | class WXDLLIMPEXP_BASE wxMacUniCharBuffer | |
82 | { | |
83 | public : | |
84 | wxMacUniCharBuffer( const wxString &str ) ; | |
85 | ||
86 | ~wxMacUniCharBuffer() ; | |
87 | ||
88 | UniCharPtr GetBuffer() ; | |
89 | ||
90 | UniCharCount GetChars() ; | |
91 | ||
92 | private : | |
93 | UniCharPtr m_ubuf ; | |
94 | UniCharCount m_chars ; | |
95 | }; | |
96 | #endif //__WXCFSTRINGHOLDER_H__ |