Documentation ¶
Index ¶
- func Always(inst *Instance) bool
- func Never(inst *Instance) bool
- type BitfieldHandler
- type Description
- func (desc *Description) As(fieldRange FieldRange) *Description
- func (desc *Description) For(data []byte) *Instance
- func (desc *Description) Refining(key string, byteStart int, byteCount int, refined *Description, ...) *Description
- func (desc *Description) With(key string, byteStart int, byteCount int) *Description
- type EnumValueHandler
- type FieldRange
- func Bitfield(values map[uint32]string) FieldRange
- func EnumValue(values map[uint32]string) FieldRange
- func FormattedRangedValue(minValue, maxValue int64, formatter RawValueFormatter) FieldRange
- func ObjectID() FieldRange
- func RangedValue(minValue, maxValue int64) FieldRange
- func SpecialValue(specialType string) FieldRange
- type Instance
- func (inst *Instance) ActiveRefinements() (keys []string)
- func (inst *Instance) Describe(key string, simplifier *Simplifier)
- func (inst *Instance) Get(key string) uint32
- func (inst *Instance) Keys() []string
- func (inst *Instance) Raw() []byte
- func (inst *Instance) Refined(key string) (refined *Instance)
- func (inst *Instance) Set(key string, value uint32)
- func (inst *Instance) Undefined() []byte
- type ObjectIDHandler
- type Predicate
- type RawValueFormatter
- type RawValueHandler
- type Simplifier
- type SpecialHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BitfieldHandler ¶
BitfieldHandler is for bitfields.
type Description ¶
type Description struct {
// contains filtered or unexported fields
}
Description is the meta information about a data interpreter. A description is an immutable object that provides new descriptions with any modification.
func (*Description) As ¶
func (desc *Description) As(fieldRange FieldRange) *Description
As sets the value range for the previously added field.
func (*Description) For ¶
func (desc *Description) For(data []byte) *Instance
For returns an instance of an interpreter with the given data slice as backing buffer.
func (*Description) Refining ¶
func (desc *Description) Refining(key string, byteStart int, byteCount int, refined *Description, predicate Predicate) *Description
Refining adds another description within the given one. The provided predicate determines whether the refined description is active.
func (*Description) With ¶
func (desc *Description) With(key string, byteStart int, byteCount int) *Description
With extends the given description with a new field. The returned description is a new, separated object from the originating one.
type EnumValueHandler ¶
EnumValueHandler is for enumerated (mapped) values.
type FieldRange ¶
type FieldRange func(*Simplifier) bool
FieldRange is a function specializing the range of a field to a simplifier.
func Bitfield ¶
func Bitfield(values map[uint32]string) FieldRange
Bitfield creates a field range describing bitfield values.
func EnumValue ¶
func EnumValue(values map[uint32]string) FieldRange
EnumValue creates a field range describing enumerated values.
func FormattedRangedValue ¶
func FormattedRangedValue(minValue, maxValue int64, formatter RawValueFormatter) FieldRange
FormattedRangedValue is similar to RangedValue, and adds a formatting function.
func ObjectID ¶
func ObjectID() FieldRange
ObjectID creates a field range describing object identifier.
func RangedValue ¶
func RangedValue(minValue, maxValue int64) FieldRange
RangedValue creates a field range for specific minimum and maximum values.
func SpecialValue ¶
func SpecialValue(specialType string) FieldRange
SpecialValue creates a field range for special fields. Currently known special values: * BinaryCodedDecimal - for keypads storing their number as BCD * LevelTexture - index value into level texture list * MaterialOrLevelTexture - index value into level texture list, or material (bit 7 toggles) * VariableKey - for actions * VariableCondition - for action conditions * ObjectTriple - for 0x00CCSSTT selection * ObjectHeight - for level height value 0..255 * MoveTileHeight - for change tile height action * TileHeight - tile heights * TileType - tile types * Unknown - It is unclear whether this field would have any effect, none identified so far * Ignored - Although values have been found in this field, they don't appear to have any effect * Mistake - It is assumed that these values should have been placed somewhere else. Typical example: Container content
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is one instantiated interpreter for a data block, based on a predetermined description.
func (*Instance) ActiveRefinements ¶
ActiveRefinements returns an array of all keys where the corresponding refinement is active (The corresponding predicate returns true).
func (*Instance) Describe ¶
func (inst *Instance) Describe(key string, simplifier *Simplifier)
Describe returns the description of a value key.
func (*Instance) Get ¶
Get returns the value associated with the given key. Should there be no value for the requested key, the function returns 0.
func (*Instance) Refined ¶
Refined returns an instance that was nested according to the description. This method returns an instance for registered refinements even if their predicate would not specify them being active. Should the refinement not exist, an instance without any fields will be returned.
type ObjectIDHandler ¶
type ObjectIDHandler func()
ObjectIDHandler is for object identifier in a level.
type Predicate ¶
Predicate is a function that specifies whether a certain description is active within another.
type RawValueFormatter ¶
RawValueFormatter provides the format function for given value. If nothing special is to be displayed, an empty string should be returned. The handler is responsible for adding the number value representation.
type RawValueHandler ¶
type RawValueHandler func(minValue, maxValue int64, formatter RawValueFormatter)
RawValueHandler is for a simple value range.
type Simplifier ¶
type Simplifier struct {
// contains filtered or unexported fields
}
Simplifier forwards descriptions in a way the requester can use.
func NewSimplifier ¶
func NewSimplifier(rawValueHandler RawValueHandler) *Simplifier
NewSimplifier returns a new instance of a simplifier, with the minimal handler set.
func (*Simplifier) SetBitfieldHandler ¶
func (simpl *Simplifier) SetBitfieldHandler(handler BitfieldHandler)
SetBitfieldHandler registers the handler for bitfields.
func (*Simplifier) SetEnumValueHandler ¶
func (simpl *Simplifier) SetEnumValueHandler(handler EnumValueHandler)
SetEnumValueHandler registers the handler for enumerations.
func (*Simplifier) SetObjectIDHandler ¶
func (simpl *Simplifier) SetObjectIDHandler(handler ObjectIDHandler)
SetObjectIDHandler registers the handler for object indices.
func (*Simplifier) SetSpecialHandler ¶
func (simpl *Simplifier) SetSpecialHandler(specialType string, handler SpecialHandler)
SetSpecialHandler registers the handler for special values.