-
Notifications
You must be signed in to change notification settings - Fork 2
/
qt_bool.qtpl.go
88 lines (76 loc) · 2.42 KB
/
qt_bool.qtpl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Code generated by qtc from "qt_bool.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
package tlcodegen
import "fmt"
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
func (trw *TypeRWBool) StreamGenerateCode(qw422016 *qt422016.Writer, bytesVersion bool, directImports *DirectImports) {
qw422016.N().S(`const ( `)
trw.streamgenerateBoolAlias(qw422016)
qw422016.N().S(` )
func `)
qw422016.N().S(addBytes(trw.wr.goGlobalName, bytesVersion))
qw422016.N().S(`ReadBoxed(w []byte, v *bool) ([]byte, error) {
return basictl.ReadBool(w, v, `)
qw422016.N().S(trw.falseGoName)
qw422016.N().S(`, `)
qw422016.N().S(trw.trueGoName)
qw422016.N().S(`)
}
func `)
qw422016.N().S(addBytes(trw.wr.goGlobalName, bytesVersion))
qw422016.N().S(`WriteBoxed(w []byte, v bool) []byte {
if v {
return basictl.NatWrite(w, 0x`)
qw422016.N().S(fmt.Sprintf("%x", trw.trueTag))
qw422016.N().S(`)
}
return basictl.NatWrite(w, 0x`)
qw422016.N().S(fmt.Sprintf("%x", trw.falseTag))
qw422016.N().S(`)
}
`)
}
func (trw *TypeRWBool) WriteGenerateCode(qq422016 qtio422016.Writer, bytesVersion bool, directImports *DirectImports) {
qw422016 := qt422016.AcquireWriter(qq422016)
trw.StreamGenerateCode(qw422016, bytesVersion, directImports)
qt422016.ReleaseWriter(qw422016)
}
func (trw *TypeRWBool) GenerateCode(bytesVersion bool, directImports *DirectImports) string {
qb422016 := qt422016.AcquireByteBuffer()
trw.WriteGenerateCode(qb422016, bytesVersion, directImports)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}
func (trw *TypeRWBool) streamgenerateBoolAlias(qw422016 *qt422016.Writer) {
qw422016.N().S(` `)
qw422016.N().S(trw.falseGoName)
qw422016.N().S(` uint32 = `)
qw422016.N().S(fmt.Sprintf("%#x", trw.falseTag))
qw422016.N().S(`
`)
qw422016.N().S(trw.trueGoName)
qw422016.N().S(` uint32 = `)
qw422016.N().S(fmt.Sprintf("%#x", trw.trueTag))
qw422016.N().S(`
`)
}
func (trw *TypeRWBool) writegenerateBoolAlias(qq422016 qtio422016.Writer) {
qw422016 := qt422016.AcquireWriter(qq422016)
trw.streamgenerateBoolAlias(qw422016)
qt422016.ReleaseWriter(qw422016)
}
func (trw *TypeRWBool) generateBoolAlias() string {
qb422016 := qt422016.AcquireByteBuffer()
trw.writegenerateBoolAlias(qb422016)
qs422016 := string(qb422016.B)
qt422016.ReleaseByteBuffer(qb422016)
return qs422016
}