added CFStringRef methods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2003-05-12 19:11:16 +00:00
parent ff7744a993
commit 30d61191be
2 changed files with 48 additions and 0 deletions

View File

@@ -503,3 +503,27 @@ wxString wxGetOsDescription()
#endif
}
#if TARGET_CARBON
// converts this string into a carbon foundation string with optional pc 2 mac encoding
void wxMacCFStringHolder::Assign( const wxString &str )
{
m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
m_release = true ;
}
wxString wxMacCFStringHolder::AsString()
{
wxString result ;
Size len = CFStringGetLength( m_cfs ) ;
wxChar* buf = result.GetWriteBuf( len ) ;
CFStringGetCString( m_cfs , buf , len+1 , wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
buf[len] = 0 ;
result.UngetWriteBuf() ;
return result ;
}
#endif

View File

@@ -503,3 +503,27 @@ wxString wxGetOsDescription()
#endif
}
#if TARGET_CARBON
// converts this string into a carbon foundation string with optional pc 2 mac encoding
void wxMacCFStringHolder::Assign( const wxString &str )
{
m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
m_release = true ;
}
wxString wxMacCFStringHolder::AsString()
{
wxString result ;
Size len = CFStringGetLength( m_cfs ) ;
wxChar* buf = result.GetWriteBuf( len ) ;
CFStringGetCString( m_cfs , buf , len+1 , wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
buf[len] = 0 ;
result.UngetWriteBuf() ;
return result ;
}
#endif