Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfish-shogi committed Nov 15, 2020
1 parent 80cf054 commit 88b74b8
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 98 deletions.
32 changes: 16 additions & 16 deletions box.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,62 @@ const LengthUnlimited = math.MaxUint32

type ICustomFieldObject interface {
// GetFieldSize returns size of dynamic field
GetFieldSize(name string, bss *BoxStructureStatus) uint
GetFieldSize(name string, bss BoxStructureStatus) uint

// GetFieldLength returns length of dynamic field
GetFieldLength(name string, bss *BoxStructureStatus) uint
GetFieldLength(name string, bss BoxStructureStatus) uint

// IsOptFieldEnabled check whether if the optional field is enabled
IsOptFieldEnabled(name string, bss *BoxStructureStatus) bool
IsOptFieldEnabled(name string, bss BoxStructureStatus) bool

// StringifyField returns field value as string
StringifyField(name string, indent string, depth int, bss *BoxStructureStatus) (string, bool)
StringifyField(name string, indent string, depth int, bss BoxStructureStatus) (string, bool)

IsPString(name string, bytes []byte, remainingSize uint64, bss *BoxStructureStatus) bool
IsPString(name string, bytes []byte, remainingSize uint64, bss BoxStructureStatus) bool

BeforeUnmarshal(r io.ReadSeeker, size uint64, bss *BoxStructureStatus) (n uint64, override bool, err error)
BeforeUnmarshal(r io.ReadSeeker, size uint64, bss BoxStructureStatus) (n uint64, override bool, err error)

OnReadField(name string, r bitio.ReadSeeker, leftBits uint64, bss *BoxStructureStatus) (rbits uint64, override bool, err error)
OnReadField(name string, r bitio.ReadSeeker, leftBits uint64, bss BoxStructureStatus) (rbits uint64, override bool, err error)

OnWriteField(name string, w bitio.Writer, bss *BoxStructureStatus) (wbits uint64, override bool, err error)
OnWriteField(name string, w bitio.Writer, bss BoxStructureStatus) (wbits uint64, override bool, err error)
}

type BaseCustomFieldObject struct {
}

// GetFieldSize returns size of dynamic field
func (box *BaseCustomFieldObject) GetFieldSize(string, *BoxStructureStatus) uint {
func (box *BaseCustomFieldObject) GetFieldSize(string, BoxStructureStatus) uint {
panic(errors.New("GetFieldSize not implemented"))
}

// GetFieldLength returns length of dynamic field
func (box *BaseCustomFieldObject) GetFieldLength(string, *BoxStructureStatus) uint {
func (box *BaseCustomFieldObject) GetFieldLength(string, BoxStructureStatus) uint {
panic(errors.New("GetFieldLength not implemented"))
}

// IsOptFieldEnabled check whether if the optional field is enabled
func (box *BaseCustomFieldObject) IsOptFieldEnabled(string, *BoxStructureStatus) bool {
func (box *BaseCustomFieldObject) IsOptFieldEnabled(string, BoxStructureStatus) bool {
return false
}

// StringifyField returns field value as string
func (box *BaseCustomFieldObject) StringifyField(string, string, int, *BoxStructureStatus) (string, bool) {
func (box *BaseCustomFieldObject) StringifyField(string, string, int, BoxStructureStatus) (string, bool) {
return "", false
}

func (*BaseCustomFieldObject) IsPString(name string, bytes []byte, remainingSize uint64, bss *BoxStructureStatus) bool {
func (*BaseCustomFieldObject) IsPString(name string, bytes []byte, remainingSize uint64, bss BoxStructureStatus) bool {
return true
}

func (*BaseCustomFieldObject) BeforeUnmarshal(io.ReadSeeker, uint64, *BoxStructureStatus) (uint64, bool, error) {
func (*BaseCustomFieldObject) BeforeUnmarshal(io.ReadSeeker, uint64, BoxStructureStatus) (uint64, bool, error) {
return 0, false, nil
}

func (*BaseCustomFieldObject) OnReadField(string, bitio.ReadSeeker, uint64, *BoxStructureStatus) (uint64, bool, error) {
func (*BaseCustomFieldObject) OnReadField(string, bitio.ReadSeeker, uint64, BoxStructureStatus) (uint64, bool, error) {
return 0, false, nil
}

func (*BaseCustomFieldObject) OnWriteField(string, bitio.Writer, *BoxStructureStatus) (uint64, bool, error) {
func (*BaseCustomFieldObject) OnWriteField(string, bitio.Writer, BoxStructureStatus) (uint64, bool, error) {
return 0, false, nil
}

Expand Down
Loading

0 comments on commit 88b74b8

Please sign in to comment.