generator

package
v0.0.0-...-fde848d Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelCase

func CamelCase(s string) string

CamelCase returns the CamelCased name. If there is an interior underscore followed by a lower case letter, drop the underscore and convert the letter to upper case. There is a remote possibility of this rewrite causing a name collision, but it's so remote we're prepared to pretend it's nonexistent - since the C++ generator lowercases names, it's extremely unlikely to have two fields with different capitalizations. In short, _my_field_name_2 becomes XMyFieldName_2.

func CamelCaseSlice

func CamelCaseSlice(elem []string) string

CamelCaseSlice is like CamelCase, but the argument is a slice of strings to be joined with "_".

Types

type Generator

type Generator struct {
	Request  *plugin.CodeGeneratorRequest  // The input.
	Response *plugin.CodeGeneratorResponse // The output.

	Param map[string]string // Command-line parameters.
}

Generator is the type whose methods generate the output, stored in the associated response structure.

func New

func New() *Generator

New creates a new generator and allocates the request and response protobufs.

func (*Generator) CommandLineParameters

func (g *Generator) CommandLineParameters(parameter string)

CommandLineParameters breaks the comma-separated list of key=value pairs in the parameter (a member of the request protobuf) into a key/value map. It then sets file name mappings defined by those entries.

func (*Generator) Error

func (g *Generator) Error(err error, msgs ...string)

Error reports a problem, including an error, and exits the program.

func (*Generator) Fail

func (g *Generator) Fail(msgs ...string)

Fail reports a problem and exits the program.

func (*Generator) GenerateAllFiles

func (g *Generator) GenerateAllFiles()

Jump to

Keyboard shortcuts

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