cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CsharpStandardTypeMap map[string]string = map[string]string{
	"short":  "short",
	"ushort": "ushort",
	"int":    "int",
	"uint":   "uint",
	"long":   "long",
	"ulong":  "ulong",

	"float":  "float",
	"double": "double",
	"byte":   "byte",
	"bool":   "bool",
	"string": "string",
}
View Source
var CustomTypeMap map[string]string = map[string]string{}
View Source
var DefineToCsharpStandardTypeMap map[string]string = map[string]string{
	"int16":  "short",
	"uint16": "ushort",
	"int32":  "int",
	"uint32": "uint",
	"int64":  "long",
	"uint64": "ulong",

	"float32":        "float",
	"float64":        "double",
	"byte":           "byte",
	"bool":           "bool",
	"string":         "string",
	"...interface{}": "params object[]",
}
View Source
var GlobalStructs map[string]*StructObj = map[string]*StructObj{}
View Source
var StandardTypeMap map[string]string = map[string]string{
	"int16":  "int16",
	"uint16": "uint16",
	"int32":  "int32",
	"uint32": "uint32",
	"int64":  "int64",
	"uint64": "uint64",

	"float32":        "float32",
	"float64":        "float64",
	"byte":           "byte",
	"bool":           "bool",
	"string":         "string",
	"...interface{}": "...interface{}",
}
View Source
var StartMethodId = 1000

Functions

func AddPeer

func AddPeer(peer string, entity *Entity)

func AddPeerStruct

func AddPeerStruct(peer string, ptype string)

func AddStructType

func AddStructType(peer, ptype string) error

func CheckTypeDefine

func CheckTypeDefine(ptype string) bool

func ConvertToLanguageType

func ConvertToLanguageType(ptype string) string

func CreateAllDir

func CreateAllDir(path string) error

func CreateAllDirIfNotExists

func CreateAllDirIfNotExists(path string) error

func CreateDir

func CreateDir(path string) error

func EnvInit

func EnvInit() error

func Equal

func Equal(a, b interface{}) bool

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GenFileByTemplate

func GenFileByTemplate(filename string, tpl *template.Template, data interface{}) error

func GetBytesCount

func GetBytesCount(pparams, ptypes []string) string

func GetFuncName

func GetFuncName(s string) string

func GetMapKVType

func GetMapKVType(typestr string) (ktype, vtype string)

func GetSliceVType

func GetSliceVType(typestr string) (vtype string)

func GetStandardTypeBytesCount

func GetStandardTypeBytesCount(ptype string) string

func GetStructTypeName

func GetStructTypeName(ptype string) string

func GetType

func GetType(ptype string) string

func IsLast

func IsLast(index, count int) bool

func IsStructType

func IsStructType(ptype string) bool

func Minus

func Minus(a, b int) int

func NameToPeer

func NameToPeer(name string) byte

func Plus

func Plus(a, b int) int

func ReadCsharpOldFuncBody

func ReadCsharpOldFuncBody(filename string, e *Entity)

func ReadEntityCustomParams

func ReadEntityCustomParams(filename string, e *Entity)

func ReadLoadDataFuncBody

func ReadLoadDataFuncBody(filename string, e *Entity)

func ReadOldFuncBody

func ReadOldFuncBody(filename string, e *Entity)

func ReadSectionFile

func ReadSectionFile(path string) (map[string]string, error)

func RemoveEmptyElement

func RemoveEmptyElement(strarr []string) []string

func TrimBlankLeftAndRight

func TrimBlankLeftAndRight(str string) string

func TrimLeftAndRight

func TrimLeftAndRight(str string, sep string) string

func WriteSerializeType

func WriteSerializeType(writer io.Writer, ptype, pname string) error

func WriteUnSerializeType

func WriteUnSerializeType(writer io.Writer, ptype, pname string) error

Types

type Basic

type Basic struct {
	Type string
	Name string
}

type Entity

