analyze

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ManifestFieldTypeUndefined indicates that the field is undefined
	ManifestFieldTypeUndefined = ManifestFieldType(iota)
	// ManifestFieldTypeElement indicates that the field is an element
	ManifestFieldTypeElement
	// ManifestFieldTypeElementList indicates that the field is a list of elements
	ManifestFieldTypeElementList
	// ManifestFieldTypeStructInfo indicates that the field is a StructInfo
	ManifestFieldTypeStructInfo
	// ManifestFieldTypeSubStruct indicates that the field is a underlaying struct
	ManifestFieldTypeSubStruct
	// ManifestFieldTypeEndValue indicates that the field is an EndValue
	ManifestFieldTypeEndValue
	// ManifestFieldTypeByteArrayDynamic indicates that the field is a´ dynamic byte array
	ManifestFieldTypeByteArrayDynamic
	// ManifestFieldTypeByteArrayStatic indicates that the field is a static byte array
	ManifestFieldTypeByteArrayStatic
	// ManifestFieldTypeList indicates that the field is a type list
	ManifestFieldTypeList
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicNamedType

type BasicNamedType struct {
	gosrc.AstTypeSpec
	Parent *File
}

BasicNamedType exports the structure BasiNamedType.

func (BasicNamedType) Methods

func (t BasicNamedType) Methods() Funcs

Methods returns the functions of the BasicNamedType instance

func (BasicNamedType) PrettyString

func (t BasicNamedType) PrettyString() (string, error)

PrettyString returns the instance of BasicNamedType as formatted string.

type Field

type Field struct {
	gosrc.Field

	Parent *Struct
}

Field is just a wrapper around gosrc.Field to provide necessary information for code generation.

func (Field) AccessPrefix

func (field Field) AccessPrefix() string

AccessPrefix returns a prefix of a given field.

func (Field) CountType

func (field Field) CountType() string

CountType returns the name of the type used to store the count of items of the slice. According to document #575623 it is usually uint16, but sometimes it is something else (for example uint8).

This method is used only for types ManifestFieldTypeByteArrayDynamic and ManifestFieldTypeList.

For example in table 5-11 (of document #575623) there are in particular fields `Count and `Digest`, where `Digest` is a list of HASH_STRUCTURE items and `Count` is the amount of these items. CountType defines the type of the field `Count` in this case (which is `uint16`).

func (Field) CountValue

func (field Field) CountValue() string

CountValue returns the value of Tag countValue

func (Field) DefaultValue

func (field Field) DefaultValue() string

DefaultValue returns the value of the Tag default

func (Field) ElementStructID

func (field Field) ElementStructID() string

ElementStructID returns the ElementStructID of a Field

func (Field) IsElement

func (field Field) IsElement() bool

IsElement returns bool true if a Struct is elements of a field.

func (Field) IsFlags

func (field Field) IsFlags() bool

IsFlags returns bool true if a field is of type Flags

func (Field) ItemTypeName

func (field Field) ItemTypeName() string

ItemTypeName returns the type of the given field.

func (Field) ManifestFieldType

func (field Field) ManifestFieldType() (ManifestFieldType, error)

ManifestFieldType returns the ManifestFieldType of the field instance

func (Field) PrettyString

func (field Field) PrettyString() (string, error)

PrettyString returns a formatted string of the field structure instance

func (Field) PrettyValue

func (field Field) PrettyValue() string

PrettyValue returns the value of the Tag prettyValue

func (Field) RehashValue

func (field Field) RehashValue() string

RehashValue returns the value of the tag rehashValue

func (Field) RequiredValue

func (field Field) RequiredValue() string

RequiredValue returns value of the Tag required

func (Field) Struct

func (field Field) Struct() *Struct

Struct returns a pointer to the most upper field structure instance

func (Field) TypeStdSize

func (field Field) TypeStdSize() int64

TypeStdSize returns the size (in bytes) of the field's value, if it has a static size.

For example if the field has type `uint32` or `[4]byte`, then the returned value will be `4`.

Basically this is something like `binary.Size(struct.Field)`.

type File

type File struct {
	gosrc.File

	Parent          *Package
	Structs         map[string]*Struct
	BasicNamedTypes map[string]*BasicNamedType
}

File struct has four fields. gosrc.File holds the associated file. Parent represents the package as element containing the file. Structs holds a map of all structures of a file matching to their name in string representation. BasicNamedTypes holds

type Func

type Func struct {
	Parent *File
	gosrc.Func
}

Func exports the Func struct

func (Func) PrettyStringForResult

func (fn Func) PrettyStringForResult(r interface{}) (string, error)

PrettyStringForResult returns a string corresponding with the documentation of the implemented function

func (Func) ReturnsFlagValue

func (fn Func) ReturnsFlagValue() bool

ReturnsFlagValue returns bool true if Function has a Flag value

func (Func) ReturnsTypeName

func (fn Func) ReturnsTypeName() string

ReturnsTypeName a string of the TypeName of the function

type Funcs

type Funcs []*Func

Funcs exports the custom type []*Funs

type ManifestFieldType

type ManifestFieldType uint

ManifestFieldType represents the custom type

func (ManifestFieldType) String

func (ft ManifestFieldType) String() string

type Package

type Package struct {
	gosrc.Package

	Files []*File
}

Package contains zwo fields. gosrc.Package and an slice of file pointers.

func Scan

func Scan(
	path string,
	goPaths []string,
) (*Package, error)

Scan holds information about a scan process used to scan a path.

func (*Package) StructByName

func (pkg *Package) StructByName(structName string) *Struct

StructByName returns Struct with the given name.

func (*Package) Structs

func (pkg *Package) Structs() map[string]*Struct

Structs returns a map matching StructNames to pointers of their struct instance.

type Struct

type Struct struct {
	gosrc.Struct

	Parent *File
	Fields []*Field
}

func (Struct) ElementStructID

func (_struct Struct) ElementStructID() string

func (Struct) ElementStructInfoField

func (_struct Struct) ElementStructInfoField() *Field

func (Struct) ElementStructInfoVar0

func (_struct Struct) ElementStructInfoVar0() string

func (Struct) ElementStructInfoVar1

func (_struct Struct) ElementStructInfoVar1() string

func (Struct) ElementStructVersion

func (_struct Struct) ElementStructVersion() string

func (Struct) HasOnRehash

func (_struct Struct) HasOnRehash() bool

func (Struct) IsElementsContainer

func (_struct Struct) IsElementsContainer() bool

func (Struct) Methods

func (_struct Struct) Methods() Funcs

func (Struct) PrettyString

func (_struct Struct) PrettyString() (string, error)

Jump to

Keyboard shortcuts

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