# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/App/Services/History/HistorySearchMode.swift

    Line

    Count

    Source (jump to first uncovered line)

    1

    //

    2

    //  HistorySearchMode.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 8/4/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Foundation

    10

    11

    enum HistorySearchMode: String, CaseIterable {

    12

        case fuzzyMatch

    13

        case regexpAnyCase

    14

        case regexpStrictCase

    15

        case substringMatch

    16

    17

    199

        var name: String {

    18

    199

            switch self {

    19

    199

            case .fuzzyMatch:

    20

    194

                return "searchmode_fuzzy".l7n

    21

    199

            case .regexpAnyCase:

    22

    2

                return "searchmode_regexp".l7n

    23

    199

            case .regexpStrictCase:

    24

    1

                return "searchmode_regexp_strict".l7n

    25

    199

            case .substringMatch:

    26

    2

                return "searchmode_substring".l7n

    27

    199

            }

    28

    199

        }

    29

    30

    97

        var toolTip: String {

    31

    97

            self.name + "_tooltip"

    32

    97

        }

    33

    34

    24

        static func searchMode(from string: String) -> HistorySearchMode {

    35

    24

            return HistorySearchMode(rawValue: string) ?? .fuzzyMatch

    36

    24

        }

    37

    38

    3

        var next: HistorySearchMode {

    39

    3

            guard let currentIndex = Self.allCases.firstIndex(of: self) else {

    40

    0

                return .fuzzyMatch

    41

    3

            }

    42

    3

            let nextIndex = (currentIndex + 1) % Self.allCases.count

    43

    3

            return Self.allCases[nextIndex]

    44

    3

        }

    45

    }