func printFile(gen *Generator, file *pbmeta.FileDescriptor) { gen.Println("// Generated by github.com/davyxu/cellnet/protoc-gen-msg") gen.Println("// DO NOT EDIT!") gen.Println("// Source: ", file.FileName()) gen.In() for _, v := range file.Define.Dependency { gen.Println("// ", v) } gen.Out() gen.Println("package ", file.PackageName()) gen.Println() gen.Println("import (") gen.In() gen.Println("\"github.com/davyxu/cellnet\"") gen.Out() gen.Println(")") gen.Println() gen.Println("func init() {") gen.In() for i := 0; i < file.MessageCount(); i++ { msg := file.Message(i) msgFullName := file.PackageName() + "." + msg.Name() gen.Println("cellnet.RegisterMessageMeta(\"", msgFullName, "\", (*", msg.Name(), ")(nil), ", int(util.StringHash(msgFullName)), ")") } gen.Out() gen.Println("}") }
func printFile(gen *Generator, file *pbmeta.FileDescriptor) { gen.Println("// Generated by github.com/davyxu/protoc-gen-sharpnet") gen.Println("// DO NOT EDIT!") gen.Println("// Source: ", file.FileName()) gen.In() for _, v := range file.Define.Dependency { gen.Println("// ", v) } gen.Out() gen.Println("namespace ", file.PackageName()) gen.Println("{") gen.In() for i := 0; i < file.MessageCount(); i++ { msg := file.Message(i) printMessage(gen, msg, file) } gen.Println() for i := 0; i < file.EnumCount(); i++ { enum := file.Enum(i) printEnum(gen, enum) } gen.Out() gen.Println("}") }
func printFile(gen *Generator, file *pbmeta.FileDescriptor) { gen.Println("// This code is generated by github.com/davyxu/protoc-gen-sharpnet, DO NOT EDIT") gen.Println("// Generated from: ", file.FileName()) for _, v := range file.Define.Dependency { gen.Println("// Note: requires additional type generated from: ", v) } gen.Println("namespace ", file.PackageName()) gen.Println("{") gen.In() for i := 0; i < file.MessageCount(); i++ { msg := file.Message(i) printMessage(gen, msg, file) } gen.Println() for i := 0; i < file.EnumCount(); i++ { enum := file.Enum(i) printEnum(gen, enum) } gen.Out() gen.Println("}") }