Skip to content

Commit

Permalink
Add support for AlvinLiu arrange, etc. (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen authored May 23, 2023
1 parent e030161 commit 900277d
Show file tree
Hide file tree
Showing 20 changed files with 7,782 additions and 6,090 deletions.
22 changes: 16 additions & 6 deletions Sources/Tekkon/Tekkon_Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,17 @@ public enum Tekkon {
/// 在這裡將二十六個字母寫全,也只是為了方便做 validity check。
/// 這裡提前對複音按鍵做處理,然後再用程式判斷介母類型、據此判斷是否需要做複音切換。
static let mapDachenCP26StaticKeys: [String: String] = [
"a": "", "b": "", "c": "", "d": "", "e": "", "f": "", "g": "", "h": "", "i": "", "j": "", "k": "",
"l": "", "m": "", "n": "", "o": "", "p": "", "q": "", "r": "", "s": "", "t": "", "u": "", "v": "",
"w": "", "x": "", "y": "", "z": "", " ": " ",
"a": "", "b": "", "c": "", "d": "", "e": "", "f": "", "g": "", "h": "", "i": "", "j": "", "k": "",
"l": "", "m": "", "n": "", "o": "", "p": "", "q": "", "r": "", "s": "", "t": "", "u": "", "v": "",
"w": "", "x": "", "y": "", "z": "", " ": " ",
]

/// 許氏排列專用處理陣列,但未包含全部的映射內容。
///
/// 在這裡將二十六個字母寫全,也只是為了方便做 validity check。
/// 這裡提前對複音按鍵做處理,然後再用程式判斷介母類型、據此判斷是否需要做複音切換。
static let mapHsuStaticKeys: [String: String] = [
"a": "", "b": "", "c": "", "d": "", "e": "", "f": "", "g": "", "h": "", "i": "", "j": "", "k": "",
"a": "", "b": "", "c": "", "d": "", "e": "", "f": "", "g": "", "h": "", "i": "", "j": "", "k": "",
"l": "", "m": "", "n": "", "o": "", "p": "", "r": "", "s": "", "t": "", "u": "", "v": "", "w": "",
"x": "", "y": "", "z": "", " ": " ",
]
Expand All @@ -574,8 +574,18 @@ public enum Tekkon {
static let mapStarlightStaticKeys: [String: String] = [
"a": "", "b": "", "c": "", "d": "", "e": "", "f": "", "g": "", "h": "", "i": "", "j": "", "k": "",
"l": "", "m": "", "n": "", "o": "", "p": "", "q": "", "r": "", "s": "", "t": "", "u": "", "v": "",
"w": "", "x": "", "y": "", "z": "", " ": " ", "1": " ", "2": "ˊ", "3": "ˇ", "4": "ˋ", "5": "˙", "6": " ",
"7": "ˊ", "8": "ˇ", "9": "ˋ", "0": "˙",
"w": "", "x": "", "y": "", "z": "", "1": " ", "2": "ˊ", "3": "ˇ", "4": "ˋ", "5": "˙", "6": " ",
"7": "ˊ", "8": "ˇ", "9": "ˋ", "0": "˙", " ": " ",
]

/// 劉氏擬音注音排列預處理專用陣列,但未包含全部的映射內容。
///
/// 在這裡將二十六個字母寫全,也只是為了方便做 validity check。
/// 這裡提前對複音按鍵做處理,然後再用程式判斷介母類型、據此判斷是否需要做複音切換。
static let mapAlvinLiuStaticKeys: [String: String] = [
"q": "", "w": "", "e": "", "r": "", "t": "", "y": "", "u": "", "i": "", "o": "", "p": "", "a": "",
"s": "", "d": "", "f": "", "g": "", "h": "", "j": "", "k": "", "l": "", "z": "", "x": "", "c": "",
"v": "", "b": "", "n": "", "m": "", " ": " ",
]

/// 倚天傳統排列專用處理陣列。
Expand Down
8 changes: 5 additions & 3 deletions Sources/Tekkon/Tekkon_Phonabets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public extension Tekkon {
case ofSeigyou = 7
case ofFakeSeigyou = 8
case ofStarlight = 9
case ofAlvinLiu = 10
case ofHanyuPinyin = 100
case ofSecondaryPinyin = 101
case ofYalePinyin = 102
Expand Down Expand Up @@ -61,6 +62,8 @@ public extension Tekkon {
return "Seigyou"
case .ofStarlight:
return "Starlight"
case .ofAlvinLiu:
return "AlvinLiu"
case .ofHanyuPinyin:
return "HanyuPinyin"
case .ofSecondaryPinyin:
Expand Down Expand Up @@ -88,9 +91,8 @@ public extension Tekkon {
public var type: PhoneType = .null
private var valueStorage = ""
public var value: String { valueStorage }
public var isEmpty: Bool {
value.isEmpty
}
public var isEmpty: Bool { value.isEmpty }
public var isValid: Bool { type != .null }

/// 初期化,會根據傳入的 input 字串參數來自動判定自身的 PhoneType 類型屬性值。
public init(_ input: String = "") {
Expand Down
Loading

0 comments on commit 900277d

Please sign in to comment.