From 559209256e8bb24e1f80fc5d749e615460a4de58 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sat, 22 Apr 2017 16:12:11 +0200 Subject: [PATCH] GH-405 Delete unused class --- VimR.xcodeproj/project.pbxproj | 2 - VimR/PrefUtils.swift | 117 --------------------------------- 2 files changed, 119 deletions(-) delete mode 100644 VimR/PrefUtils.swift diff --git a/VimR.xcodeproj/project.pbxproj b/VimR.xcodeproj/project.pbxproj index f04c8942..6e5e0099 100644 --- a/VimR.xcodeproj/project.pbxproj +++ b/VimR.xcodeproj/project.pbxproj @@ -457,7 +457,6 @@ 4BEE79161D16D3800012EDAA /* CellAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellAttributes.swift; sourceTree = ""; }; 4BF07EE51D51326A009BECEB /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = Base; path = Base.lproj/Credits.rtf; sourceTree = ""; }; 4BF6E29B1D34153C0053FA76 /* KeyUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyUtils.swift; sourceTree = ""; }; - 4BF8EED71D85574800CAC08A /* PrefUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrefUtils.swift; sourceTree = ""; }; 4BF8EEDA1D85903000CAC08A /* PrefUtilsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrefUtilsTest.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -906,7 +905,6 @@ 4BF8EED91D858C4400CAC08A /* Utils */ = { isa = PBXGroup; children = ( - 4BF8EED71D85574800CAC08A /* PrefUtils.swift */, 1929BA8AC40B901B20F20B71 /* FileUtils.swift */, 1929BEEB33113B0E33C3830F /* Matcher.swift */, 1929B9D510177918080BE39B /* Scorer.swift */, diff --git a/VimR/PrefUtils.swift b/VimR/PrefUtils.swift deleted file mode 100644 index 103f2fea..00000000 --- a/VimR/PrefUtils.swift +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Tae Won Ha - http://taewon.de - @hataewon - * See LICENSE - */ - -import Foundation - -class PrefUtils { - - fileprivate static let whitespaceCharSet = CharacterSet.whitespaces - - static func ignorePatterns(fromString str: String) -> Set { - if str.trimmingCharacters(in: self.whitespaceCharSet).characters.count == 0 { - return Set() - } - - let patterns: [FileItemIgnorePattern] = str - .components(separatedBy: ",") - .flatMap { - let trimmed = $0.trimmingCharacters(in: self.whitespaceCharSet) - if trimmed.characters.count == 0 { - return nil - } - - return FileItemIgnorePattern(pattern: trimmed) - } - - return Set(patterns) - } - - static func ignorePatternString(fromSet set: Set) -> String { - return Array(set) - .map { $0.pattern } - .sorted() - .joined(separator: ", ") - } - - static func value(from dict: [String: Any], for key: String) -> T? { - return dict[key] as? T - } - - static func value(from dict: [String: Any], for key: String, default defaultValue: T) -> T { - return dict[key] as? T ?? defaultValue - } - - static func dict(from dict: [String: Any], for key: String) -> [String: Any]? { - return dict[key] as? [String: Any] - } - - static func float(from dict: [String: Any], for key: String, default defaultValue: Float) -> Float { - return (dict[key] as? NSNumber)?.floatValue ?? defaultValue - } - - static func float(from dict: [String: Any], for key: String) -> Float? { - guard let number = dict[key] as? NSNumber else { - return nil - } - - return number.floatValue - } - - static func bool(from dict: [String: Any], for key: String) -> Bool? { - guard let number = dict[key] as? NSNumber else { - return nil - } - - return number.boolValue - } - - static func bool(from dict: [String: Any], for key: String, default defaultValue: Bool) -> Bool { - return (dict[key] as? NSNumber)?.boolValue ?? defaultValue - } - - static func string(from dict: [String: Any], for key: String) -> String? { - return dict[key] as? String - } - - static func saneFont(_ fontName: String, fontSize: CGFloat) -> NSFont { - var editorFont = NSFont(name: fontName, size: fontSize) ?? NeoVimView.defaultFont - if !editorFont.isFixedPitch { - editorFont = NSFontManager.shared().convert(NeoVimView.defaultFont, toSize: editorFont.pointSize) - } - if editorFont.pointSize < NeoVimView.minFontSize || editorFont.pointSize > NeoVimView.maxFontSize { - editorFont = NSFontManager.shared().convert(editorFont, toSize: NeoVimView.defaultFont.pointSize) - } - - return editorFont - } - - static func saneLinespacing(_ fLinespacing: Float) -> CGFloat { - let linespacing = CGFloat(fLinespacing) - guard linespacing >= NeoVimView.minLinespacing && linespacing <= NeoVimView.maxLinespacing else { - return NeoVimView.defaultLinespacing - } - - return linespacing - } - - static func location(from strValue: String) -> WorkspaceBarLocation? { - switch strValue { - case "top": return .top - case "right": return .right - case "bottom": return .bottom - case "left": return .left - default: return nil - } - } - - static func locationAsString(for loc: WorkspaceBarLocation) -> String { - switch loc { - case .top: return "top" - case .right: return "right" - case .bottom: return "bottom" - case .left: return "left" - } - } -}