On 08.10.2009, at 19:16, André Pönitz wrote:
> On Thursday 08 October 2009 16:47:34 ext Rudenko Eugene wrote:
>> Hello all, I wanted to add QUrl to debug helper (as practice).
>> my function looks like
>>
>> static void qDumpQUrl(QDumper &d)
>> {
>> const QUrl &url = *reinterpret_cast<const QUrl *>(d.data);
>> QList<QPair<QString,QString> > queryItems = url.queryItems();
>> d.putItem("value", url.toString());
>> d.putItem("valueencoded", "2");
>> d.putItem("type", NS"QUrl");
>> d.putItem("numchild", "1");
>> if (d.dumpChildren) {
>> d.beginChildren();
>> d.putHash("authority", url.authority());
>> d.putHash("fragment", url.fragment());
>> d.putHash("host", url.host());
>> d.putHash("isRelative", url.isRelative());
>> d.putHash("isValid", url.isValid());
>> d.putHash("password", url.password());
>> d.putHash("path", url.path());
>> d.putHash("port", url.port());
>> d.putHash("scheme", url.scheme());
>> d.putHash("userInfo", url.userInfo());
>> d.putHash("userName", url.userName());
>> }
>> d.disarm();
>> }
>>
>> This function works well, but i'm not understand how to add
>> queryItems
>> to dump.
>
> You'd need something like
>
> d.beginHash();
> d.putItem("name", "queryItems");
> d.putItemCount("value", queryItems.size());
> d.beginItem("exp");
> d.put("(('"NS"QList<"NS"QPair<"NS"QString,"NS"QString>
> >'*)").put(d.data).put(')')->queryItems()");
> d.endItem();
> d.putItem("type", NS"QList<"NS"QPair<"NS"QString,"NS"QString>
> >");
> d.putItem("numchild", queryItems.size());
> d.endHash();
>
> [Untested, the quotes in the long line are probably wrong]
>
Thank's for Idea, but it's not clear for me what result string is
needed for this condtruction:
d.put("(('"NS"QList<"NS"QPair<"NS"QString,"NS"QString>
>'*)").put(d.data).put(')')->queryItems()");
Please write resulting string.
>> I tried to do it via
>> d.beginHash();
>> d.putItem("addr", &queryItems);
>> qDumpInnerValueHelper(d, "QList<QPair<QString,QString> >",
>> &queryItems);
>> d.endHash();
>> but without success.
>
> Yes, this cannot work as you pass the address of the local copy
> (queryItems)
> of the "real" list do the dumpers. This will be invalid as soon as
> qDumpQUrl
> is finished.
I know about this, I tried to show Idea.
Thank for help me to understand the internals of helper macros. I
think it's very powerfull instrument and Nokia need to make good
documentation about it.
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator