2022-10-01 21:09:54 +03:00
|
|
|
package meta
|
|
|
|
|
|
|
|
type Reader interface {
|
2023-06-06 15:14:33 +03:00
|
|
|
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
|
2023-06-06 15:14:33 +03:00
|
|
|
|
|
|
|
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
|
2023-06-06 15:14:33 +03:00
|
|
|
ReadBytes(v *[]byte, field string) error
|
|
|
|
|
2022-10-01 21:09:54 +03:00
|
|
|
BeginContainer(field string) error
|
|
|
|
EndContainer() error
|
2023-06-06 15:14:33 +03:00
|
|
|
|
2023-09-11 16:51:34 +03:00
|
|
|
BeginCollection(field string) error
|
|
|
|
EndCollection() error
|
|
|
|
|
2023-06-06 15:14:33 +03:00
|
|
|
ContainerSize() (int, error)
|
|
|
|
IsContainerAssoc() (bool, error)
|
|
|
|
|
2022-10-01 21:09:54 +03:00
|
|
|
Skip() error
|
|
|
|
TryReadMask() (bool, FieldsMask, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Writer interface {
|
2023-06-06 15:14:33 +03:00
|
|
|
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
|
2023-06-06 15:14:33 +03:00
|
|
|
|
|
|
|
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
|
2023-06-06 15:14:33 +03:00
|
|
|
WriteBytes(v []byte, field string) error
|
|
|
|
|
2023-07-03 22:09:39 +03:00
|
|
|
BeginCollection(length int, field string) error
|
|
|
|
EndCollection() error
|
|
|
|
|
2023-06-06 15:14:33 +03:00
|
|
|
BeginContainer(length int, field string) error
|
2022-10-01 21:09:54 +03:00
|
|
|
EndContainer() error
|
|
|
|
}
|
|
|
|
|
2023-06-06 15:14:33 +03:00
|
|
|
type Class interface {
|
|
|
|
ClassId() uint32
|
|
|
|
ClassName() string
|
2022-10-01 21:09:54 +03:00
|
|
|
}
|
|
|
|
|
2023-06-06 15:14:33 +03:00
|
|
|
type Readable interface {
|
2022-10-01 21:09:54 +03:00
|
|
|
Reset()
|
2023-06-06 15:14:33 +03:00
|
|
|
Read(Reader) error
|
|
|
|
ReadFields(Reader) error
|
2022-10-01 21:09:54 +03:00
|
|
|
}
|
|
|
|
|
2023-06-06 15:14:33 +03:00
|
|
|
type Writable interface {
|
|
|
|
Write(Writer) error
|
|
|
|
WriteFields(Writer) error
|
2023-09-01 15:23:18 +03:00
|
|
|
FieldsCount() int
|
2022-10-01 21:09:54 +03:00
|
|
|
}
|
|
|
|
|
2023-06-06 15:14:33 +03:00
|
|
|
type Struct interface {
|
|
|
|
Class
|
|
|
|
Readable
|
|
|
|
Writable
|
2022-10-01 21:09:54 +03:00
|
|
|
}
|
|
|
|
|
2023-09-01 15:23:18 +03:00
|
|
|
type StructFactory func(classId uint32) (Readable, error)
|
2023-09-01 01:37:06 +03:00
|
|
|
|
2023-06-06 15:14:33 +03:00
|
|
|
type Bitmasked interface {
|
|
|
|
FieldChanged(index uint64) bool
|
2022-10-01 21:09:54 +03:00
|
|
|
SetFieldChanged(index uint64)
|
2023-06-06 15:14:33 +03:00
|
|
|
HasChangedFields() bool
|
|
|
|
FieldsMask() FieldsMask
|
2022-10-01 21:09:54 +03:00
|
|
|
}
|
2023-09-01 15:23:18 +03:00
|
|
|
|
|
|
|
type WritableClass interface {
|
|
|
|
Class
|
|
|
|
Writable
|
|
|
|
}
|
2023-09-11 20:09:11 +03:00
|
|
|
|
|
|
|
type ReadableWritable interface {
|
|
|
|
Readable
|
|
|
|
Writable
|
|
|
|
}
|