OLD | NEW |
(Empty) | |
| 1 // -*- mode: ObjC -*- |
| 2 |
| 3 // This file is part of class-dump, a utility for examining the Objective-C seg
ment of Mach-O files. |
| 4 // Copyright (C) 1997-1998, 2000-2001, 2004-2010 Steve Nygard. |
| 5 |
| 6 #import "CDLCUUID.h" |
| 7 |
| 8 #import "CDMachOFile.h" |
| 9 |
| 10 @implementation CDLCUUID |
| 11 |
| 12 - (id)initWithDataCursor:(CDDataCursor *)cursor machOFile:(CDMachOFile *)aMachOF
ile; |
| 13 { |
| 14 unsigned int index; |
| 15 |
| 16 if ([super initWithDataCursor:cursor machOFile:aMachOFile] == nil) |
| 17 return nil; |
| 18 |
| 19 uuidCommand.cmd = [cursor readInt32]; |
| 20 uuidCommand.cmdsize = [cursor readInt32]; |
| 21 for (index = 0; index < 16; index++) { |
| 22 uuidCommand.uuid[index] = [cursor readByte]; |
| 23 } |
| 24 // Lovely API |
| 25 uuid = CFUUIDCreateWithBytes(kCFAllocatorDefault, |
| 26 uuidCommand.uuid[0], |
| 27 uuidCommand.uuid[1], |
| 28 uuidCommand.uuid[2], |
| 29 uuidCommand.uuid[3], |
| 30 uuidCommand.uuid[4], |
| 31 uuidCommand.uuid[5], |
| 32 uuidCommand.uuid[6], |
| 33 uuidCommand.uuid[7], |
| 34 uuidCommand.uuid[8], |
| 35 uuidCommand.uuid[9], |
| 36 uuidCommand.uuid[10], |
| 37 uuidCommand.uuid[11], |
| 38 uuidCommand.uuid[12], |
| 39 uuidCommand.uuid[13], |
| 40 uuidCommand.uuid[14], |
| 41 uuidCommand.uuid[15]); |
| 42 |
| 43 return self; |
| 44 } |
| 45 |
| 46 - (void)dealloc; |
| 47 { |
| 48 CFRelease(uuid); |
| 49 |
| 50 [super dealloc]; |
| 51 } |
| 52 |
| 53 - (uint32_t)cmd; |
| 54 { |
| 55 return uuidCommand.cmd; |
| 56 } |
| 57 |
| 58 - (uint32_t)cmdsize; |
| 59 { |
| 60 return uuidCommand.cmdsize; |
| 61 } |
| 62 |
| 63 - (NSString *)uuidString; |
| 64 { |
| 65 return [NSMakeCollectable(CFUUIDCreateString(kCFAllocatorDefault, uuid)) aut
orelease]; |
| 66 } |
| 67 |
| 68 - (void)appendToString:(NSMutableString *)resultString verbose:(BOOL)isVerbose; |
| 69 { |
| 70 [super appendToString:resultString verbose:isVerbose]; |
| 71 |
| 72 [resultString appendString:@" uuid "]; |
| 73 [resultString appendString:[self uuidString]]; |
| 74 [resultString appendString:@"\n"]; |
| 75 } |
| 76 |
| 77 @end |
OLD | NEW |