OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/showcase/common/protocol_alerter.h" | 5 #import "ios/showcase/common/protocol_alerter.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 | 8 |
9 #import "base/logging.h" | 9 #import "base/logging.h" |
10 #import "base/strings/sys_string_conversions.h" | 10 #import "base/strings/sys_string_conversions.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return [self longLongDescriptionAtIndex:index]; | 163 return [self longLongDescriptionAtIndex:index]; |
164 // Add cases as needed here. | 164 // Add cases as needed here. |
165 default: | 165 default: |
166 return [NSString stringWithFormat:@"<Unknown Type:%s>", type]; | 166 return [NSString stringWithFormat:@"<Unknown Type:%s>", type]; |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 // Return a string describing an argument at |index| that's known to be an | 170 // Return a string describing an argument at |index| that's known to be an |
171 // objective-C object. | 171 // objective-C object. |
172 - (NSString*)objectDescriptionAtIndex:(NSInteger)index { | 172 - (NSString*)objectDescriptionAtIndex:(NSInteger)index { |
173 id object; | 173 __unsafe_unretained id object; |
174 | 174 |
175 [self getArgument:&object atIndex:index]; | 175 [self getArgument:&object atIndex:index]; |
176 if (!object) | 176 if (!object) |
177 return @"nil"; | 177 return @"nil"; |
178 | 178 |
179 NSString* description = [object description]; | 179 NSString* description = [object description]; |
180 NSString* className = NSStringFromClass([object class]); | 180 NSString* className = NSStringFromClass([object class]); |
181 if (!description) { | 181 if (!description) { |
182 return | 182 return |
183 [NSString stringWithFormat:@"<%@ object, no description>", className]; | 183 [NSString stringWithFormat:@"<%@ object, no description>", className]; |
(...skipping 20 matching lines...) Expand all Loading... |
204 // Returns a string describing an argument at |index| that is known to be a long | 204 // Returns a string describing an argument at |index| that is known to be a long |
205 // long. | 205 // long. |
206 - (NSString*)longLongDescriptionAtIndex:(NSInteger)index { | 206 - (NSString*)longLongDescriptionAtIndex:(NSInteger)index { |
207 long long value; | 207 long long value; |
208 | 208 |
209 [self getArgument:&value atIndex:index]; | 209 [self getArgument:&value atIndex:index]; |
210 return [NSString stringWithFormat:@"%lld", value]; | 210 return [NSString stringWithFormat:@"%lld", value]; |
211 } | 211 } |
212 | 212 |
213 @end | 213 @end |
OLD | NEW |