messages

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMessageTypeOneof

func IsMessageTypeOneof(field *types.Field) bool

IsMessageTypeOneof returns true iff the field is marked with `option (net.message_type) = true`.

func OutputDir

func OutputDir(sourceDir string) string

func PackageName

func PackageName(sourcePackagePath string) string

func PackagePath

func PackagePath(sourcePackagePath string) string

Types

type NetMessageNode

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

NetMessageNode represents a node in the tree corresponding to the hierarchy of net messages.

func (*NetMessageNode) AllConstructorParameters

func (node *NetMessageNode) AllConstructorParameters() params.FunctionParamList

AllConstructorParameters returns the accumulated parameters for the constructor function. The parameters include all the fields of all the ancestors in the hierarchy except those marked with [(mir.omit_in_constructor) = true] and the Type oneofs.

func (*NetMessageNode) Children

func (node *NetMessageNode) Children() []*NetMessageNode

Children returns the children messages in the hierarchy. NB: It may happen that a message class has no children.

func (*NetMessageNode) Constructor

func (node *NetMessageNode) Constructor() *jen.Statement

func (*NetMessageNode) IsMsgClass

func (node *NetMessageNode) IsMsgClass() bool

IsMsgClass returns true iff the message has a oneof field marked with [(mir.message_type) = true].

func (*NetMessageNode) IsNetMessage

func (node *NetMessageNode) IsNetMessage() bool

IsNetMessage returns true if this is not a msg class (see IsMsgClass).

func (*NetMessageNode) IsRoot

func (node *NetMessageNode) IsRoot() bool

IsRoot returns true if this is the root of the message hierarchy.

func (*NetMessageNode) Message

func (node *NetMessageNode) Message() *types.Message

Message returns the protobuf message for this net message.

func (*NetMessageNode) Name

func (node *NetMessageNode) Name() string

Name returns the name of the message. Same as ev.Message().Name().

func (*NetMessageNode) OneofOption

func (node *NetMessageNode) OneofOption() *types.OneofOption

OneofOption returns the option in the parent's Type oneof. If nil, IsRoot() must be true.

func (*NetMessageNode) Parent

func (node *NetMessageNode) Parent() *NetMessageNode

Parent returns the parent node in the hierarchy.

func (*NetMessageNode) ThisNodeConstructorParameters

func (node *NetMessageNode) ThisNodeConstructorParameters() params.ConstructorParamList

ThisNodeConstructorParameters returns a suffix of AllConstructorParameters() that corresponds to the fields only of this in the hierarchy, without the parameters accumulated from the ancestors.

func (*NetMessageNode) TypeOneof

func (node *NetMessageNode) TypeOneof() *types.Oneof

TypeOneof returns the Type oneof field of the message (if present).

type Parser

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

func DefaultParser

func DefaultParser() *Parser

DefaultParser returns a singleton Parser. It must not be accessed concurrently.

func (*Parser) ParseNetMessageHierarchy

func (p *Parser) ParseNetMessageHierarchy(netMessageRootMsg *types.Message) (root *NetMessageNode, err error)

ParseNetMessageHierarchy extracts the information about the whole net message hierarchy by its root.

func (*Parser) TypesParser

func (p *Parser) TypesParser() *types.Parser

TypesParser returns the types.Parser used to parse the types in the event hierarchy.

Jump to

Keyboard shortcuts

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