kmparser

package
v1.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	Tags    []Tag
	Structs []Struct
	Enums   []Enum
	Size    ContentSize
	Options ContentOptions
	Module  string
}

func (*Content) Read

func (x *Content) Read(viewer *ContentViewer, reader *karmem.Reader)

func (*Content) ReadAsRoot

func (x *Content) ReadAsRoot(reader *karmem.Reader)

func (*Content) Reset

func (x *Content) Reset()

func (*Content) Write

func (x *Content) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*Content) WriteAsRoot

func (x *Content) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type ContentOptions

type ContentOptions struct {
	Module string
	Import string
	Prefix string
}

func (*ContentOptions) Read

func (x *ContentOptions) Read(viewer *ContentOptionsViewer, reader *karmem.Reader)

func (*ContentOptions) ReadAsRoot

func (x *ContentOptions) ReadAsRoot(reader *karmem.Reader)

func (*ContentOptions) Reset

func (x *ContentOptions) Reset()

func (*ContentOptions) Write

func (x *ContentOptions) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*ContentOptions) WriteAsRoot

func (x *ContentOptions) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type ContentOptionsViewer

type ContentOptionsViewer struct {
	// contains filtered or unexported fields
}

func NewContentOptionsViewer

func NewContentOptionsViewer(reader *karmem.Reader, offset uint32) (v *ContentOptionsViewer)

func (*ContentOptionsViewer) Import

func (x *ContentOptionsViewer) Import(reader *karmem.Reader) (v []byte)

func (*ContentOptionsViewer) Module

func (x *ContentOptionsViewer) Module(reader *karmem.Reader) (v []byte)

func (*ContentOptionsViewer) Prefix

func (x *ContentOptionsViewer) Prefix(reader *karmem.Reader) (v []byte)

type ContentSize

type ContentSize struct {
	Largest uint32
}

func (*ContentSize) Read

func (x *ContentSize) Read(viewer *ContentSizeViewer, reader *karmem.Reader)

func (*ContentSize) ReadAsRoot

func (x *ContentSize) ReadAsRoot(reader *karmem.Reader)

func (*ContentSize) Reset

func (x *ContentSize) Reset()

func (*ContentSize) Write

func (x *ContentSize) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*ContentSize) WriteAsRoot

func (x *ContentSize) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type ContentSizeViewer

type ContentSizeViewer struct {
	// contains filtered or unexported fields
}

func NewContentSizeViewer

func NewContentSizeViewer(reader *karmem.Reader, offset uint32) (v *ContentSizeViewer)

func (*ContentSizeViewer) Largest

func (x *ContentSizeViewer) Largest() (v uint32)

type ContentViewer

type ContentViewer struct {
	// contains filtered or unexported fields
}

func NewContentViewer

func NewContentViewer(reader *karmem.Reader, offset uint32) (v *ContentViewer)

func (*ContentViewer) Enums

func (x *ContentViewer) Enums(reader *karmem.Reader) (v []EnumViewer)

func (*ContentViewer) Module

func (x *ContentViewer) Module(reader *karmem.Reader) (v []byte)

func (*ContentViewer) Options

func (x *ContentViewer) Options(reader *karmem.Reader) (v *ContentOptionsViewer)

func (*ContentViewer) Size

func (x *ContentViewer) Size(reader *karmem.Reader) (v *ContentSizeViewer)

func (*ContentViewer) Structs

func (x *ContentViewer) Structs(reader *karmem.Reader) (v []StructViewer)

func (*ContentViewer) Tags

func (x *ContentViewer) Tags(reader *karmem.Reader) (v []TagViewer)

type Enum

type Enum struct {
	Data EnumData
}

func (*Enum) Read

func (x *Enum) Read(viewer *EnumViewer, reader *karmem.Reader)

func (*Enum) ReadAsRoot

func (x *Enum) ReadAsRoot(reader *karmem.Reader)

func (*Enum) Reset

func (x *Enum) Reset()

func (*Enum) Write

func (x *Enum) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*Enum) WriteAsRoot

func (x *Enum) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type EnumData

type EnumData struct {
	Name   string
	Type   Type
	Fields []EnumField
}

func (*EnumData) Read

func (x *EnumData) Read(viewer *EnumDataViewer, reader *karmem.Reader)

func (*EnumData) ReadAsRoot

func (x *EnumData) ReadAsRoot(reader *karmem.Reader)

func (*EnumData) Reset

func (x *EnumData) Reset()

func (*EnumData) Write

func (x *EnumData) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*EnumData) WriteAsRoot

func (x *EnumData) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type EnumDataViewer

type EnumDataViewer struct {
	// contains filtered or unexported fields
}

func NewEnumDataViewer

