1
0
Fork 0
mirror of https://github.com/Luzifer/sii.git synced 2024-10-18 13:24:20 +00:00
sii/unit.go

39 lines
680 B
Go
Raw Normal View History

2019-11-05 15:47:30 +00:00
package sii
type Block interface {
Class() string
Init(class, name string)
2019-11-05 15:47:30 +00:00
Name() string
}
type Marshaler interface {
MarshalSII() ([]byte, error)
}
type Unmarshaler interface {
UnmarshalSII([]byte) error
}
type RawBlock struct {
Data []byte
blockName string
blockClass string
2019-11-05 15:47:30 +00:00
}
func (r *RawBlock) Init(class, name string) {
r.blockClass = class
r.blockName = name
}
2019-11-05 15:47:30 +00:00
func (r RawBlock) MarshalSII() []byte { return r.Data }
func (r RawBlock) Name() string { return r.blockName }
func (r RawBlock) Class() string { return r.blockClass }
func (r *RawBlock) UnmarshalSII(in []byte) error {
2019-11-05 15:47:30 +00:00
r.Data = in
return nil
}
type Unit struct {
Entries []Block
}