Remove duplicate implementations of string conversion methods.
BUG=webrtc:4773 Review-Url: https://codereview.webrtc.org/2583853002 Cr-Commit-Position: refs/heads/master@{#15957}
This commit is contained in:
@ -20,6 +20,7 @@ namespace ios {
|
|||||||
|
|
||||||
bool CheckAndLogError(BOOL success, NSError* error);
|
bool CheckAndLogError(BOOL success, NSError* error);
|
||||||
|
|
||||||
|
NSString *NSStringFromStdString(const std::string& stdString);
|
||||||
std::string StdStringFromNSString(NSString* nsString);
|
std::string StdStringFromNSString(NSString* nsString);
|
||||||
|
|
||||||
// Return thread ID as a string.
|
// Return thread ID as a string.
|
||||||
|
|||||||
@ -166,6 +166,10 @@ rtc_source_set("test_support") {
|
|||||||
deps += [ "//base:base" ]
|
deps += [ "//base:base" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_ios) {
|
||||||
|
deps += [ "//webrtc/sdk:rtc_sdk_common_objc" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (rtc_use_memcheck) {
|
if (rtc_use_memcheck) {
|
||||||
data = valgrind_webrtc_dependencies
|
data = valgrind_webrtc_dependencies
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ include_rules = [
|
|||||||
"+webrtc/modules/rtp_rtcp",
|
"+webrtc/modules/rtp_rtcp",
|
||||||
"+webrtc/modules/video_capture",
|
"+webrtc/modules/video_capture",
|
||||||
"+webrtc/modules/video_coding",
|
"+webrtc/modules/video_coding",
|
||||||
|
"+webrtc/sdk",
|
||||||
"+webrtc/system_wrappers",
|
"+webrtc/system_wrappers",
|
||||||
"+webrtc/voice_engine",
|
"+webrtc/voice_engine",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -19,25 +19,13 @@
|
|||||||
|
|
||||||
#include "webrtc/base/checks.h"
|
#include "webrtc/base/checks.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
|
#include "webrtc/sdk/objc/Framework/Classes/helpers.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
// TODO(henrika): move to shared location.
|
using webrtc::ios::NSStringFromStdString;
|
||||||
// See https://code.google.com/p/webrtc/issues/detail?id=4773 for details.
|
using webrtc::ios::StdStringFromNSString;
|
||||||
NSString* NSStringFromStdString(const std::string& stdString) {
|
|
||||||
// std::string may contain null termination character so we construct
|
|
||||||
// using length.
|
|
||||||
return [[NSString alloc] initWithBytes:stdString.data()
|
|
||||||
length:stdString.length()
|
|
||||||
encoding:NSUTF8StringEncoding];
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string StdStringFromNSString(NSString* nsString) {
|
|
||||||
NSData* charData = [nsString dataUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
return std::string(reinterpret_cast<const char*>([charData bytes]),
|
|
||||||
[charData length]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For iOS, resource files are added to the application bundle in the root
|
// For iOS, resource files are added to the application bundle in the root
|
||||||
// and not in separate folders as is the case for other platforms. This method
|
// and not in separate folders as is the case for other platforms. This method
|
||||||
|
|||||||
Reference in New Issue
Block a user