func NewEnumDataViewer(reader *karmem.Reader, offset uint32) (v *EnumDataViewer)

func (*EnumDataViewer) Fields

func (x *EnumDataViewer) Fields(reader *karmem.Reader) (v []EnumFieldViewer)

func (*EnumDataViewer) Name

func (x *EnumDataViewer) Name(reader *karmem.Reader) (v []byte)

func (*EnumDataViewer) Type

func (x *EnumDataViewer) Type(reader *karmem.Reader) (v *TypeViewer)

type EnumField

type EnumField struct {
	Data EnumFieldData
}

func (*EnumField) Read

func (x *EnumField) Read(viewer *EnumFieldViewer, reader *karmem.Reader)

func (*EnumField) ReadAsRoot

func (x *EnumField) ReadAsRoot(reader *karmem.Reader)

func (*EnumField) Reset

func (x *EnumField) Reset()

func (*EnumField) Write

func (x *EnumField) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*EnumField) WriteAsRoot

func (x *EnumField) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type EnumFieldData

type EnumFieldData struct {
	Name  string
	Value string
	Tags  []Tag
}

func (*EnumFieldData) Read

func (x *EnumFieldData) Read(viewer *EnumFieldDataViewer, reader *karmem.Reader)

func (*EnumFieldData) ReadAsRoot

func (x *EnumFieldData) ReadAsRoot(reader *karmem.Reader)

func (*EnumFieldData) Reset

func (x *EnumFieldData) Reset()

func (*EnumFieldData) Write

func (x *EnumFieldData) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*EnumFieldData) WriteAsRoot

func (x *EnumFieldData) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type EnumFieldDataViewer

type EnumFieldDataViewer struct {
	// contains filtered or unexported fields
}

func NewEnumFieldDataViewer

func NewEnumFieldDataViewer(reader *karmem.Reader, offset uint32) (v *EnumFieldDataViewer)

func (*EnumFieldDataViewer) Name

func (x *EnumFieldDataViewer) Name(reader *karmem.Reader) (v []byte)

func (*EnumFieldDataViewer) Tags

func (x *EnumFieldDataViewer) Tags(reader *karmem.Reader) (v []TagViewer)

func (*EnumFieldDataViewer) Value

func (x *EnumFieldDataViewer) Value(reader *karmem.Reader) (v []byte)

type EnumFieldViewer

type EnumFieldViewer struct {
	// contains filtered or unexported fields
}

func NewEnumFieldViewer

func NewEnumFieldViewer(reader *karmem.Reader, offset uint32) (v *EnumFieldViewer)

func (*EnumFieldViewer) Data

func (x *EnumFieldViewer) Data(reader *karmem.Reader) (v *EnumFieldDataViewer)

type EnumViewer

type EnumViewer struct {
	// contains filtered or unexported fields
}

func NewEnumViewer

func NewEnumViewer(reader *karmem.Reader, offset uint32) (v *EnumViewer)

func (*EnumViewer) Data

func (x *EnumViewer) Data(reader *karmem.Reader) (v *EnumDataViewer)

type Reader

type Reader struct {
	Parsed Content
	// contains filtered or unexported fields
}

Reader reads and decodes Karmem files.

func NewReader

func NewReader(path string, r io.Reader) *Reader

NewReader accepts any karmem file as io.Reader. In order to give errors, the path is used.

func (*Reader) Parser

func (r *Reader) Parser() (d *Content, err error)

Parser will try to parse the given karmem file.

type Struct

type Struct struct {
	Data StructData
}

func (*Struct) Read

func (x *Struct) Read(viewer *StructViewer, reader *karmem.Reader)

func (*Struct) ReadAsRoot

func (x *Struct) ReadAsRoot(reader *karmem.Reader)

func (*Struct) Reset

func (x *Struct) Reset()

func (*Struct) Write

func (x *Struct) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*Struct) WriteAsRoot

func (x *Struct) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type StructClass

type StructClass uint8
const (
	StructClassNone   StructClass = 0
	StructClassTable  StructClass = 1
	StructClassInline StructClass = 2
)

type StructData

type StructData struct {
	ID     uint64
	Name   string
	Size   StructSize
	Fields []StructField
	Class  StructClass
}

func (StructData) IsTable

func (x StructData) IsTable() bool

func (*StructData) Read

func (x *StructData) Read(viewer *StructDataViewer, reader *karmem.Reader)

func (*StructData) ReadAsRoot

func (x *StructData) ReadAsRoot(reader *karmem.Reader)

func (*StructData) Reset

func (x *StructData) Reset()

func (*StructData) Write

func (x *StructData) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*StructData) WriteAsRoot

func (x *StructData) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type StructDataViewer

type StructDataViewer struct {
	// contains filtered or unexported fields
}

func NewStructDataViewer

