dolphin/Externals/wxWidgets3/include/wx/cocoa/string.h
Soren Jorvang d14efe561b Import r67258 of the wxWidgets trunk, which I expect will before
long become wxWidgets 2.9.2, which in turn is expected to be the
last 2.9 release before the 3.0 stable release.

Since the full wxWidgets distribution is rather large, I have
imported only the parts that we use, on a subdirectory basis:

art
include/wx/*.*
include/wx/aui
include/wx/cocoa
include/wx/generic
include/wx/gtk
include/wx/meta
include/wx/msw
include/wx/osx
include/wx/persist
include/wx/private
include/wx/protocol
include/wx/unix
src/aui
src/common
src/generic
src/gtk
src/msw
src/osx
src/unix


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7380 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-03-20 18:05:19 +00:00

53 lines
1.8 KiB
Objective-C

///////////////////////////////////////////////////////////////////////////////
// Name: wx/cocoa/string.h
// Purpose: String conversion methods
// Author: David Elliott
// Modified by:
// Created: 2003/04/13
// RCS-ID: $Id: string.h 54721 2008-07-19 19:59:59Z VZ $
// Copyright: (c) 2003 David Elliott
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef __WX_COCOA_STRING_H__
#define __WX_COCOA_STRING_H__
#import <Foundation/NSString.h>
#include "wx/string.h"
// FIXME: In unicode mode we are doing the conversion twice. wxString
// converts to UTF-8 and NSString converts from UTF-8.
// One possible optimization is to convert to the wxString internal
// representation which is an unsigned short (unichar) but unfortunately
// there is little documentation on which encoding it uses by default.
// Return an autoreleased NSString
inline NSString* wxNSStringWithWxString(const wxString &wxstring)
{
#if wxUSE_UNICODE
return [NSString stringWithUTF8String: wxstring.utf8_str()];
#else
return [NSString stringWithCString: wxstring.c_str() length:wxstring.Len()];
#endif // wxUSE_UNICODE
}
// Intialize an NSString which has already been allocated
inline NSString* wxInitNSStringWithWxString(NSString *nsstring, const wxString &wxstring)
{
#if wxUSE_UNICODE
return [nsstring initWithUTF8String: wxstring.utf8_str()];
#else
return [nsstring initWithCString: wxstring.c_str() length:wxstring.Len()];
#endif // wxUSE_UNICODE
}
inline wxString wxStringWithNSString(NSString *nsstring)
{
#if wxUSE_UNICODE
return wxString::FromUTF8Unchecked([nsstring UTF8String]);
#else
return wxString([nsstring lossyCString]);
#endif // wxUSE_UNICODE
}
#endif // __WX_COCOA_STRING_H__