chromedp/cmd/chromedp-gen/templates/domain.qtpl.go

614 lines
16 KiB
Go
Raw Normal View History

2017-01-24 15:09:23 +00:00
// This file is automatically generated by qtc from "domain.qtpl".
// See https://github.com/valyala/quicktemplate for details.
//line templates/domain.qtpl:1
package templates
//line templates/domain.qtpl:1
import (
2017-01-26 07:28:34 +00:00
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
2017-01-24 15:09:23 +00:00
)
// DomainTemplate is the template for a single domain.
2017-06-06 10:57:18 +00:00
//line templates/domain.qtpl:6
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
2017-01-24 15:09:23 +00:00
//line templates/domain.qtpl:6
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line templates/domain.qtpl:6
2017-01-26 07:28:34 +00:00
func StreamDomainTemplate(qw422016 *qt422016.Writer, d *internal.Domain, domains []*internal.Domain) {
2017-01-24 15:09:23 +00:00
//line templates/domain.qtpl:6
qw422016.N().S(`
`)
//line templates/domain.qtpl:7
2017-01-26 07:28:34 +00:00
qw422016.N().S(FileImportTemplate(map[string]string{
*internal.FlagPkg: "cdp",
}))
//line templates/domain.qtpl:9
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:10
2017-01-24 15:09:23 +00:00
for _, c := range d.Commands {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:10
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:11
2017-01-24 15:09:23 +00:00
qw422016.N().S(CommandTemplate(c, d, domains))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:11
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:12
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:12
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
func WriteDomainTemplate(qq422016 qtio422016.Writer, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
StreamDomainTemplate(qw422016, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
qt422016.ReleaseWriter(qw422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
func DomainTemplate(d *internal.Domain, domains []*internal.Domain) string {
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
WriteDomainTemplate(qb422016, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
qs422016 := string(qb422016.B)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
return qs422016
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:13
2017-01-24 15:09:23 +00:00
}
// CommandTemplate is the general command template.
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:16
func StreamCommandTemplate(qw422016 *qt422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:16
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:17
2017-01-24 15:09:23 +00:00
/* add *Param type */
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:17
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:18
qw422016.N().S(TypeTemplate(c, internal.CommandTypePrefix, internal.CommandTypeSuffix, d, domains, nil, false, true))
//line templates/domain.qtpl:18
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:20
2017-01-24 15:09:23 +00:00
/* add Command func */
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:20
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:21
2017-01-24 15:09:23 +00:00
qw422016.N().S(CommandFuncTemplate(c, d, domains))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:21
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:23
2017-01-24 15:09:23 +00:00
/* add param funcs (only if it has parameters and a returns). */
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:23
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:24
2017-01-24 15:09:23 +00:00
if len(c.Parameters) != 0 {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:24
2017-01-24 15:09:23 +00:00
for _, p := range c.Parameters {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:24
2017-01-24 15:09:23 +00:00
if !p.Optional {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:24
2017-01-24 15:09:23 +00:00
continue
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:24
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:24
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:25
2017-01-24 15:09:23 +00:00
qw422016.N().S(CommandOptionFuncTemplate(p, c, d, domains))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:25
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:26
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:26
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:26
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:28
2017-01-24 15:09:23 +00:00
/* add *Returns type */
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:28
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:29
2017-01-24 15:09:23 +00:00
if len(c.Returns) != 0 {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:29
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:30
qw422016.N().S(TypeTemplate(&internal.Type{
2017-01-24 15:09:23 +00:00
ID: c.Name,
2017-01-26 07:28:34 +00:00
Type: internal.TypeObject,
2017-01-24 15:09:23 +00:00
Description: "Return values.",
Properties: c.Returns,
2017-01-26 07:28:34 +00:00
}, internal.CommandReturnsPrefix, internal.CommandReturnsSuffix, d, domains, nil, false, false))
//line templates/domain.qtpl:35
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:36
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:36
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:38
2017-01-24 15:09:23 +00:00
/* add CommandParams.Do func */
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:38
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:39
2017-01-24 15:09:23 +00:00
qw422016.N().S(CommandDoFuncTemplate(c, d, domains))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:39
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
func WriteCommandTemplate(qq422016 qtio422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
StreamCommandTemplate(qw422016, c, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
qt422016.ReleaseWriter(qw422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
func CommandTemplate(c *internal.Type, d *internal.Domain, domains []*internal.Domain) string {
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
WriteCommandTemplate(qb422016, c, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
qs422016 := string(qb422016.B)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
return qs422016
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:40
2017-01-24 15:09:23 +00:00
}
// CommandFuncTemplate is the command func template.
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:43
func StreamCommandFuncTemplate(qw422016 *qt422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:44
2017-01-24 15:09:23 +00:00
cmdName := c.CamelName()
typ := c.CommandType()
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:46
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:47
qw422016.N().S(formatComment(c.GetDescription(), "", cmdName+" "))
//line templates/domain.qtpl:47
2017-01-24 15:09:23 +00:00
if len(c.Parameters) > 0 {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:47
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
2017-01-26 07:28:34 +00:00
//
2017-01-24 15:09:23 +00:00
// parameters:`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:49
2017-01-24 15:09:23 +00:00
for _, p := range c.Parameters {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:49
2017-01-24 15:09:23 +00:00
if p.Optional {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:49
2017-01-24 15:09:23 +00:00
continue
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:49
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:49
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
// `)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:50
2017-01-24 15:09:23 +00:00
qw422016.N().S(p.String())
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:50
2017-01-24 15:09:23 +00:00
if p.Optional {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:50
2017-01-24 15:09:23 +00:00
qw422016.N().S(` (optional)`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:50
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:50
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:50
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:50
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
func `)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:51
2017-01-24 15:09:23 +00:00
qw422016.N().S(cmdName)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:51
2017-01-24 15:09:23 +00:00
qw422016.N().S(`(`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:51
2017-01-24 15:09:23 +00:00
qw422016.N().S(c.ParamList(d, domains, false))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:51
2017-01-24 15:09:23 +00:00
qw422016.N().S(`) *`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:51
2017-01-24 15:09:23 +00:00
qw422016.N().S(typ)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:51
2017-01-24 15:09:23 +00:00
qw422016.N().S(`{
return &`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:52
2017-01-24 15:09:23 +00:00
qw422016.N().S(typ)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:52
2017-01-24 15:09:23 +00:00
qw422016.N().S(`{`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:52
2017-01-24 15:09:23 +00:00
for _, t := range c.Parameters {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:52
2017-01-24 15:09:23 +00:00
if !t.Optional {
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:52
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:53
2017-01-24 15:09:23 +00:00
qw422016.N().S(t.GoName(false))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:53
2017-01-24 15:09:23 +00:00
qw422016.N().S(`: `)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:53
2017-01-24 15:09:23 +00:00
qw422016.N().S(t.GoName(true))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:53
2017-01-24 15:09:23 +00:00
qw422016.N().S(`,`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:53
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:53
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:53
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
}
}
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
func WriteCommandFuncTemplate(qq422016 qtio422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
StreamCommandFuncTemplate(qw422016, c, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
qt422016.ReleaseWriter(qw422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
func CommandFuncTemplate(c *internal.Type, d *internal.Domain, domains []*internal.Domain) string {
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
WriteCommandFuncTemplate(qb422016, c, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
qs422016 := string(qb422016.B)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
return qs422016
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:56
2017-01-24 15:09:23 +00:00
}
// CommandOptionFuncTemplate is the command option func template.
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:59
func StreamCommandOptionFuncTemplate(qw422016 *qt422016.Writer, t *internal.Type, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:60
2017-01-24 15:09:23 +00:00
n := t.GoName(false)
2017-01-26 07:28:34 +00:00
optName := internal.OptionFuncPrefix + n + internal.OptionFuncSuffix
2017-01-24 15:09:23 +00:00
typ := c.CommandType()
v := t.GoName(true)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:64
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:65
qw422016.N().S(formatComment(t.GetDescription(), "", optName+" "))
//line templates/domain.qtpl:65
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
func (p `)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(typ)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(`) `)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(optName)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(`(`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(v)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(` `)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(t.GoType(d, domains))
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(`) *`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(typ)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:66
2017-01-24 15:09:23 +00:00
qw422016.N().S(`{
p.`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:67
2017-01-24 15:09:23 +00:00
qw422016.N().S(n)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:67
2017-01-24 15:09:23 +00:00
qw422016.N().S(` = `)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:67
2017-01-24 15:09:23 +00:00
qw422016.N().S(v)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:67
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
return &p
}
`)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
func WriteCommandOptionFuncTemplate(qq422016 qtio422016.Writer, t *internal.Type, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
StreamCommandOptionFuncTemplate(qw422016, t, c, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
qt422016.ReleaseWriter(qw422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
func CommandOptionFuncTemplate(t *internal.Type, c *internal.Type, d *internal.Domain, domains []*internal.Domain) string {
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
WriteCommandOptionFuncTemplate(qb422016, t, c, d, domains)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
qs422016 := string(qb422016.B)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
return qs422016
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:70
2017-01-24 15:09:23 +00:00
}
// CommandDoFuncTemplate is the command do func template.
2017-01-26 07:28:34 +00:00
//line templates/domain.qtpl:73
func StreamCommandDoFuncTemplate(qw422016 *qt422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:74
2017-01-24 15:09:23 +00:00
typ := c.CommandType()
hasEmptyParams := len(c.Parameters) == 0
hasEmptyRet := len(c.Returns) == 0
emptyRet := c.EmptyRetList(d, domains)
if emptyRet != "" {
emptyRet += ", "
}
retTypeList := c.RetTypeList(d, domains)
if retTypeList != "" {
retTypeList += ", "
}
retValueList := c.RetNameList("res", d, domains)
2017-01-24 15:09:23 +00:00
if retValueList != "" {
retValueList += ", "
}
b64ret := c.Base64EncodedRetParam()
// determine if there's a conditional that indicates whether or not the
// returned value is b64 encoded.
var b64cond bool
2017-01-24 15:09:23 +00:00
for _, p := range c.Returns {
2017-01-26 07:28:34 +00:00
if p.Name == internal.Base64EncodedParamName {
2017-01-24 15:09:23 +00:00
b64cond = true
break
}
}
pval := "p"
if hasEmptyParams {
pval = "nil"
}
//line templates/domain.qtpl:110
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
// Do executes `)
//line templates/domain.qtpl:111
2017-01-24 15:09:23 +00:00
qw422016.N().S(c.ProtoName(d))
//line templates/domain.qtpl:111
qw422016.N().S(` against the provided context and
// target handler.`)
//line templates/domain.qtpl:112
if !hasEmptyRet {
//line templates/domain.qtpl:112
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
//
// returns:`)
//line templates/domain.qtpl:114
2017-01-24 15:09:23 +00:00
for _, p := range c.Returns {
//line templates/domain.qtpl:114
2017-01-26 07:28:34 +00:00
if p.Name == internal.Base64EncodedParamName {
//line templates/domain.qtpl:114
2017-01-24 15:09:23 +00:00
continue
//line templates/domain.qtpl:114
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:114
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
// `)
//line templates/domain.qtpl:115
2017-01-24 15:09:23 +00:00
qw422016.N().S(p.String())
//line templates/domain.qtpl:115
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:115
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:115
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
func (p *`)
//line templates/domain.qtpl:116
2017-01-24 15:09:23 +00:00
qw422016.N().S(typ)
//line templates/domain.qtpl:116
qw422016.N().S(`) Do(ctxt context.Context, h cdp.Handler) (`)
//line templates/domain.qtpl:116
2017-01-24 15:09:23 +00:00
qw422016.N().S(retTypeList)
//line templates/domain.qtpl:116
qw422016.N().S(`err error) {`)
//line templates/domain.qtpl:116
if hasEmptyRet {
//line templates/domain.qtpl:116
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
return h.Execute(ctxt, cdp.`)
//line templates/domain.qtpl:117
qw422016.N().S(c.CommandMethodType(d))
//line templates/domain.qtpl:117
qw422016.N().S(`, `)
//line templates/domain.qtpl:117
qw422016.N().S(pval)
//line templates/domain.qtpl:117
qw422016.N().S(`, nil)`)
//line templates/domain.qtpl:117
2017-01-24 15:09:23 +00:00
} else {
//line templates/domain.qtpl:117
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
// execute
var res `)
//line templates/domain.qtpl:119
2017-01-24 15:09:23 +00:00
qw422016.N().S(c.CommandReturnsType())
//line templates/domain.qtpl:119
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
err = h.Execute(ctxt, cdp.`)
//line templates/domain.qtpl:120
qw422016.N().S(c.CommandMethodType(d))
//line templates/domain.qtpl:120
qw422016.N().S(`, `)
//line templates/domain.qtpl:120
qw422016.N().S(pval)
//line templates/domain.qtpl:120
qw422016.N().S(`, &res)
if err != nil {
return `)
//line templates/domain.qtpl:122
2017-01-24 15:09:23 +00:00
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:122
qw422016.N().S(`err
}
`)
//line templates/domain.qtpl:124
2017-01-24 15:09:23 +00:00
if b64ret != nil {
//line templates/domain.qtpl:124
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
// decode
var dec []byte`)
//line templates/domain.qtpl:126
2017-01-24 15:09:23 +00:00
if b64cond {
//line templates/domain.qtpl:126
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
if res.Base64encoded {`)
//line templates/domain.qtpl:127
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:127
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
dec, err = base64.StdEncoding.DecodeString(res.`)
//line templates/domain.qtpl:128
2017-01-24 15:09:23 +00:00
qw422016.N().S(b64ret.GoName(false))
//line templates/domain.qtpl:128
2017-01-24 15:09:23 +00:00
qw422016.N().S(`)
if err != nil {
2017-10-15 05:47:06 +00:00
return `)
//line templates/domain.qtpl:130
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:130
qw422016.N().S(`err
}`)
//line templates/domain.qtpl:131
2017-01-24 15:09:23 +00:00
if b64cond {
//line templates/domain.qtpl:131
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
} else {
dec = []byte(res.`)
//line templates/domain.qtpl:133
2017-01-24 15:09:23 +00:00
qw422016.N().S(b64ret.GoName(false))
//line templates/domain.qtpl:133
2017-01-24 15:09:23 +00:00
qw422016.N().S(`)
}`)
//line templates/domain.qtpl:134
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:134
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:134
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
return `)
//line templates/domain.qtpl:135
qw422016.N().S(retValueList)
//line templates/domain.qtpl:135
qw422016.N().S(`nil`)
//line templates/domain.qtpl:135
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:135
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
}
`)
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:137
2017-01-26 07:28:34 +00:00
func WriteCommandDoFuncTemplate(qq422016 qtio422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
StreamCommandDoFuncTemplate(qw422016, c, d, domains)
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
qt422016.ReleaseWriter(qw422016)
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
}
//line templates/domain.qtpl:137
2017-01-26 07:28:34 +00:00
func CommandDoFuncTemplate(c *internal.Type, d *internal.Domain, domains []*internal.Domain) string {
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
WriteCommandDoFuncTemplate(qb422016, c, d, domains)
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
qs422016 := string(qb422016.B)
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
return qs422016
//line templates/domain.qtpl:137
2017-01-24 15:09:23 +00:00
}