type Entity struct {
	//Server string
	IsUserEntity    bool `json:"isuserentity"`
	IsCreateOnStart bool `json:"iscreateonstart"`
	HasRPC          bool `json:"hasrpc"`
	HasWatcher      bool `json:"haswatcher"`

	IsServer         bool
	Path             string
	TypeId           uint16
	EntityName       string
	TitledEntityName string
	FuncNames        map[string]*FuncObj
	Funcs            []*FuncObj
	AllReqFuncs      []*FuncObj
	AllRespFuncs     []*FuncObj
	ModuleReqFuncs   map[string][]*FuncObj
	ModuleRespFuncs  map[string][]*FuncObj
	FuncModules      []string
	FuncsCfgMap      map[string][]*FuncData

	CurSendFuncs []*FuncObj
	CurRecvFuncs []*FuncObj
	CurFuncs     []*FuncObj
	CurPeer      string

	PeerSend map[string]map[string][]*FuncObj
	PeerRecv map[string]map[string][]*FuncObj

	CustomParams     string
	LoadDataFuncBody string
	CurImports       string

	StartMethodId int
	VerifyMethod  string
}

type FuncData

type FuncData struct {
	Send     []string
	Recv     []string
	Funcs    []string
	FuncsObj []*FuncObj
	FuncsMap map[string]*FuncObj
}

type FuncObj

type FuncObj struct {
	FileName          string
	Line              int
	Content           string
	Name              string
	ParamsName        []string
	ParamsType        []string
	ParamsBytesString string
	IsReq             bool
	IsCallback        bool

	OldFuncBody       string
	SerializeParams   string
	UnSerializeParams string

	SendPeerMap map[string]map[string]string   //map[sendpeer][transpeer]topeer
	TransferMap map[string]map[string]struct{} //map[transferpeer][]topeer
	SendPeers   []string
	RecvPeers   []string
}

func (*FuncObj) Build

func (f *FuncObj) Build() string

func (*FuncObj) CalcMaps

func (f *FuncObj) CalcMaps(sendpeerlist, recvpeerlist []string) error

func (*FuncObj) Parse

func (f *FuncObj) Parse(sendpeerlist, recvpeerlist []string) error

type IBuilder

type IBuilder interface {
	Parse() error
	Build() string
}

type Map

type Map struct {
	Name      string
	KeyType   string
	ValueType string
}

type PeerData

type PeerData struct {
	Entitys          []*Entity
	UserEntityType   uint16
	StartEntityTypes []uint16
	Structs          map[string]string
	GlobalStructs    map[string]*StructObj

	PeerName         string
	PeerType         byte
	PeerToNameMapStr string
	NameToPeerMapStr string
	NameToPeerMap    map[string]byte
}

type PeerNode

type PeerNode struct {
	Name   string
	Linked []string
	Weight []int
}

gen discovery info:if not client , for example lobby need discovery gate gen balance info:if not client, for example gate need balance info of lobby

type PeerVertex

type PeerVertex struct {
	Name string
}

func (*PeerVertex) CompareTo

func (pv *PeerVertex) CompareTo(m interface{}) int

func (*PeerVertex) Equals

func (pv *PeerVertex) Equals(m interface{}) bool

func (*PeerVertex) String

func (pv *PeerVertex) String() string

type Server

type Server struct {
	Name string
	Path string

	EntityNames []string
}

func (*Server) GenEntityIdFile

func (s *Server) GenEntityIdFile(filename string) error

type Slice

type Slice struct {
	Name string
	Type string
}

type Struct

type Struct struct {
	Name string
	Type string
}

type StructObj

type StructObj struct {
	StartLine int
	EndLine   int
	StrArray  []string
	FileName  string

	Name       string
	Params     map[string]string
	ParamsName []string
	ParamsType []string

	SerializeParams   string
	UnSerializeParams string
}

func (*StructObj) Build

func (s *StructObj) Build() string

func (*StructObj) CheckDataType

func (s *StructObj) CheckDataType() error

func (*StructObj) Parse

func (s *StructObj) Parse() error

Jump to

Keyboard shortcuts

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