MCPcopy Index your code
hub / github.com/XmirrorSecurity/OpenSCA-cli / writeIndent

Method writeIndent

opensca/sca/java/xml/marshal.go:1037–1066  ·  view source on GitHub ↗
(depthDelta int)

Source from the content-addressed store, hash-verified

1035}
1036
1037func (p *printer) writeIndent(depthDelta int) {
1038 if len(p.prefix) == 0 && len(p.indent) == 0 {
1039 return
1040 }
1041 if depthDelta < 0 {
1042 p.depth--
1043 if p.indentedIn {
1044 p.indentedIn = false
1045 return
1046 }
1047 p.indentedIn = false
1048 }
1049 if p.putNewline {
1050 p.WriteByte('\n')
1051 } else {
1052 p.putNewline = true
1053 }
1054 if len(p.prefix) > 0 {
1055 p.WriteString(p.prefix)
1056 }
1057 if len(p.indent) > 0 {
1058 for i := 0; i < p.depth; i++ {
1059 p.WriteString(p.indent)
1060 }
1061 }
1062 if depthDelta > 0 {
1063 p.depth++
1064 p.indentedIn = true
1065 }
1066}
1067
1068type parentStack struct {
1069 p *printer

Callers 3

writeStartMethod · 0.95
writeEndMethod · 0.95
marshalStructMethod · 0.95

Calls 2

WriteByteMethod · 0.95
WriteStringMethod · 0.95

Tested by

no test coverage detected