From 8618e83c9dca62a2dcda22020b78a6dd67ce09c8 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 4 May 2022 20:01:58 +0800 Subject: [PATCH] Repo // Remove useless KeyValueStructs. --- .../LangModelRelated/KeyValueStructs.swift | 63 ------------------- .../SubLMs/lmReplacements.swift | 2 +- vChewing.xcodeproj/project.pbxproj | 4 -- 3 files changed, 1 insertion(+), 68 deletions(-) delete mode 100644 Source/Modules/LangModelRelated/KeyValueStructs.swift diff --git a/Source/Modules/LangModelRelated/KeyValueStructs.swift b/Source/Modules/LangModelRelated/KeyValueStructs.swift deleted file mode 100644 index 8c6adac1..00000000 --- a/Source/Modules/LangModelRelated/KeyValueStructs.swift +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2021 and onwards The vChewing Project (MIT-NTL License). -/* -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -1. The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -2. No trademark license is granted to use the trade names, trademarks, service -marks, or product names of Contributor, except as required to fulfill notice -requirements above. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -import Foundation - -extension vChewing { - @frozen public struct KeyValue: Equatable { - var key: String - var value: String - - public init(key: String = "", value: String = "") { - self.key = key - self.value = value - } - - public static func == (lhs: KeyValue, rhs: KeyValue) -> Bool { - lhs.key == rhs.key && lhs.value == rhs.value - } - } - - @frozen public struct KeyValueRate: Equatable { - var key: String - var value: String - var rate: Double - - public init(key: String = "", value: String = "", rate: Double = 0.0) { - self.key = key - self.value = value - self.rate = rate - } - - public init(keyValue: KeyValue = KeyValue(key: "", value: ""), rate: Double = 0.0) { - key = keyValue.key - value = keyValue.value - self.rate = rate - } - - public static func == (lhs: KeyValueRate, rhs: KeyValueRate) -> Bool { - lhs.key == rhs.key && lhs.value == rhs.value && lhs.rate == rhs.rate - } - } -} diff --git a/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift b/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift index 6b04ac45..9cfc5ff5 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift @@ -70,7 +70,7 @@ extension vChewing { } continue } - var currentKV = KeyValue() + var currentKV = Megrez.KeyValuePair() for (unitID, unitContent) in lineContent.components(separatedBy: " ").enumerated() { switch unitID { case 0: diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index c1aaf935..c26107d8 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -96,7 +96,6 @@ 5BD05C6A27B2BBEF004C4F1D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BD05C6527B2BBEF004C4F1D /* ViewController.swift */; }; 5BDC1CFA27FDF1310052C2B9 /* apiUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BDC1CF927FDF1310052C2B9 /* apiUpdate.swift */; }; 5BDCBB2E27B4E67A00D0CC59 /* vChewingPhraseEditor.app in Resources */ = {isa = PBXBuildFile; fileRef = 5BD05BB827B2A429004C4F1D /* vChewingPhraseEditor.app */; }; - 5BE33BED28169B5D00CE5BB0 /* KeyValueStructs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE33BEC28169B5D00CE5BB0 /* KeyValueStructs.swift */; }; 5BE78BD927B3775B005EA1BE /* ctlAboutWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE78BD827B37750005EA1BE /* ctlAboutWindow.swift */; }; 5BE78BDD27B3776D005EA1BE /* frmAboutWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE78BDA27B37764005EA1BE /* frmAboutWindow.xib */; }; 5BF8423127BAA942008E7E4C /* vChewingKanjiConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF8423027BAA942008E7E4C /* vChewingKanjiConverter.swift */; }; @@ -286,7 +285,6 @@ 5BDCBB4A27B4F6C700D0CC59 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; 5BDCBB4B27B4F6C700D0CC59 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/frmAboutWindow.strings"; sourceTree = ""; }; 5BDCBB4D27B4F6C700D0CC59 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = ""; }; - 5BE33BEC28169B5D00CE5BB0 /* KeyValueStructs.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; fileEncoding = 4; lineEnding = 0; path = KeyValueStructs.swift; sourceTree = ""; usesTabs = 0; }; 5BE78BD827B37750005EA1BE /* ctlAboutWindow.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; fileEncoding = 4; indentWidth = 2; lineEnding = 0; path = ctlAboutWindow.swift; sourceTree = ""; tabWidth = 2; usesTabs = 0; }; 5BE78BDB27B37764005EA1BE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/frmAboutWindow.xib; sourceTree = ""; }; 5BE78BDF27B37968005EA1BE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/frmAboutWindow.strings; sourceTree = ""; }; @@ -496,7 +494,6 @@ children = ( 5B62A32527AE758000A19448 /* OldFileReferences */, 5B407308281672610023DFFF /* SubLMs */, - 5BE33BEC28169B5D00CE5BB0 /* KeyValueStructs.swift */, 5B949BDA2816DDBC00D87B5D /* LMConsolidator.swift */, 5BD0113A28180D6100609769 /* LMInstantiator.swift */, 5BAEFACF28012565001F42C9 /* mgrLangModel.swift */, @@ -1124,7 +1121,6 @@ 5B40730D281672610023DFFF /* lmReplacements.swift in Sources */, 5B38F59E281E2E49007D5F5D /* 6_Bigram.swift in Sources */, 5B62A33227AE792F00A19448 /* InputSourceHelper.swift in Sources */, - 5BE33BED28169B5D00CE5BB0 /* KeyValueStructs.swift in Sources */, 5B5E535227EF261400C6AA1E /* IME.swift in Sources */, 5B62A34927AE7CD900A19448 /* TooltipController.swift in Sources */, 6A0D4F4515FC0EB100ABF4B3 /* Mandarin.cpp in Sources */,