qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 12/18] qapi: Add qobject_to_json_pretty_prefi


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 12/18] qapi: Add qobject_to_json_pretty_prefix()
Date: Tue, 03 May 2016 10:32:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 05/02/2016 07:56 AM, Markus Armbruster wrote:
>> Eric Blake <address@hidden> writes:
>> 
>>> The next patch will add pretty indentation to the JSON visitor.
>>> But in order to support pretty output in the type_any() callback,
>>> we need to prefix every line of the QObject visitor by the current
>>> indentation in the JSON visitor.  Hence, a new function
>>> qobject_to_json_pretty_indent(), and the old function becomes a
>>> thin wrapper to the expanded behavior.
>>>
>
>>>  QString *qobject_to_json(const QObject *obj);
>>>  QString *qobject_to_json_pretty(const QObject *obj);
>>> +QString *qobject_to_json_pretty_prefix(const QObject *obj, const char 
>>> *prefix);
>> 
>> Why a string prefix, and not indentation?
>
> Might be possible.  Would it be better as an integer for 'number of
> spaces' or for 'number of indentation levels (where number of spaces per
> indentation-level is not configurable)'?

I'd go with indentation levels.  The number of spaces per level is
already an implementation detail of the pretty printer.  Duplicating it
outside of it is not a good idea.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]