Documentation ¶
Index ¶
- func IsMessageTypeOneof(field *types.Field) bool
- func OutputDir(sourceDir string) string
- func PackageName(sourcePackagePath string) string
- func PackagePath(sourcePackagePath string) string
- type NetMessageNode
- func (node *NetMessageNode) AllConstructorParameters() params.FunctionParamList
- func (node *NetMessageNode) Children() []*NetMessageNode
- func (node *NetMessageNode) Constructor() *jen.Statement
- func (node *NetMessageNode) IsMsgClass() bool
- func (node *NetMessageNode) IsNetMessage() bool
- func (node *NetMessageNode) IsRoot() bool
- func (node *NetMessageNode) Message() *types.Message
- func (node *NetMessageNode) Name() string
- func (node *NetMessageNode) OneofOption() *types.OneofOption
- func (node *NetMessageNode) Parent() *NetMessageNode
- func (node *NetMessageNode) ThisNodeConstructorParameters() params.ConstructorParamList
- func (node *NetMessageNode) TypeOneof() *types.Oneof
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMessageTypeOneof ¶
IsMessageTypeOneof returns true iff the field is marked with `option (net.message_type) = true`.
func PackageName ¶
func PackagePath ¶
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 ¶
TypesParser returns the types.Parser used to parse the types in the event hierarchy.