F4AA59281E1CEF8E001667AF /* HMPlanToShowsBoldFontTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4AA59271E1CEF8E001667AF /* HMPlanToShowsBoldFontTransformer.swift */; };
F4AA592A1E1D1387001667AF /* HMIgnoreZeroTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4AA59291E1D1387001667AF /* HMIgnoreZeroTransformer.swift */; };
F4AA592E1E1D1D4D001667AF /* HMSokuTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4AA592D1E1D1D4D001667AF /* HMSokuTransformer.swift */; };
+ F4AA59301E1D1FAB001667AF /* HMLengTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4AA592F1E1D1FAB001667AF /* HMLengTransformer.swift */; };
F4AC136D1E0802C000851147 /* HMPreferencePanelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4AC136C1E0802C000851147 /* HMPreferencePanelController.swift */; };
F4AC136F1E0963DB00851147 /* HMProgressPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4AC136E1E0963DB00851147 /* HMProgressPanel.swift */; };
F4AC13711E096A7B00851147 /* HMHistoryWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4AC13701E096A7B00851147 /* HMHistoryWindowController.swift */; };
F4D6BC4F1A938EFC00742FEB /* HMDropShipHistoryCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D6BC4E1A938EFC00742FEB /* HMDropShipHistoryCommand.m */; };
F4D6BC551A93903E00742FEB /* HMDropShipHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D6BC541A93903E00742FEB /* HMDropShipHistory.m */; };
F4D6BC9C1AA1FAC700742FEB /* HMUITestWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D6BC9A1AA1FAC600742FEB /* HMUITestWindowController.m */; };
- F4D6BCB01AA2A97200742FEB /* HMLengTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D6BCAF1AA2A97200742FEB /* HMLengTransformer.m */; };
F4D6BCB31AA2B18100742FEB /* HMSlotitemNameTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D6BCB21AA2B18100742FEB /* HMSlotitemNameTransformer.m */; };
F4E33B5818BF5F67005B8C07 /* HMMemberSlotItemCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E33B5718BF5F67005B8C07 /* HMMemberSlotItemCommand.m */; };
F4E5FF021E150A850026868C /* HMAncherageRepairTimerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4E5FF011E150A850026868C /* HMAncherageRepairTimerViewController.swift */; };
F4AA59271E1CEF8E001667AF /* HMPlanToShowsBoldFontTransformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMPlanToShowsBoldFontTransformer.swift; sourceTree = "<group>"; };
F4AA59291E1D1387001667AF /* HMIgnoreZeroTransformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMIgnoreZeroTransformer.swift; sourceTree = "<group>"; };
F4AA592D1E1D1D4D001667AF /* HMSokuTransformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMSokuTransformer.swift; sourceTree = "<group>"; };
+ F4AA592F1E1D1FAB001667AF /* HMLengTransformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMLengTransformer.swift; sourceTree = "<group>"; };
F4AC136C1E0802C000851147 /* HMPreferencePanelController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMPreferencePanelController.swift; sourceTree = "<group>"; };
F4AC136E1E0963DB00851147 /* HMProgressPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMProgressPanel.swift; sourceTree = "<group>"; };
F4AC13701E096A7B00851147 /* HMHistoryWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMHistoryWindowController.swift; sourceTree = "<group>"; };
F4D6BC541A93903E00742FEB /* HMDropShipHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMDropShipHistory.m; sourceTree = "<group>"; };
F4D6BC991AA1FAC600742FEB /* HMUITestWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMUITestWindowController.h; sourceTree = "<group>"; };
F4D6BC9A1AA1FAC600742FEB /* HMUITestWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMUITestWindowController.m; sourceTree = "<group>"; };
- F4D6BCAE1AA2A97100742FEB /* HMLengTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMLengTransformer.h; sourceTree = "<group>"; };
- F4D6BCAF1AA2A97200742FEB /* HMLengTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMLengTransformer.m; sourceTree = "<group>"; };
F4D6BCB11AA2B18100742FEB /* HMSlotitemNameTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMSlotitemNameTransformer.h; sourceTree = "<group>"; };
F4D6BCB21AA2B18100742FEB /* HMSlotitemNameTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMSlotitemNameTransformer.m; sourceTree = "<group>"; };
F4E33B5618BF5F67005B8C07 /* HMMemberSlotItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberSlotItemCommand.h; sourceTree = "<group>"; };
F4AA59271E1CEF8E001667AF /* HMPlanToShowsBoldFontTransformer.swift */,
F4AA59291E1D1387001667AF /* HMIgnoreZeroTransformer.swift */,
F4AA592D1E1D1D4D001667AF /* HMSokuTransformer.swift */,
- F4D6BCAE1AA2A97100742FEB /* HMLengTransformer.h */,
- F4D6BCAF1AA2A97200742FEB /* HMLengTransformer.m */,
+ F4AA592F1E1D1FAB001667AF /* HMLengTransformer.swift */,
F4D6BCB11AA2B18100742FEB /* HMSlotitemNameTransformer.h */,
F4D6BCB21AA2B18100742FEB /* HMSlotitemNameTransformer.m */,
F46FCB271BD933C600304DE7 /* HMSlotItemShortNameTransformer.h */,
F4E5FF101E17A83D0026868C /* HMScreenshotListWindowController.swift in Sources */,
F48A70671DE5D62C005DFC0B /* HMOrderedSetToArrayTransformer.m in Sources */,
F44AB23E19E824D700F217AF /* HMKCSlotItemObject.m in Sources */,
- F4D6BCB01AA2A97200742FEB /* HMLengTransformer.m in Sources */,
F45771231E1BCC7C008A9215 /* HMPeriodicNotifier.swift in Sources */,
F4B414F518B1888800468DAF /* HMMasterFurnitureCommand.m in Sources */,
F4AA0601192E1FE900844688 /* HMBattleCommand.m in Sources */,
F4A3AD8819B6149D00FDBF80 /* HMNyukyoStartCommand.m in Sources */,
F4D6BC9C1AA1FAC700742FEB /* HMUITestWindowController.m in Sources */,
F4B1E30C19D1C06900805879 /* HMHokyuChargeCommand.m in Sources */,
+ F4AA59301E1D1FAB001667AF /* HMLengTransformer.swift in Sources */,
F4E5FF081E1542780026868C /* HMScreenshotEditorViewController.swift in Sources */,
F46F104918ABAC910063E503 /* KCD.xcdatamodeld in Sources */,
F4B414FE18B3A66200468DAF /* HMMemberNDockCommand.m in Sources */,
+++ /dev/null
-//
-// HMLengTransformer.m
-// KCD
-//
-// Created by Hori,Masaki on 2015/03/01.
-// Copyright (c) 2015年 Hori,Masaki. All rights reserved.
-//
-
-#import "HMLengTransformer.h"
-
-typedef NS_ENUM(NSInteger, LengType) {
- kShort = 1,
- kMiddle = 2,
- kLong = 3,
- kOverLong = 4,
-};
-
-@implementation HMLengTransformer
-//+ (void)load
-//{
-// static dispatch_once_t onceToken;
-// dispatch_once(&onceToken, ^{
-// [NSValueTransformer setValueTransformer:[self new] forName:@"HMLengTransformer"];
-// });
-//}
-+ (Class)transformedValueClass
-{
- return [NSString class];
-}
-+ (BOOL)allowsReverseTransformation
-{
- return NO;
-}
-
-- (id)transformedValue:(id)value
-{
- if(![value isKindOfClass:[NSNumber class]]) return nil;
-
- NSString *result = nil;
- LengType leng = [value integerValue];
- switch (leng) {
- case kShort:
- result = NSLocalizedString(@"Short", @"Range, short");
- break;
- case kMiddle:
- result = NSLocalizedString(@"Middle", @"Range, middle");
- break;
- case kLong:
- result = NSLocalizedString(@"Long", @"Range, long");
- break;
- case kOverLong:
- result = NSLocalizedString(@"Very Long", @"Range, very long");
- break;
- }
-
- return result;
-}
-@end
--- /dev/null
+//
+// HMLengTransformer.swift
+// KCD
+//
+// Created by Hori,Masaki on 2017/01/04.
+// Copyright © 2017年 Hori,Masaki. All rights reserved.
+//
+
+import Cocoa
+
+fileprivate enum LengType: Int {
+ case short = 1
+ case middle
+ case long
+ case overLong
+}
+
+class HMLengTransformer: ValueTransformer {
+ override class func transformedValueClass() -> Swift.AnyClass {
+ return String.self as! AnyClass
+ }
+ override func transformedValue(_ value: Any?) -> Any? {
+ guard let v = value as? Int, let type = LengType(rawValue: v) else { return nil }
+ switch type {
+ case .short:
+ return NSLocalizedString("Short", comment: "Range, short")
+ case .middle:
+ return NSLocalizedString("Middle", comment: "Range, middle")
+ case .long:
+ return NSLocalizedString("Long", comment: "Range, long")
+ case .overLong:
+ return NSLocalizedString("Very Long", comment: "Range, very long")
+ }
+ }
+}