gen_macro

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MacroTypeMethod = 1
)

Variables

This section is empty.

Functions

func Gen

func Gen(config gen_server.MacroConfig) error

func JoinArgs

func JoinArgs(prefix string, args []*Arg) interface{}

func JoinArgsTail

func JoinArgsTail(offset int, prefix string, args []*Arg) interface{}

func JoinArgsTailWithType

func JoinArgsTailWithType(offset int, args []*Arg) interface{}

func JoinArgsWithType

func JoinArgsWithType(args []*Arg) interface{}

func LtChar

func LtChar() interface{}

Types

type Arg

type Arg struct {
	Name  string
	Type  string
	Ptr   string
	IsPtr bool
}

type GenState

type GenState struct {
	Package string
	// contains filtered or unexported fields
}

type Macro

type Macro struct {
	FilePath   string    // 所有的文件
	Type       MacroType //类型
	MacroFuncs []*MacroFunc
	Method     *Method
	// contains filtered or unexported fields
}

type MacroFunc

type MacroFunc struct {
	Line string
	Name string
	Args []string
	Arg0 string
	Arg1 string
	Arg2 string
	Arg3 string
	Arg4 string
}

type MacroGenerator

type MacroGenerator interface {
	Gen(f *MacroFunc, method *Method, sb *strings.Builder)
	Check(f *MacroFunc, method *Method) error
}

type MacroType

type MacroType int

func (MacroType) String

func (t MacroType) String() string

type Method

type Method struct {
	Line          string
	Declaration   string // 方法声明
	ReceiverName  string
	ReceiverIsPtr bool
	ReceiverPtr   string
	ReceiverType  string
	MethodName    string
	Args          []*Arg
	Returns       []*Arg

	ReturnsHead []*Arg
	ReturnsTail *Arg
	Arg0        *Arg
	Arg1        *Arg
}

type MethodMacroGenerator

type MethodMacroGenerator struct {
}

func (*MethodMacroGenerator) Check

func (self *MethodMacroGenerator) Check(macro *MacroFunc, method *Method) error

func (*MethodMacroGenerator) Gen

func (self *MethodMacroGenerator) Gen(macro *MacroFunc, method *Method, sb *strings.Builder)

Jump to

Keyboard shortcuts

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