CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
jsonout.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cx/ssdtree/ssdshared.h>
7#include "jsoncommon.h"
8
9typedef struct JSONOut JSONOut;
10
28
34
40#define JSON_Indent(x) (x & JSON_Indent_Mask)
41
45 JSON_Indent_Mask = 0x0000001f,
47 JSON_Compact = 0x00000100,
49 JSON_Single_Line = 0x00000200,
51 JSON_ASCII_Only = 0x00000400,
52
54 JSON_Unix_EOL = 0x00010000,
56 JSON_Windows_EOL = 0x00020000,
57
59 JSON_Pretty = 0x00000004,
61 JSON_Minimal = 0x00000300,
62};
63
65
71
110_Ret_opt_valid_ JSONOut* jsonOutBegin(_Inout_ StreamBuffer* sb, flags_t flags);
111
123_Check_return_ bool jsonOut(_Inout_ JSONOut* jo, _In_ JSONParseEvent* ev);
124
133_At_(*jo, _Pre_valid_ _Post_invalid_) void jsonOutEnd(_Inout_ JSONOut** jo);
134
136
142
171#define jsonOutTree(sb, tree, ...) \
172 _jsonOutTree(sb, tree, opt_flags(__VA_ARGS__), (SSDLockState*)_ssdCurrentLockState)
173bool _jsonOutTree(_Inout_ StreamBuffer* sb, _In_ SSDNode* tree, flags_t flags,
174 _Inout_opt_ SSDLockState* _ssdCurrentLockState);
175
202#define jsonTreeToString(out, tree, ...) \
203 _jsonTreeToString(out, tree, opt_flags(__VA_ARGS__), (SSDLockState*)_ssdCurrentLockState)
204bool _jsonTreeToString(_Inout_ string* out, _In_ SSDNode* tree, flags_t flags,
205 _Inout_opt_ SSDLockState* _ssdCurrentLockState);
206
JSON_OUT_FLAGS
JSON output formatting flags.
Definition jsonout.h:43
@ JSON_Minimal
Preset: Compact single-line output (minimal size)
Definition jsonout.h:61
@ JSON_Indent_Mask
Mask for extracting indent value (0-31 spaces)
Definition jsonout.h:45
@ JSON_Pretty
Preset: 4-space indent with newlines (readable output)
Definition jsonout.h:59
@ JSON_Compact
Omit spaces around { }, [ ], and : for compact output.
Definition jsonout.h:47
@ JSON_Windows_EOL
Force Windows-style line endings (CRLF) regardless of OS.
Definition jsonout.h:56
@ JSON_Unix_EOL
Force Unix-style line endings (LF) regardless of OS.
Definition jsonout.h:54
@ JSON_Single_Line
Do not insert newlines (causes indent to be ignored)
Definition jsonout.h:49
@ JSON_ASCII_Only
Escape all non-ASCII characters in output.
Definition jsonout.h:51
void jsonOutEnd(JSONOut **jo)
JSONOut * jsonOutBegin(StreamBuffer *sb, flags_t flags)
bool jsonOut(JSONOut *jo, JSONParseEvent *ev)
Common types for JSON parsing and output.