frostfs-node/pkg/innerring/alphabet.go

136 lines
2.4 KiB
Go
Raw Permalink Normal View History

package innerring
import "github.com/nspcc-dev/neo-go/pkg/util"
type GlagoliticLetter int8
const (
_ GlagoliticLetter = iota - 1
az
buky
vedi
glagoli
dobro
yest
zhivete
dzelo
zemlja
izhe
izhei
gerv
kako
ljudi
mislete
nash
on
pokoj
rtsi
slovo
tverdo
uk
fert
kher
oht
shta
tsi
cherv
sha
yer
yeri
yerj
yat
jo
yu
smallYus
smallIotatedYus
bigYus
bigIotatedYus
fita
izhitsa
lastLetterNum
)
var glagolicLetterToString = map[GlagoliticLetter]string{
az: "az",
buky: "buky",
vedi: "vedi",
glagoli: "glagoli",
dobro: "dobro",
yest: "yest",
zhivete: "zhivete",
dzelo: "dzelo",
zemlja: "zemlja",
izhe: "izhe",
izhei: "izhei",
gerv: "gerv",
kako: "kako",
ljudi: "ljudi",
mislete: "mislete",
nash: "nash",
on: "on",
pokoj: "pokoj",
rtsi: "rtsi",
slovo: "slovo",
tverdo: "tverdo",
uk: "uk",
fert: "fert",
kher: "kher",
oht: "oht",
shta: "shta",
tsi: "tsi",
cherv: "cherv",
sha: "sha",
yer: "yer",
yeri: "yeri",
yerj: "yerj",
yat: "yat",
jo: "jo",
yu: "yu",
smallYus: "small.yus",
smallIotatedYus: "small.iotated.yus",
bigYus: "big.yus",
bigIotatedYus: "big.iotated.yus",
fita: "fita",
izhitsa: "izhitsa",
}
// String returns l in config-compatible format.
func (l GlagoliticLetter) String() string {
if str, found := glagolicLetterToString[l]; found {
return str
}
return "unknown"
}
type alphabetContracts map[GlagoliticLetter]util.Uint160
func newAlphabetContracts() alphabetContracts {
return make(map[GlagoliticLetter]util.Uint160, lastLetterNum)
}
func (a alphabetContracts) GetByIndex(ind int) (util.Uint160, bool) {
if ind < 0 || ind >= int(lastLetterNum) {
return util.Uint160{}, false
}
contract, ok := a[GlagoliticLetter(ind)]
return contract, ok
}
func (a alphabetContracts) indexOutOfRange(ind int) bool {
return ind < 0 && ind >= len(a)
}
func (a alphabetContracts) iterate(f func(GlagoliticLetter, util.Uint160)) {
for letter, contract := range a {
f(letter, contract)
}
}
func (a *alphabetContracts) set(l GlagoliticLetter, h util.Uint160) {
(*a)[l] = h
}