func NewStructDataViewer(reader *karmem.Reader, offset uint32) (v *StructDataViewer)

func (*StructDataViewer) Class

func (x *StructDataViewer) Class() (v StructClass)

func (*StructDataViewer) Fields

func (x *StructDataViewer) Fields(reader *karmem.Reader) (v []StructFieldViewer)

func (*StructDataViewer) ID

func (x *StructDataViewer) ID() (v uint64)

func (*StructDataViewer) Name

func (x *StructDataViewer) Name(reader *karmem.Reader) (v []byte)

func (*StructDataViewer) Size

func (x *StructDataViewer) Size(reader *karmem.Reader) (v *StructSizeViewer)

type StructField

type StructField struct {
	Data StructFieldData
}

func (*StructField) Read

func (x *StructField) Read(viewer *StructFieldViewer, reader *karmem.Reader)

func (*StructField) ReadAsRoot

func (x *StructField) ReadAsRoot(reader *karmem.Reader)

func (*StructField) Reset

func (x *StructField) Reset()

func (*StructField) Write

func (x *StructField) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*StructField) WriteAsRoot

func (x *StructField) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type StructFieldData

type StructFieldData struct {
	Name   string
	Type   Type
	Offset uint32
	Tags   []Tag
	Size   StructFieldSize
}

func (*StructFieldData) Read

func (x *StructFieldData) Read(viewer *StructFieldDataViewer, reader *karmem.Reader)

func (*StructFieldData) ReadAsRoot

func (x *StructFieldData) ReadAsRoot(reader *karmem.Reader)

func (*StructFieldData) Reset

func (x *StructFieldData) Reset()

func (*StructFieldData) Write

func (x *StructFieldData) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*StructFieldData) WriteAsRoot

func (x *StructFieldData) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type StructFieldDataViewer

type StructFieldDataViewer struct {
	// contains filtered or unexported fields
}

func NewStructFieldDataViewer

func NewStructFieldDataViewer(reader *karmem.Reader, offset uint32) (v *StructFieldDataViewer)

func (*StructFieldDataViewer) Name

func (x *StructFieldDataViewer) Name(reader *karmem.Reader) (v []byte)

func (*StructFieldDataViewer) Offset

func (x *StructFieldDataViewer) Offset() (v uint32)

func (*StructFieldDataViewer) Size

func (*StructFieldDataViewer) Tags

func (x *StructFieldDataViewer) Tags(reader *karmem.Reader) (v []TagViewer)

func (*StructFieldDataViewer) Type

func (x *StructFieldDataViewer) Type(reader *karmem.Reader) (v *TypeViewer)

type StructFieldSize

type StructFieldSize struct {
	Minimum    uint32
	Allocation uint32
	Field      uint32
}

func (*StructFieldSize) Read

func (x *StructFieldSize) Read(viewer *StructFieldSizeViewer, reader *karmem.Reader)

func (*StructFieldSize) ReadAsRoot

func (x *StructFieldSize) ReadAsRoot(reader *karmem.Reader)

func (*StructFieldSize) Reset

func (x *StructFieldSize) Reset()

func (*StructFieldSize) Write

func (x *StructFieldSize) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*StructFieldSize) WriteAsRoot

func (x *StructFieldSize) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type StructFieldSizeViewer

type StructFieldSizeViewer struct {
	// contains filtered or unexported fields
}

func NewStructFieldSizeViewer

func NewStructFieldSizeViewer(reader *karmem.Reader, offset uint32) (v *StructFieldSizeViewer)

func (*StructFieldSizeViewer) Allocation

func (x *StructFieldSizeViewer) Allocation() (v uint32)

func (*StructFieldSizeViewer) Field

func (x *StructFieldSizeViewer) Field() (v uint32)

func (*StructFieldSizeViewer) Minimum

func (x *StructFieldSizeViewer) Minimum() (v uint32)

type StructFieldViewer

type StructFieldViewer struct {
	// contains filtered or unexported fields
}

func NewStructFieldViewer

func NewStructFieldViewer(reader *karmem.Reader, offset uint32) (v *StructFieldViewer)

func (*StructFieldViewer) Data

func (x *StructFieldViewer) Data(reader *karmem.Reader) (v *StructFieldDataViewer)

type StructSize

type StructSize struct {
	Minimum    uint32
	Content    uint32
	Padding    uint32
	Total      uint32
	TotalGroup []uint8
}

func (*StructSize) Read

func (x *StructSize) Read(viewer *StructSizeViewer, reader *karmem.Reader)

func (*StructSize) ReadAsRoot

func (x *StructSize) ReadAsRoot(reader *karmem.Reader)

func (*StructSize) Reset

func (x *StructSize) Reset()

func (*StructSize) Write

