-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
66 lines (54 loc) · 1.24 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package kuroshiro
import "github.com/chanyeinthaw/kuroshiro.go/converter"
type ConvertTo string
type ConvertMode string
const (
HIRAGANA ConvertTo = "hiragana"
KATAKANA ConvertTo = "katakana"
ROMAJI ConvertTo = "romaji"
)
const (
NORMAL ConvertMode = "normal"
SPACED ConvertMode = "spaced"
OKURIGANA ConvertMode = "okurigana"
FURIGANA ConvertMode = "furigana"
)
type RomajiSystem string
const (
NIPPON = converter.ROMAJI_NIPPON
PASSPORT = converter.ROMAJI_PASSPORT
HEPBURN = converter.ROMAJI_HEPBURN
)
type Options struct {
to ConvertTo
mode ConvertMode
romajiSystem converter.RomajiSystem
delimiterStart string
delimiterEnd string
}
func NewOptions() *Options {
return &Options{
to: HIRAGANA,
mode: NORMAL,
romajiSystem: HEPBURN,
delimiterStart: "(",
delimiterEnd: ")",
}
}
func (o *Options) ConvertTo(to ConvertTo) *Options {
o.to = to
return o
}
func (o *Options) SetMode(mode ConvertMode) *Options {
o.mode = mode
return o
}
func (o *Options) SetRomajiSystem(system converter.RomajiSystem) *Options {
o.romajiSystem = system
return o
}
func (o *Options) SetDelimiter(start, end string) *Options {
o.delimiterStart = start
o.delimiterEnd = end
return o
}