mirror of
https://github.com/mii443/AzooKeyKanaKanjiConverter.git
synced 2025-08-22 15:05:26 +00:00
Merge pull request #9 from ensan-hcl/refactoring/concurrency
Add Sendable Conformances
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum CIDData {
|
||||
public enum CIDData: Sendable {
|
||||
static var totalCount: Int {
|
||||
1319
|
||||
}
|
||||
|
@ -62,13 +62,13 @@ struct CandidateData {
|
||||
}
|
||||
}
|
||||
|
||||
public enum CompleteAction {
|
||||
public enum CompleteAction: Sendable {
|
||||
/// カーソルを調整する
|
||||
case moveCursor(Int)
|
||||
}
|
||||
|
||||
/// 変換候補のデータ
|
||||
public struct Candidate {
|
||||
public struct Candidate: Sendable {
|
||||
/// 入力となるテキスト
|
||||
public var text: String
|
||||
/// 評価値
|
||||
|
@ -14,7 +14,7 @@ import SwiftUtils
|
||||
/// のようになる。`
|
||||
/// カーソルのポジションもこのクラスが管理する。
|
||||
/// 設計方針として、inputStyleに関わる実装の違いは全てアップデート方法の違いとして吸収し、`input` / `delete` / `moveCursor` / `complete`時の違いとしては露出させないようにすることを目指した。
|
||||
public struct ComposingText {
|
||||
public struct ComposingText: Sendable {
|
||||
public init(convertTargetCursorPosition: Int = 0, input: [ComposingText.InputElement] = [], convertTarget: String = "") {
|
||||
self.convertTargetCursorPosition = convertTargetCursorPosition
|
||||
self.input = input
|
||||
@ -29,7 +29,7 @@ public struct ComposingText {
|
||||
public private(set) var convertTarget: String = ""
|
||||
|
||||
/// ユーザ入力の単位
|
||||
public struct InputElement {
|
||||
public struct InputElement: Sendable {
|
||||
/// 入力された文字
|
||||
public var character: Character
|
||||
/// そのときの入力方式(ローマ字入力 / ダイレクト入力)
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ConvertRequestOptions {
|
||||
public struct ConvertRequestOptions: Sendable {
|
||||
/// 変換リクエストに必要な設定データ
|
||||
///
|
||||
/// - parameters:
|
||||
@ -91,7 +91,7 @@ public struct ConvertRequestOptions {
|
||||
)
|
||||
}
|
||||
|
||||
public struct Metadata {
|
||||
public struct Metadata: Sendable {
|
||||
/// - parameters:
|
||||
/// - appVersionString: アプリのバージョンを指定します。このデータは`KanaKanjiCovnerter.toVersionCandidate(_:)`などで用いられます。
|
||||
public init(appVersionString: String) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct DicdataElement: Equatable, Hashable {
|
||||
public struct DicdataElement: Equatable, Hashable, Sendable {
|
||||
static let BOSData = Self(word: "", ruby: "", cid: CIDData.BOS.cid, mid: MIDData.BOS.mid, value: 0, adjust: 0)
|
||||
static let EOSData = Self(word: "", ruby: "", cid: CIDData.EOS.cid, mid: MIDData.EOS.mid, value: 0, adjust: 0)
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum MIDData {
|
||||
public enum MIDData: Sendable {
|
||||
static var totalCount: Int {
|
||||
503
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public struct TextReplacer {
|
||||
return results
|
||||
}
|
||||
|
||||
public struct SearchResultItem {
|
||||
public struct SearchResultItem: Sendable {
|
||||
public var query: String
|
||||
public var text: String
|
||||
public var inputable: Bool {
|
||||
@ -113,7 +113,7 @@ public struct TextReplacer {
|
||||
}
|
||||
}
|
||||
|
||||
public struct ReplacementCandidate {
|
||||
public struct ReplacementCandidate: Sendable {
|
||||
public var target: String
|
||||
public var replace: String
|
||||
public var base: String
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Created by ensan on 2023/04/30.
|
||||
//
|
||||
|
||||
public enum InputStyle: String {
|
||||
public enum InputStyle: String, Sendable {
|
||||
/// 入力された文字を直接入力するスタイル
|
||||
case direct = "direct"
|
||||
/// ローマ字日本語入力とするスタイル
|
||||
@ -19,7 +19,7 @@ public enum KeyboardLanguage: String, Codable, Equatable, Sendable {
|
||||
case none
|
||||
}
|
||||
|
||||
public enum LearningType: Int, CaseIterable {
|
||||
public enum LearningType: Int, CaseIterable, Sendable {
|
||||
case inputAndOutput
|
||||
case onlyOutput
|
||||
case nothing
|
||||
@ -33,13 +33,13 @@ public enum LearningType: Int, CaseIterable {
|
||||
}
|
||||
}
|
||||
|
||||
public enum ConverterBehaviorSemantics {
|
||||
public enum ConverterBehaviorSemantics: Sendable {
|
||||
/// 標準的な日本語入力のように、変換する候補を選ぶパターン
|
||||
case conversion
|
||||
/// iOSの英語入力のように、確定は不要だが、左右の文字列の置き換え候補が出てくるパターン
|
||||
case replacement([ReplacementTarget])
|
||||
|
||||
public enum ReplacementTarget: UInt8 {
|
||||
public enum ReplacementTarget: UInt8, Sendable {
|
||||
case emoji
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
import SwiftUtils
|
||||
|
||||
public struct TemplateData: Codable {
|
||||
public struct TemplateData: Codable, Sendable {
|
||||
public var name: String
|
||||
public var literal: any TemplateLiteralProtocol
|
||||
public var type: TemplateLiteralType
|
||||
@ -92,13 +92,13 @@ public struct TemplateData: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public protocol TemplateLiteralProtocol {
|
||||
public protocol TemplateLiteralProtocol: Sendable {
|
||||
func export() -> String
|
||||
|
||||
func previewString() -> String
|
||||
}
|
||||
|
||||
public enum TemplateLiteralType {
|
||||
public enum TemplateLiteralType: Sendable {
|
||||
case date
|
||||
case random
|
||||
}
|
||||
@ -113,7 +113,7 @@ public extension TemplateLiteralProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
|
||||
public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable, Sendable {
|
||||
public init(format: String, type: DateTemplateLiteral.CalendarType, language: DateTemplateLiteral.Language, delta: String, deltaUnit: Int) {
|
||||
self.format = format
|
||||
self.type = type
|
||||
@ -129,7 +129,7 @@ public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
|
||||
public var delta: String
|
||||
public var deltaUnit: Int
|
||||
|
||||
public enum CalendarType: String {
|
||||
public enum CalendarType: String, Sendable {
|
||||
case western
|
||||
case japanese
|
||||
|
||||
@ -143,7 +143,7 @@ public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
public enum Language: String {
|
||||
public enum Language: String, Sendable {
|
||||
case english = "en_US"
|
||||
case japanese = "ja_JP"
|
||||
|
||||
@ -183,7 +183,7 @@ public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct RandomTemplateLiteral: TemplateLiteralProtocol, Equatable {
|
||||
public struct RandomTemplateLiteral: TemplateLiteralProtocol, Equatable, Sendable {
|
||||
public init(value: RandomTemplateLiteral.Value) {
|
||||
self.value = value
|
||||
}
|
||||
@ -192,12 +192,12 @@ public struct RandomTemplateLiteral: TemplateLiteralProtocol, Equatable {
|
||||
lhs.value == rhs.value
|
||||
}
|
||||
|
||||
public enum ValueType: String {
|
||||
public enum ValueType: String, Sendable {
|
||||
case int
|
||||
case double
|
||||
case string
|
||||
}
|
||||
public enum Value: Equatable {
|
||||
public enum Value: Equatable, Sendable {
|
||||
case int(from: Int, to: Int)
|
||||
case double(from: Double, to: Double)
|
||||
case string([String])
|
||||
|
@ -13,7 +13,7 @@ import Foundation
|
||||
/// It is initialized with a string that represents a version of an app.
|
||||
/// The string must be in the format of "major.minor.patch".
|
||||
/// The string must not contain any other characters than numbers and dots.
|
||||
public struct AppVersion: Codable, Equatable, Comparable, Hashable, LosslessStringConvertible, CustomStringConvertible {
|
||||
public struct AppVersion: Codable, Equatable, Comparable, Hashable, LosslessStringConvertible, CustomStringConvertible, Sendable {
|
||||
|
||||
/// ParseError is an enum that represents an error that occurs when parsing a string to an AppVersion.
|
||||
private enum ParseError: Error {
|
||||
|
Reference in New Issue
Block a user