1
0
mirror of https://github.com/garraflavatra/go-fmp.git synced 2025-07-17 19:44:06 +00:00

Table parsing (WIP)

This commit is contained in:
2025-06-12 11:44:57 +02:00
parent 43523c458a
commit 8562e1147b
6 changed files with 68 additions and 17 deletions

View File

@ -39,7 +39,11 @@ type FmpDictEntry struct {
Children *FmpDict
}
func (dict *FmpDict) get(path []uint16) []byte {
type FmpTable struct {
Name string
}
func (dict *FmpDict) get(path []uint16) *FmpDictEntry {
for i, key := range path {
_, ok := (*dict)[key]
if !ok {
@ -47,7 +51,7 @@ func (dict *FmpDict) get(path []uint16) []byte {
}
if i == len(path)-1 {
return (*dict)[key].Value
return (*dict)[key]
} else {
dict = (*dict)[key].Children
}
@ -55,6 +59,14 @@ func (dict *FmpDict) get(path []uint16) []byte {
return nil
}
func (dict *FmpDict) getValue(path []uint16) []byte {
ent := dict.get(path)
if ent != nil {
return ent.Value
}
return nil
}
func (dict *FmpDict) set(path []uint16, value []byte) {
for i, key := range path {
_, ok := (*dict)[key]