forked from Polidea/ios-class-guard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CDLCVersionMinimum.m
65 lines (49 loc) · 1.65 KB
/
CDLCVersionMinimum.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- mode: ObjC -*-
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
// Copyright (C) 1997-1998, 2000-2001, 2004-2015 Steve Nygard.
#import "CDLCVersionMinimum.h"
#import "CDMachOFile.h"
@implementation CDLCVersionMinimum
{
struct version_min_command _versionMinCommand;
}
- (id)initWithDataCursor:(CDMachOFileDataCursor *)cursor;
{
if ((self = [super initWithDataCursor:cursor])) {
_versionMinCommand.cmd = [cursor readInt32];
_versionMinCommand.cmdsize = [cursor readInt32];
_versionMinCommand.version = [cursor readInt32];
_versionMinCommand.sdk = [cursor readInt32];
}
return self;
}
#pragma mark -
- (uint32_t)cmd;
{
return _versionMinCommand.cmd;
}
- (uint32_t)cmdsize;
{
return _versionMinCommand.cmdsize;
}
- (NSString *)minimumVersionString;
{
uint32_t x = (_versionMinCommand.version >> 16);
uint32_t y = (_versionMinCommand.version >> 8) & 0xff;
uint32_t z = _versionMinCommand.version & 0xff;
return [NSString stringWithFormat:@"%u.%u.%u", x, y, z];
}
- (NSString *)SDKVersionString;
{
uint32_t x = (_versionMinCommand.sdk >> 16);
uint32_t y = (_versionMinCommand.sdk >> 8) & 0xff;
uint32_t z = _versionMinCommand.sdk & 0xff;
return [NSString stringWithFormat:@"%u.%u.%u", x, y, z];
}
- (void)appendToString:(NSMutableString *)resultString verbose:(BOOL)isVerbose;
{
[super appendToString:resultString verbose:isVerbose];
[resultString appendFormat:@" Minimum version: %@\n", self.minimumVersionString];
[resultString appendFormat:@" SDK version: %@\n", self.SDKVersionString];
}
@end