|
CX Framework
Cross-platform C utility framework
|
Macros | |
| #define | jsonOutTree(sb, tree, ...) _jsonOutTree(sb, tree, opt_flags(__VA_ARGS__), (SSDLockState*)_ssdCurrentLockState) |
| #define | jsonTreeToString(out, tree, ...) _jsonTreeToString(out, tree, opt_flags(__VA_ARGS__), (SSDLockState*)_ssdCurrentLockState) |
Automatic JSON serialization from SSD trees.
| #define jsonOutTree | ( | sb, | |
| tree, | |||
| ... | |||
| ) | _jsonOutTree(sb, tree, opt_flags(__VA_ARGS__), (SSDLockState*)_ssdCurrentLockState) |
bool jsonOutTree(StreamBuffer *sb, SSDNode *tree, [flags])
Serializes an SSD tree to a stream buffer as JSON.
Automatically traverses the entire tree and outputs properly formatted JSON. The stream buffer should have a consumer registered (e.g., sbufStrCRegisterPush() or sbufFileCRegisterPush()).
IMPORTANT: The stream buffer is invalidated after this call.
| sb | Stream buffer to write to (invalidated after call) |
| tree | Root node of SSD tree to serialize |
| ... | (flags) Optional output formatting flags (defaults to platform EOL with no indent) |
Example:
| #define jsonTreeToString | ( | out, | |
| tree, | |||
| ... | |||
| ) | _jsonTreeToString(out, tree, opt_flags(__VA_ARGS__), (SSDLockState*)_ssdCurrentLockState) |
bool jsonTreeToString(string *out, SSDNode *tree, [flags])
Serializes an SSD tree to a string as JSON.
Convenience function that internally creates a stream buffer and writes the JSON output to a string. Equivalent to manually setting up a stream buffer with sbufStrCRegisterPush() and calling jsonOutTree().
| out | String to receive JSON output |
| tree | Root node of SSD tree to serialize |
| ... | (flags) Optional output formatting flags (defaults to platform EOL with no indent) |
Example: