dbc

package
v0.0.0-...-b9d6643 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load[C any](fileName string, baseDir ...string) ([]C, error)

func LoadAll

func LoadAll(dbcDirectoryPath string)

Types

type DataHeader

type DataHeader struct {
	Magic [4]byte // always 'WDBC'
	// records per file
	RecordCount uint32
	// fields per record. The field disze is always 4bytes long (uint32)
	FieldCount uint32
	// RecordSize is the size of a record in bytes
	RecordSize uint32
	// StringBlockSize size of the string block at the end of file in bytes
	StringBlockSize uint32
}

DataHeader is the header of a DBC file with the following fields: Magic: always 'WDBC' RecordCount: records per file FieldCount: fields per record.

type Reader

type Reader[C any] struct {
	Header DataHeader

	Records []C
	// contains filtered or unexported fields
}

func NewReader

func NewReader[C any](r io.Reader) (*Reader[C], error)

NewReader creates a new Reader instance for the given io.Reader to read DBC files.

r: the io.Reader to read DBC files from.
(*Reader[C], error): a pointer to a Reader instance and a possible error that might occur.

func (*Reader[C]) ReadAll

func (dr *Reader[C]) ReadAll() error

ReadAll reads all records from a Reader and stores them in its Records field, as well as parses the strings from the string block. Returns an error if the expected number of bytes for the string block is not present. Returns nil if no errors occurred.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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