| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 - (NSString*)argumentDescriptionAtIndex:(NSInteger)index { | 155 - (NSString*)argumentDescriptionAtIndex:(NSInteger)index { |
| 156 const char* type = [self.methodSignature getArgumentTypeAtIndex:index]; | 156 const char* type = [self.methodSignature getArgumentTypeAtIndex:index]; |
| 157 | 157 |
| 158 switch (*type) { | 158 switch (*type) { |
| 159 case '@': | 159 case '@': |
| 160 return [self objectDescriptionAtIndex:index]; | 160 return [self objectDescriptionAtIndex:index]; |
| 161 case 'q': | 161 case 'q': |
| 162 return [self longLongDescriptionAtIndex:index]; | 162 return [self longLongDescriptionAtIndex:index]; |
| 163 // Add cases as needed here. | 163 // Add cases as needed here. |
| 164 default: | 164 default: |
| 165 return [NSString stringWithFormat:@"<Unknown Type:%c>", *type]; | 165 return [NSString stringWithFormat:@"<Unknown Type:%s>", type]; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Return a string describing an argument at |index| that's known to be an | 169 // Return a string describing an argument at |index| that's known to be an |
| 170 // objective-C object. | 170 // objective-C object. |
| 171 - (NSString*)objectDescriptionAtIndex:(NSInteger)index { | 171 - (NSString*)objectDescriptionAtIndex:(NSInteger)index { |
| 172 id object; | 172 id object; |
| 173 | 173 |
| 174 [self getArgument:&object atIndex:index]; | 174 [self getArgument:&object atIndex:index]; |
| 175 if (!object) | 175 if (!object) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 203 // Returns a string describing an argument at |index| that is known to be a long | 203 // Returns a string describing an argument at |index| that is known to be a long |
| 204 // long. | 204 // long. |
| 205 - (NSString*)longLongDescriptionAtIndex:(NSInteger)index { | 205 - (NSString*)longLongDescriptionAtIndex:(NSInteger)index { |
| 206 long long value; | 206 long long value; |
| 207 | 207 |
| 208 [self getArgument:&value atIndex:index]; | 208 [self getArgument:&value atIndex:index]; |
| 209 return [NSString stringWithFormat:@"%lld", value]; | 209 return [NSString stringWithFormat:@"%lld", value]; |
| 210 } | 210 } |
| 211 | 211 |
| 212 @end | 212 @end |
| OLD | NEW |