2008-06-11 12:30:48 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2010-07-13 09:29:58 -04:00
|
|
|
// Name: wx/osx/core/cfstring.h
|
2008-06-11 12:30:48 -04:00
|
|
|
// 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__
|
|
|
|
|
|
|
|
#include <CoreFoundation/CFString.h>
|
|
|
|
|
|
|
|
#include "wx/dlimpexp.h"
|
|
|
|
#include "wx/fontenc.h"
|
2008-06-11 15:17:41 -04:00
|
|
|
#include "wx/osx/core/cfref.h"
|
2008-06-11 12:30:48 -04:00
|
|
|
|
2009-02-01 04:17:20 -05:00
|
|
|
#ifdef WORDS_BIGENDIAN
|
2009-02-01 04:08:02 -05:00
|
|
|
#define kCFStringEncodingUTF32Native kCFStringEncodingUTF32BE
|
|
|
|
#else
|
|
|
|
#define kCFStringEncodingUTF32Native kCFStringEncodingUTF32LE
|
|
|
|
#endif
|
|
|
|
|
2008-06-11 12:30:48 -04:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxString;
|
|
|
|
|
|
|
|
WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ;
|
|
|
|
WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ;
|
|
|
|
|
|
|
|
WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ;
|
|
|
|
WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ;
|
|
|
|
|
|
|
|
WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
|
|
|
|
WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
|
|
|
|
WXDLLIMPEXP_BASE void wxMacWakeUp() ;
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef >
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxCFStringRef()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
wxCFStringRef(const wxString &str,
|
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ;
|
|
|
|
|
2008-07-29 16:26:45 -04:00
|
|
|
#if wxOSX_USE_COCOA_OR_IPHONE
|
|
|
|
wxCFStringRef(NSString* ref)
|
2009-08-21 06:41:26 -04:00
|
|
|
: wxCFRef< CFStringRef >((CFStringRef) ref)
|
2008-07-29 16:26:45 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-06-11 12:30:48 -04:00
|
|
|
wxCFStringRef(CFStringRef ref)
|
2009-08-21 06:41:26 -04:00
|
|
|
: wxCFRef< CFStringRef >(ref)
|
2008-06-11 12:30:48 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
wxCFStringRef(const wxCFStringRef& otherRef )
|
2009-08-21 06:41:26 -04:00
|
|
|
: wxCFRef< CFStringRef >(otherRef)
|
2008-06-11 12:30:48 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~wxCFStringRef()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-08-18 11:30:24 -04:00
|
|
|
wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) const;
|
2009-08-21 06:41:26 -04:00
|
|
|
|
2009-08-18 11:30:24 -04:00
|
|
|
static wxString AsString( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
|
|
|
|
#if wxOSX_USE_COCOA_OR_IPHONE
|
|
|
|
static wxString AsString( NSString* ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
|
|
|
|
#endif
|
2008-06-11 12:30:48 -04:00
|
|
|
|
2008-07-29 16:26:45 -04:00
|
|
|
#if wxOSX_USE_COCOA_OR_IPHONE
|
|
|
|
NSString* AsNSString() const { return (NSString*)(CFStringRef) *this; }
|
|
|
|
#endif
|
2008-06-11 12:30:48 -04:00
|
|
|
private:
|
|
|
|
} ;
|
|
|
|
|
|
|
|
// corresponding class for holding UniChars (native unicode characters)
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_BASE wxMacUniCharBuffer
|
|
|
|
{
|
|
|
|
public :
|
|
|
|
wxMacUniCharBuffer( const wxString &str ) ;
|
|
|
|
|
|
|
|
~wxMacUniCharBuffer() ;
|
|
|
|
|
|
|
|
UniCharPtr GetBuffer() ;
|
|
|
|
|
|
|
|
UniCharCount GetChars() ;
|
|
|
|
|
|
|
|
private :
|
|
|
|
UniCharPtr m_ubuf ;
|
|
|
|
UniCharCount m_chars ;
|
|
|
|
};
|
|
|
|
#endif //__WXCFSTRINGHOLDER_H__
|