mirror of
https://github.com/json-c/json-c.git
synced 2026-04-04 21:09:06 +08:00
Adding JSON_C_TO_STRING_PRETTY_TAB flag
- Tabs are easier to read for tired eyes and editor adjustable
This commit is contained in:
@@ -300,7 +300,14 @@ static void indent(struct printbuf *pb, int level, int flags)
|
|||||||
{
|
{
|
||||||
if (flags & JSON_C_TO_STRING_PRETTY)
|
if (flags & JSON_C_TO_STRING_PRETTY)
|
||||||
{
|
{
|
||||||
printbuf_memset(pb, -1, ' ', level * 2);
|
if (flags & JSON_C_TO_STRING_PRETTY_TAB)
|
||||||
|
{
|
||||||
|
printbuf_memset(pb, -1, '\t', level);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printbuf_memset(pb, -1, ' ', level * 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ extern "C" {
|
|||||||
* for an example of the format.
|
* for an example of the format.
|
||||||
*/
|
*/
|
||||||
#define JSON_C_TO_STRING_PRETTY (1<<1)
|
#define JSON_C_TO_STRING_PRETTY (1<<1)
|
||||||
|
/**
|
||||||
|
* A flag for the json_object_to_json_string_ext() and
|
||||||
|
* json_object_to_file_ext() functions which causes
|
||||||
|
* the output to be formatted.
|
||||||
|
*
|
||||||
|
* Instead of a "Two Space Tab" this gives a single tab character.
|
||||||
|
*/
|
||||||
|
#define JSON_C_TO_STRING_PRETTY_TAB (1<<3)
|
||||||
/**
|
/**
|
||||||
* A flag to drop trailing zero for float values
|
* A flag to drop trailing zero for float values
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user