Documentation ¶
Index ¶
- Variables
- func GenCodeForDefineST(pSet *generator.PrototypeSet, df *generator.DefineST, isMessage bool) (string, error)
- func GenFileForMessage(pSet *generator.PrototypeSet, origFn string) error
- func GenFileForSet(pSet *generator.PrototypeSet) error
- type Generator
- type GeneratorConfig
- type TmplDefineSTData
- type TmplDefineSTDataField
- type TmplProtoFileData
Constants ¶
This section is empty.
Variables ¶
View Source
var TmplDefineST = &generator.TemplateHeader{
Name: "csharp_protobuf_define_st",
Filepath: "csharp_protobuf_define_st.tmpl",
BuiltinTemplateText: `
{{if (ne .DocComment "")}} {{.DocComment}}
{{end}} public partial class {{.Name}} : {{.BaseName}}
{
partial void OnConstruction()
{
{{range .Fields}}{{if (ne .ShouldInitCustomType "")}} {{.Name}} = new {{.ShouldInitCustomType}}();
{{end}}{{if .ShouldInitString}} {{.Name}} = "";
{{end}}{{end}} }
public override string Name()
{
return "{{.Name}}";
}
public override {{.Name}} NewST()
{
return new {{.Name}}();
}
public override Byte[] Encode()
{
return MessageExtensions.ToByteArray(this);
}
public override void Decode(Byte[] bs)
{
this.MergeFrom(bs);
}
{{if .IsMessage}}
public override UInt32 ProtoID()
{
return MessageDef.ProtoID{{.Name}};
}
public override {{.Name}} New()
{
return NewST();
}
{{end}}
}
`,
}
View Source
var TmplProtoFile = &generator.TemplateHeader{
Name: "csharp_protobuf_proto_file",
Filepath: "csharp_protobuf_proto_file.tmpl",
BuiltinTemplateText: `using System;
using System.Collections.Generic;
{{if (len .DefineSTCode | ne 0)}}using Google.Protobuf;
{{end}}
namespace {{.Namespace}}
{
{{range .DefineSTCode}}{{.}}{{end}}
}
`,
}
Functions ¶
func GenCodeForDefineST ¶
func GenFileForMessage ¶
func GenFileForMessage(pSet *generator.PrototypeSet, origFn string) error
func GenFileForSet ¶
func GenFileForSet(pSet *generator.PrototypeSet) error
Types ¶
type Generator ¶
type Generator struct { }
func (*Generator) Generate ¶
func (g *Generator) Generate(oc generator.GeneratorConfig, pSet *generator.PrototypeSet) error
func (*Generator) NewConfig ¶
func (g *Generator) NewConfig() generator.GeneratorConfig
type GeneratorConfig ¶
type GeneratorConfig struct { Dir string `json:"dir,omitempty"` NamespaceName string `json:"namespace_name,omitempty"` ProtoDir string `json:"proto_dir,omitempty"` MessageFilename string `json:"message_filename,omitempty"` ConstFilename string `json:"const_filename,omitempty"` Plugins []string `json:"plugins,omitempty"` }
type TmplDefineSTData ¶ added in v0.2.0
type TmplDefineSTDataField ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.