Lines Matching +full:- +full:- +full:name +full:- +full:pretty
1 // SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
24 bool pretty; /* optional whitepace */ member
28 /* indentation for pretty print */
32 for (i = 0; i < self->depth; ++i) in jsonw_indent()
33 fputs(" ", self->out); in jsonw_indent()
36 /* end current line and indent if pretty printing */
39 if (!self->pretty) in jsonw_eol()
42 putc('\n', self->out); in jsonw_eol()
49 if (self->sep != '\0') in jsonw_eor()
50 putc(self->sep, self->out); in jsonw_eor()
51 self->sep = ','; in jsonw_eor()
59 putc('"', self->out); in jsonw_puts()
63 fputs("\\t", self->out); in jsonw_puts()
66 fputs("\\n", self->out); in jsonw_puts()
69 fputs("\\r", self->out); in jsonw_puts()
72 fputs("\\f", self->out); in jsonw_puts()
75 fputs("\\b", self->out); in jsonw_puts()
78 fputs("\\\\", self->out); in jsonw_puts()
81 fputs("\\\"", self->out); in jsonw_puts()
84 putc(*str, self->out); in jsonw_puts()
86 putc('"', self->out); in jsonw_puts()
94 self->out = f; in jsonw_new()
95 self->depth = 0; in jsonw_new()
96 self->pretty = false; in jsonw_new()
97 self->sep = '\0'; in jsonw_new()
107 assert(self->depth == 0); in jsonw_destroy()
108 fputs("\n", self->out); in jsonw_destroy()
109 fflush(self->out); in jsonw_destroy()
116 self->pretty = on; in jsonw_pretty()
121 assert(self->depth == 0); in jsonw_reset()
122 self->sep = '\0'; in jsonw_reset()
129 putc(c, self->out); in jsonw_begin()
130 ++self->depth; in jsonw_begin()
131 self->sep = '\0'; in jsonw_begin()
136 assert(self->depth > 0); in jsonw_end()
138 --self->depth; in jsonw_end()
139 if (self->sep != '\0') in jsonw_end()
141 putc(c, self->out); in jsonw_end()
142 self->sep = ','; in jsonw_end()
146 /* Add a JSON property name */
147 void jsonw_name(json_writer_t *self, const char *name) in jsonw_name() argument
151 self->sep = '\0'; in jsonw_name()
152 jsonw_puts(self, name); in jsonw_name()
153 putc(':', self->out); in jsonw_name()
154 if (self->pretty) in jsonw_name()
155 putc(' ', self->out); in jsonw_name()
161 putc('"', self->out); in jsonw_vprintf_enquote()
162 vfprintf(self->out, fmt, ap); in jsonw_vprintf_enquote()
163 putc('"', self->out); in jsonw_vprintf_enquote()
172 vfprintf(self->out, fmt, ap); in jsonw_printf()
246 /* Basic name/value objects */
323 while (--argc) in main()