meta/interface.go

102 lines
2.1 KiB
Go
Raw Permalink Normal View History

2022-10-01 21:09:54 +03:00
package meta
type Reader interface {
ReadInt8(v *int8, field string) error
ReadInt16(v *int16, field string) error
ReadInt32(v *int32, field string) error
ReadInt64(v *int64, field string) error
ReadUint8(v *uint8, field string) error
ReadUint16(v *uint16, field string) error
ReadUint32(v *uint32, field string) error
ReadUint64(v *uint64, field string) error
2022-10-01 21:09:54 +03:00
ReadBool(v *bool, field string) error
ReadFloat32(v *float32, field string) error
ReadFloat64(v *float64, field string) error
2022-10-01 21:09:54 +03:00
ReadString(v *string, field string) error
ReadBytes(v *[]byte, field string) error
2022-10-01 21:09:54 +03:00
BeginContainer(field string) error
EndContainer() error
2023-09-11 16:51:34 +03:00
BeginCollection(field string) error
EndCollection() error
ContainerSize() (int, error)
IsContainerAssoc() (bool, error)
2022-10-01 21:09:54 +03:00
Skip() error
TryReadMask() (bool, FieldsMask, error)
}
type Writer interface {
WriteInt8(v int8, field string) error
WriteInt16(v int16, field string) error
WriteInt32(v int32, field string) error
WriteInt64(v int64, field string) error
WriteUint8(v uint8, field string) error
WriteUint16(v uint16, field string) error
WriteUint32(v uint32, field string) error
WriteUint64(v uint64, field string) error
2022-10-01 21:09:54 +03:00
WriteBool(v bool, field string) error
WriteFloat32(v float32, field string) error
WriteFloat64(v float64, field string) error
2022-10-01 21:09:54 +03:00
WriteString(v string, field string) error
WriteBytes(v []byte, field string) error
2023-07-03 22:09:39 +03:00
BeginCollection(length int, field string) error
EndCollection() error
BeginContainer(length int, field string) error
2022-10-01 21:09:54 +03:00
EndContainer() error
}
type Class interface {
ClassId() uint32
ClassName() string
2022-10-01 21:09:54 +03:00
}
type Readable interface {
2022-10-01 21:09:54 +03:00
Reset()
Read(Reader) error
ReadFields(Reader) error
2022-10-01 21:09:54 +03:00
}
type Writable interface {
Write(Writer) error
WriteFields(Writer) error
FieldsCount() int
2022-10-01 21:09:54 +03:00
}
type Struct interface {
Class
Readable
Writable
2022-10-01 21:09:54 +03:00
}
type StructFactory func(classId uint32) (Readable, error)
2023-09-01 01:37:06 +03:00
type Bitmasked interface {
FieldChanged(index uint64) bool
2022-10-01 21:09:54 +03:00
SetFieldChanged(index uint64)
HasChangedFields() bool
FieldsMask() FieldsMask
2022-10-01 21:09:54 +03:00
}
type WritableClass interface {
Class
Writable
}
2023-09-11 20:09:11 +03:00
type ReadableWritable interface {
Readable
Writable
}