[Qt-interest] Semi-OT: indentation with operator<<

K. Frank kfrank29.c at gmail.com
Tue Jul 27 19:20:13 CEST 2010


Hi Atlant -

On Tue, Jul 27, 2010 at 12:06 PM, Atlant Schmidt
<aschmidt at dekaresearch.com> wrote:
> K. Frank:
>
>  Yeah, that's basically the idea I had in mind.
>  One difference between my implementation and
>  yours:
>
>  I conceived of the indent_level starting at -1
>  so that every "<<" overload could simply increase
>  the indent level on entry and decrease it on exit,
>  then doing whatever it wanted to do in-between.

Okay, that makes sense.  I had been wondering why you had
initialized indent_level to -1.

>  That
>  means that no special action need be taken if one
>  "<<" overload decides to invoke another "<<" overload
>  to display the deeper details; all the "<<" overload
>  operators just "auto-nest" automagically and every
>  "<<" overload has a very-similar "wrapper" handling
>  the indent_level: increment on entry, do its thing,
>  then decrement on exit.
>
>  After I wrote my initial reply, I also realized you could
>  play one more (optional) game with this scheme. Perhaps
>  you might use a preset indent_level of -2 to indicate
>  that no debugging output should be generated at all?
>  Other special values could also be implemented.
>
>                        Atlant

Thanks for the ideas.

K. Frank

> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of K. Frank
> Sent: Tuesday, July 27, 2010 11:41 AM
> To: Qt-interest
> Subject: Re: [Qt-interest] Semi-OT: indentation with operator<<
>
> Hi Atlant -
>
> Thanks for your suggestion.
>
> On Tue, Jul 27, 2010 at 7:51 AM, Atlant Schmidt
> <aschmidt at dekaresearch.com> wrote:
>> K. Frank:
>>
>>  This is one of those cases where I just despair at "The C++
>>  Way of Doing Things(R)".
>>
>>  Back in the old steam-powered days,...
>
> Ah, steampunk programming.  I like it...  I LIKE it...
> ...




More information about the Qt-interest-old mailing list