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

224 lines
5.7 KiB
Go
Raw Normal View History

2017-01-24 15:09:23 +00:00
// This file is automatically generated by qtc from "file.qtpl".
// See https://github.com/valyala/quicktemplate for details.
//line templates/file.qtpl:1
package templates
//line templates/file.qtpl:1
import (
"sort"
2017-01-26 07:28:34 +00:00
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
2017-01-24 15:09:23 +00:00
)
// FileHeader is the file header template.
2017-06-06 10:57:18 +00:00
//line templates/file.qtpl:8
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
2017-01-24 15:09:23 +00:00
//line templates/file.qtpl:8
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line templates/file.qtpl:8
2017-01-26 07:28:34 +00:00
func StreamFileHeader(qw422016 *qt422016.Writer, pkgName string, d *internal.Domain) {
2017-01-24 15:09:23 +00:00
//line templates/file.qtpl:8
qw422016.N().S(`
`)
//line templates/file.qtpl:9
if d != nil {
//line templates/file.qtpl:9
qw422016.N().S(`// Package `)
//line templates/file.qtpl:9
qw422016.N().S(d.PackageName())
//line templates/file.qtpl:9
qw422016.N().S(` provides the Chrome Debugging Protocol
// commands, types, and events for the `)
2017-01-24 15:09:23 +00:00
//line templates/file.qtpl:10
qw422016.N().S(d.String())
//line templates/file.qtpl:10
qw422016.N().S(` domain.
// `)
//line templates/file.qtpl:11
if desc := d.Description; desc != "" {
//line templates/file.qtpl:11
qw422016.N().S(`
`)
//line templates/file.qtpl:12
qw422016.N().S(formatComment(desc, "", ""))
//line templates/file.qtpl:12
qw422016.N().S(`
//`)
//line templates/file.qtpl:13
}
//line templates/file.qtpl:13
qw422016.N().S(`
// Generated by the chromedp-gen command.`)
//line templates/file.qtpl:14
}
//line templates/file.qtpl:14
qw422016.N().S(`
package `)
//line templates/file.qtpl:15
qw422016.N().S(pkgName)
//line templates/file.qtpl:15
qw422016.N().S(`
// AUTOGENERATED. DO NOT EDIT.
`)
//line templates/file.qtpl:18
}
//line templates/file.qtpl:18
2017-01-26 07:28:34 +00:00
func WriteFileHeader(qq422016 qtio422016.Writer, pkgName string, d *internal.Domain) {
2017-01-24 15:09:23 +00:00
//line templates/file.qtpl:18
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/file.qtpl:18
StreamFileHeader(qw422016, pkgName, d)
//line templates/file.qtpl:18
qt422016.ReleaseWriter(qw422016)
//line templates/file.qtpl:18
}
//line templates/file.qtpl:18
2017-01-26 07:28:34 +00:00
func FileHeader(pkgName string, d *internal.Domain) string {
2017-01-24 15:09:23 +00:00
//line templates/file.qtpl:18
qb422016 := qt422016.AcquireByteBuffer()
//line templates/file.qtpl:18
WriteFileHeader(qb422016, pkgName, d)
//line templates/file.qtpl:18
qs422016 := string(qb422016.B)
//line templates/file.qtpl:18
qt422016.ReleaseByteBuffer(qb422016)
//line templates/file.qtpl:18
return qs422016
//line templates/file.qtpl:18
}
// FileImportTemplate is a general import template.
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:21
2017-01-24 15:09:23 +00:00
func StreamFileImportTemplate(qw422016 *qt422016.Writer, m map[string]string) {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:22
2017-01-24 15:09:23 +00:00
var keys []string
for k := range m {
2017-01-24 15:09:23 +00:00
keys = append(keys, k)
}
sort.Strings(keys)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:27
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
import (`)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:28
2017-01-24 15:09:23 +00:00
for _, k := range keys {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:29
2017-01-24 15:09:23 +00:00
v := m[k]
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:30
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
if k != v {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
qw422016.N().S(v)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
qw422016.N().S(` `)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
qw422016.N().S(`"`)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
qw422016.N().S(k)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
qw422016.N().S(`"`)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:31
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
)
`)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
func WriteFileImportTemplate(qq422016 qtio422016.Writer, m map[string]string) {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
StreamFileImportTemplate(qw422016, m)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
qt422016.ReleaseWriter(qw422016)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
func FileImportTemplate(m map[string]string) string {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
WriteFileImportTemplate(qb422016, m)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
qs422016 := string(qb422016.B)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
return qs422016
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:33
2017-01-24 15:09:23 +00:00
}
// FileVarTemplate is a template for a single variable declaration.
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:36
2017-01-24 15:09:23 +00:00
func StreamFileVarTemplate(qw422016 *qt422016.Writer, name, value, desc string) {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:36
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:37
qw422016.N().S(formatComment(desc, "", name+" "))
//line templates/file.qtpl:37
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
var `)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:38
2017-01-24 15:09:23 +00:00
qw422016.N().S(name)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:38
2017-01-24 15:09:23 +00:00
qw422016.N().S(` = `)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:38
2017-01-24 15:09:23 +00:00
qw422016.N().S(value)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:38
2017-01-24 15:09:23 +00:00
qw422016.N().S(`
`)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
func WriteFileVarTemplate(qq422016 qtio422016.Writer, name, value, desc string) {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
StreamFileVarTemplate(qw422016, name, value, desc)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
qt422016.ReleaseWriter(qw422016)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
func FileVarTemplate(name, value, desc string) string {
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
WriteFileVarTemplate(qb422016, name, value, desc)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
qs422016 := string(qb422016.B)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
return qs422016
2017-01-26 07:28:34 +00:00
//line templates/file.qtpl:39
2017-01-24 15:09:23 +00:00
}