1
0
Fork 0
mirror of https://github.com/Luzifer/sii.git synced 2024-10-18 05:14:19 +00:00
sii/unit.go

33 lines
589 B
Go

package sii
type Block interface {
Name() string
Type() string
}
type Marshaler interface {
MarshalSII() ([]byte, error)
}
type Unmarshaler interface {
UnmarshalSII([]byte) error
}
type RawBlock struct {
Data []byte
blockName string
blockType string
}
func (r RawBlock) MarshalSII() []byte { return r.Data }
func (r RawBlock) Name() string { return r.blockName }
func (r RawBlock) Type() string { return r.blockType }
func (r *RawBlock) UnmarshalSII(blockName, blockType string, in []byte) error {
r.Data = in
return nil
}
type Unit struct {
Entries []Block
}