-
Notifications
You must be signed in to change notification settings - Fork 36
/
IGKDocSetManagedObject.m
78 lines (68 loc) · 1.85 KB
/
IGKDocSetManagedObject.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
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// IGKDocSetManagedObject.m
// Ingredients
//
// Created by Alex Gordon on 04/03/2010.
// Written in 2010 by Fileability.
//
#import "IGKDocSetManagedObject.h"
NSString *IGKDocSetShortPlatformName(NSString *platformFamily)
{
if ([platformFamily isEqual:@"macosx"])
return @"mac";
else if ([platformFamily isEqual:@"iphoneos"])
return @"iphone";
return platformFamily;
}
NSString *IGKDocSetShortVersionName(NSString *platformVersion)
{
if (![platformVersion length])
return @"unknown";
return platformVersion;
}
NSString *IGKDocSetLocalizedUserInterfaceName(NSString *platformFamily, NSString *version)
{
/* The name should be
Platform [Version]
eg
iPhone 3.2
Mac 10.6
*/
//*** Platform ***
NSString *platform = nil;
if ([platformFamily isEqual:@"macosx"])
platform = @"Mac ";
else if ([platformFamily isEqual:@"iphoneos"])
platform = @"iPhone ";
else if (![platformFamily length])
platform = @"Unknown ";
else
platform = [platformFamily stringByAppendingString:@" "];
//*** Version ***
if (version == nil)
version = @"";
NSString *localizedName = [platform stringByAppendingString:version];
return localizedName;
}
@implementation IGKDocSetManagedObject
- (NSString *)sdkComponent
{
return [NSString stringWithFormat:@"%@%@.sdk", [self valueForKey:@"platformFamily"], [self valueForKey:@"platformVersion"]];
}
- (NSString *)docsetURLHost
{
return [NSString stringWithFormat:@"%@/%@", [self shortPlatformName], [self shortVersionName]];
}
- (NSString *)shortPlatformName
{
return IGKDocSetShortPlatformName([self valueForKey:@"platformFamily"]);
}
- (NSString *)shortVersionName
{
return IGKDocSetShortVersionName([self valueForKey:@"platformVersion"]);
}
- (NSString *)localizedUserInterfaceName
{
return IGKDocSetLocalizedUserInterfaceName([self valueForKey:@"platformFamily"], [self valueForKey:@"platformVersion"]);
}
@end