nx

package
v0.0.0-...-69b9f38 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	PKG4 = "PKG4"
)

Variables

View Source
var (
	ErrNodeIndex   = errors.New("the node index provided does not exist / it exceeds the total number of nodes")
	ErrNodeParsed  = errors.New("this node has already been parsed")
	ErrNodeFile    = errors.New("this node has not been initialised properly with NewNode")
	ErrNodeNoChild = errors.New("this node does not have any children or it is not yet parsed")
)
View Source
var (
	ErrFileInvalid = errors.New("this file is not an NX (PKG4) file or it has not been initialised properly with NewFile")
)
View Source
var (
	ErrStringIndex = errors.New("the string index provided exceeds the total number of string entries")
)

Functions

This section is empty.

Types

type AudioNode

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

type BitmapNode

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

type Children

type Children struct {
	Indexes map[string]uint
	Nodes   []*Node
	Total   uint
}

func (*Children) Get

func (c *Children) Get(n string) (*Node, error)

func (*Children) GetByID

func (c *Children) GetByID(i uint) (*Node, error)

type DataNode

type DataNode interface {
	Value() interface{}
}

type EmptyNode

type EmptyNode struct {
}

type File

type File struct {
	Fn string
	// contains filtered or unexported fields
}

func NewFile

func NewFile(fn string, p bool) (*File, error)
Example
nxf, _ := NewFile(TestFile, false)
fmt.Printf("File name: '%s'", nxf.Fn)
Output:
File name: '../data/Base.nx'

func (*File) GetString

func (nxf *File) GetString(i uint) (string, error)
Example
nxf, _ := NewFile(TestFile, true)
s, _ := nxf.GetString(6)
fmt.Printf("String entry #6: %s", s)
Output:
String entry #6: Map

func (*File) Header

func (nxf *File) Header() (Header, error)
Example
nxf, _ := NewFile(TestFile, false)
nxh, _ := nxf.Header()
fmt.Printf("Magic / version: %s", nxh.Magic)
Output:
Magic / version: PKG4

func (*File) Parse

func (nxf *File) Parse() error

func (*File) Root

func (nxf *File) Root() (*Node, error)
Example
nxf, _ := NewFile(TestFile, true)
root, _ := nxf.Root()
fmt.Printf("Total children: %v", root.Count)
Output:
Total children: 18

type FloatNode

type FloatNode struct {
	// contains filtered or unexported fields
}
type Header struct {
	Magic     string
	NodeCount uint32

	StringCount uint32

	BitmapCount uint32

	AudioCount uint32
	// contains filtered or unexported fields
}

type LongNode

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

type Node

type Node struct {
	ID      uint
	Name    string
	ChildID uint32
	Count   uint16
	Type    uint16
	Data    interface{}
	// contains filtered or unexported fields
}

func NewNode

func NewNode(nxf *File, i uint) (*Node, error)

func (*Node) Children

func (nd *Node) Children() (*Children, error)

func (*Node) Get

func (nd *Node) Get(n string) (*Node, error)

func (*Node) GetByID

func (nd *Node) GetByID(i uint) (*Node, error)

func (*Node) GetData

func (nd *Node) GetData(offset uint64) interface{}

func (*Node) Parse

func (nd *Node) Parse() error
Example
nxf, _ := NewFile(TestFile, true)
nd, _ := NewNode(nxf, 12)
_ = nd.Parse()
fmt.Printf("Node name: %s", nd.Name)
Output:
Node name: Sound

type StringNode

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

type VectorNode

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

Jump to

Keyboard shortcuts

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