| OLD | NEW |
| 1 //------------------------------------------------------------------------------
--------- | 1 //------------------------------------------------------------------------------
--------- |
| 2 // $Id$ | 2 // $Id$ |
| 3 // Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details. | 3 // Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details. |
| 4 //------------------------------------------------------------------------------
--------- | 4 //------------------------------------------------------------------------------
--------- |
| 5 | 5 |
| 6 #import "NSInvocation+OCMAdditions.h" | 6 #import "NSInvocation+OCMAdditions.h" |
| 7 | 7 |
| 8 | 8 |
| 9 @implementation NSInvocation(OCMAdditions) | 9 @implementation NSInvocation(OCMAdditions) |
| 10 | 10 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 - (NSString *)argumentDescriptionAtIndex:(int)argIndex | 155 - (NSString *)argumentDescriptionAtIndex:(int)argIndex |
| 156 { | 156 { |
| 157 const char *argType = [[self methodSignature] getArgumentTypeAtIndex:arg
Index]; | 157 const char *argType = [[self methodSignature] getArgumentTypeAtIndex:arg
Index]; |
| 158 if(strchr("rnNoORV", argType[0]) != NULL) | 158 if(strchr("rnNoORV", argType[0]) != NULL) |
| 159 argType += 1; | 159 argType += 1; |
| 160 | 160 |
| 161 switch(*argType) | 161 switch(*argType) |
| 162 { | 162 { |
| 163 case '@': return [self objectDescriptionAtIndex:argIndex]; | 163 case '@': return [self objectDescriptionAtIndex:argIndex]; |
| 164 case 'B': return [self boolDescriptionAtIndex:argIndex]; |
| 164 case 'c': return [self charDescriptionAtIndex:argIndex]; | 165 case 'c': return [self charDescriptionAtIndex:argIndex]; |
| 165 case 'C': return [self unsignedCharDescriptionAtIndex:argI
ndex]; | 166 case 'C': return [self unsignedCharDescriptionAtIndex:argI
ndex]; |
| 166 case 'i': return [self intDescriptionAtIndex:argIndex]; | 167 case 'i': return [self intDescriptionAtIndex:argIndex]; |
| 167 case 'I': return [self unsignedIntDescriptionAtIndex:argIn
dex]; | 168 case 'I': return [self unsignedIntDescriptionAtIndex:argIn
dex]; |
| 168 case 's': return [self shortDescriptionAtIndex:argIndex]; | 169 case 's': return [self shortDescriptionAtIndex:argIndex]; |
| 169 case 'S': return [self unsignedShortDescriptionAtIndex:arg
Index]; | 170 case 'S': return [self unsignedShortDescriptionAtIndex:arg
Index]; |
| 170 case 'l': return [self longDescriptionAtIndex:argIndex]; | 171 case 'l': return [self longDescriptionAtIndex:argIndex]; |
| 171 case 'L': return [self unsignedLongDescriptionAtIndex:argI
ndex]; | 172 case 'L': return [self unsignedLongDescriptionAtIndex:argI
ndex]; |
| 172 case 'q': return [self longLongDescriptionAtIndex:argIndex
]; | 173 case 'q': return [self longLongDescriptionAtIndex:argIndex
]; |
| 173 case 'Q': return [self unsignedLongLongDescriptionAtIndex:
argIndex]; | 174 case 'Q': return [self unsignedLongLongDescriptionAtIndex:
argIndex]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 190 | 191 |
| 191 [self getArgument:&object atIndex:anInt]; | 192 [self getArgument:&object atIndex:anInt]; |
| 192 if (object == nil) | 193 if (object == nil) |
| 193 return @"nil"; | 194 return @"nil"; |
| 194 else if(![object isProxy] && [object isKindOfClass:[NSString class]]) | 195 else if(![object isProxy] && [object isKindOfClass:[NSString class]]) |
| 195 return [NSString stringWithFormat:@"@\"%@\"", [object descriptio
n]]; | 196 return [NSString stringWithFormat:@"@\"%@\"", [object descriptio
n]]; |
| 196 else | 197 else |
| 197 return [object description]; | 198 return [object description]; |
| 198 } | 199 } |
| 199 | 200 |
| 201 - (NSString *)boolDescriptionAtIndex:(int)anInt |
| 202 { |
| 203 bool value; |
| 204 |
| 205 [self getArgument:&value atIndex:anInt]; |
| 206 return value ? @"YES" : @"NO"; |
| 207 } |
| 208 |
| 200 - (NSString *)charDescriptionAtIndex:(int)anInt | 209 - (NSString *)charDescriptionAtIndex:(int)anInt |
| 201 { | 210 { |
| 202 unsigned char buffer[128]; | 211 unsigned char buffer[128]; |
| 203 memset(buffer, 0x0, 128); | 212 memset(buffer, 0x0, 128); |
| 204 | 213 |
| 205 [self getArgument:&buffer atIndex:anInt]; | 214 [self getArgument:&buffer atIndex:anInt]; |
| 206 | 215 |
| 207 // If there's only one character in the buffer, and it's 0 or 1, then we
have a BOOL | 216 // If there's only one character in the buffer, and it's 0 or 1, then we
have a BOOL |
| 208 if (buffer[1] == '\0' && (buffer[0] == 0 || buffer[0] == 1)) | 217 if (buffer[1] == '\0' && (buffer[0] == 0 || buffer[0] == 1)) |
| 209 return [NSString stringWithFormat:@"%@", (buffer[0] == 1 ? @"YES
" : @"NO")]; | 218 return [NSString stringWithFormat:@"%@", (buffer[0] == 1 ? @"YES
" : @"NO")]; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 337 |
| 329 - (NSString *)selectorDescriptionAtIndex:(int)anInt | 338 - (NSString *)selectorDescriptionAtIndex:(int)anInt |
| 330 { | 339 { |
| 331 SEL selectorValue; | 340 SEL selectorValue; |
| 332 | 341 |
| 333 [self getArgument:&selectorValue atIndex:anInt]; | 342 [self getArgument:&selectorValue atIndex:anInt]; |
| 334 return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector
(selectorValue)]; | 343 return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector
(selectorValue)]; |
| 335 } | 344 } |
| 336 | 345 |
| 337 @end | 346 @end |
| OLD | NEW |