Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: base/sys_string_conversions.h

Issue 6355: sys_string_conversions NSString* (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/foundation_utils_mac.h ('k') | base/sys_string_conversions_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_string_conversions.h
===================================================================
--- base/sys_string_conversions.h (revision 2969)
+++ base/sys_string_conversions.h (working copy)
@@ -14,7 +14,12 @@
#if defined(OS_MACOSX)
#include <CoreFoundation/CoreFoundation.h>
+#ifdef __OBJC__
+@class NSString;
+#else
+class NSString;
#endif
+#endif // OS_MACOSX
class StringPiece;
@@ -47,20 +52,27 @@
#if defined(OS_MACOSX)
-// Converts between STL strings and CFStringRefs.
+// Converts between STL strings and CFStringRefs/NSStrings.
// Creates a string, and returns it with a refcount of 1. You are responsible
// for releasing it. Returns NULL on failure.
CFStringRef SysUTF8ToCFStringRef(const std::string& utf8);
CFStringRef SysWideToCFStringRef(const std::wstring& wide);
+// Same, but returns an autoreleased NSString.
+NSString* SysUTF8ToNSString(const std::string& utf8);
+NSString* SysWideToNSString(const std::wstring& wide);
+
// Converts a CFStringRef to an STL string. Returns an empty string on failure.
std::string SysCFStringRefToUTF8(CFStringRef ref);
std::wstring SysCFStringRefToWide(CFStringRef ref);
+// Same, but accepts NSString input.
+std::string SysNSStringToUTF8(NSString* ref);
+std::wstring SysNSStringToWide(NSString* ref);
+
#endif // defined(OS_MACOSX)
} // namespace base
#endif // BASE_SYS_STRING_CONVERSIONS_H_
-
« no previous file with comments | « base/foundation_utils_mac.h ('k') | base/sys_string_conversions_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698