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

Unified Diff: webrtc/api/objc/RTCSessionDescription.mm

Issue 1696673003: Tweaks for new Objective-C API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Don't use object subscripting Created 4 years, 10 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 | « webrtc/api/objc/RTCSessionDescription.h ('k') | webrtc/api/objc/RTCSessionDescription+Private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/objc/RTCSessionDescription.mm
diff --git a/webrtc/api/objc/RTCSessionDescription.mm b/webrtc/api/objc/RTCSessionDescription.mm
index e401fbc3fbac17d02d03858ffc28aef731e59614..94c1a3f2d98e20b0c991d4ad2d913992458de0b9 100644
--- a/webrtc/api/objc/RTCSessionDescription.mm
+++ b/webrtc/api/objc/RTCSessionDescription.mm
@@ -21,6 +21,16 @@
@synthesize type = _type;
@synthesize sdp = _sdp;
++ (NSString *)stringForType:(RTCSdpType)type {
+ std::string string = [[self class] stdStringForType:type];
+ return [NSString stringForStdString:string];
+}
+
++ (RTCSdpType)typeForString:(NSString *)string {
+ std::string typeString = string.stdString;
+ return [[self class] typeForStdString:typeString];
+}
+
- (instancetype)initWithType:(RTCSdpType)type sdp:(NSString *)sdp {
NSParameterAssert(sdp.length);
if (self = [super init]) {
@@ -31,8 +41,8 @@
}
- (NSString *)description {
- return [NSString stringWithFormat:@"RTCSessionDescription:\n%s\n%@",
- [[self class] stringForType:_type].c_str(),
+ return [NSString stringWithFormat:@"RTCSessionDescription:\n%@\n%@",
+ [[self class] stringForType:_type],
_sdp];
}
@@ -42,7 +52,7 @@
webrtc::SdpParseError error;
webrtc::SessionDescriptionInterface *description =
- webrtc::CreateSessionDescription([[self class] stringForType:_type],
+ webrtc::CreateSessionDescription([[self class] stdStringForType:_type],
_sdp.stdString,
&error);
@@ -60,13 +70,13 @@
NSParameterAssert(nativeDescription);
std::string sdp;
nativeDescription->ToString(&sdp);
- RTCSdpType type = [[self class] typeForString:nativeDescription->type()];
+ RTCSdpType type = [[self class] typeForStdString:nativeDescription->type()];
return [self initWithType:type
sdp:[NSString stringForStdString:sdp]];
}
-+ (std::string)stringForType:(RTCSdpType)type {
++ (std::string)stdStringForType:(RTCSdpType)type {
switch (type) {
case RTCSdpTypeOffer:
return webrtc::SessionDescriptionInterface::kOffer;
@@ -77,7 +87,7 @@
}
}
-+ (RTCSdpType)typeForString:(const std::string &)string {
++ (RTCSdpType)typeForStdString:(const std::string &)string {
if (string == webrtc::SessionDescriptionInterface::kOffer) {
return RTCSdpTypeOffer;
} else if (string == webrtc::SessionDescriptionInterface::kPrAnswer) {
« no previous file with comments | « webrtc/api/objc/RTCSessionDescription.h ('k') | webrtc/api/objc/RTCSessionDescription+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698