func (x *StructSize) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*StructSize) WriteAsRoot

func (x *StructSize) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type StructSizeViewer

type StructSizeViewer struct {
	// contains filtered or unexported fields
}

func NewStructSizeViewer

func NewStructSizeViewer(reader *karmem.Reader, offset uint32) (v *StructSizeViewer)

func (*StructSizeViewer) Content

func (x *StructSizeViewer) Content() (v uint32)

func (*StructSizeViewer) Minimum

func (x *StructSizeViewer) Minimum() (v uint32)

func (*StructSizeViewer) Padding

func (x *StructSizeViewer) Padding() (v uint32)

func (*StructSizeViewer) Total

func (x *StructSizeViewer) Total() (v uint32)

func (*StructSizeViewer) TotalGroup

func (x *StructSizeViewer) TotalGroup(reader *karmem.Reader) (v []uint8)

type StructViewer

type StructViewer struct {
	// contains filtered or unexported fields
}

func NewStructViewer

func NewStructViewer(reader *karmem.Reader, offset uint32) (v *StructViewer)

func (*StructViewer) Data

func (x *StructViewer) Data(reader *karmem.Reader) (v *StructDataViewer)

type Tag

type Tag struct {
	Name  string
	Value string
}

func (*Tag) Read

func (x *Tag) Read(viewer *TagViewer, reader *karmem.Reader)

func (*Tag) ReadAsRoot

func (x *Tag) ReadAsRoot(reader *karmem.Reader)

func (*Tag) Reset

func (x *Tag) Reset()

func (*Tag) Write

func (x *Tag) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*Tag) WriteAsRoot

func (x *Tag) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type TagViewer

type TagViewer struct {
	// contains filtered or unexported fields
}

func NewTagViewer

func NewTagViewer(reader *karmem.Reader, offset uint32) (v *TagViewer)

func (*TagViewer) Name

func (x *TagViewer) Name(reader *karmem.Reader) (v []byte)

func (*TagViewer) Value

func (x *TagViewer) Value(reader *karmem.Reader) (v []byte)

type Tags

type Tags []Tag

func (Tags) Get

func (x Tags) Get(s string) (string, bool)

type Type

type Type struct {
	Schema      string
	PlainSchema string
	Length      uint32
	Format      TypeFormat
	Model       TypeModel
}

func (*Type) IsArray

func (x *Type) IsArray() bool

func (*Type) IsBasic

func (x *Type) IsBasic() bool

func (*Type) IsBool

func (x *Type) IsBool() bool

func (*Type) IsEnum

func (x *Type) IsEnum() bool

func (*Type) IsInline

func (x *Type) IsInline() bool

func (*Type) IsInteger

func (x *Type) IsInteger() bool

func (*Type) IsLimited

func (x *Type) IsLimited() bool

func (*Type) IsNative

func (x *Type) IsNative() bool

func (*Type) IsSlice

func (x *Type) IsSlice() bool

func (*Type) IsString

func (x *Type) IsString() bool

func (*Type) Read

func (x *Type) Read(viewer *TypeViewer, reader *karmem.Reader)

func (*Type) ReadAsRoot

func (x *Type) ReadAsRoot(reader *karmem.Reader)

func (*Type) Reset

func (x *Type) Reset()

func (*Type) Write

func (x *Type) Write(writer *karmem.Writer, start uint) (offset uint, err error)

func (*Type) WriteAsRoot

func (x *Type) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)

type TypeFormat

type TypeFormat uint8
const (
	TypeFormatNone      TypeFormat = 0
	TypeFormatPrimitive TypeFormat = 1
	TypeFormatEnum      TypeFormat = 2
	TypeFormatStruct    TypeFormat = 3
	TypeFormatTable     TypeFormat = 4
)

type TypeModel

type TypeModel uint8
const (
	TypeModelNone         TypeModel = 0
	TypeModelSingle       TypeModel = 1
	TypeModelArray        TypeModel = 2
	TypeModelSlice        TypeModel = 3
	TypeModelSliceLimited TypeModel = 4
)

type TypeViewer

type TypeViewer struct {
	// contains filtered or unexported fields
}

func NewTypeViewer

func NewTypeViewer(reader *karmem.Reader, offset uint32) (v *TypeViewer)

func (*TypeViewer) Format

func (x *TypeViewer) Format() (v TypeFormat)

func (*TypeViewer) Length

func (x *TypeViewer) Length() (v uint32)

func (*TypeViewer) Model

func (x *TypeViewer) Model() (v TypeModel)

func (*TypeViewer) PlainSchema

func (x *TypeViewer) PlainSchema(reader *karmem.Reader) (v []byte)

func (*TypeViewer) Schema

func (x *TypeViewer) Schema(reader *karmem.Reader) (v []byte)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL