trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: April 2012

Re: [trinity-devel] c/c++ gurus - Help? [ was Re: [trinity-devel] Now kipi-plugins failing?? error: redeclaration of 'TQListViewItemIterator it']

From: "David C. Rankin" <drankinatty@...>
Date: Fri, 13 Apr 2012 00:40:54 -0500
On 04/12/2012 11:03 PM, David C. Rankin wrote:
> On 04/10/2012 06:53 PM, Timothy Pearson wrote:
>> I think I see the problem, but haven't recompiled to test if this idea
>> resolves it for sure.
>>
>> It looks like for whatever reason gcc < 4.7 was't barfing when the new
>> "it" object was created within the scope of the existing "it" object,
>> which was created within the for loop definition.  Thus, gcc's new
>> behaviour is definitely correct.
>>
>> The easiest fix is to replace all instances of
>> "TQListViewItemIterator it(d->listView);"
>> with
>> "TQListViewItemIterator it2(d->listView);"
>> or similar.
> 
> Thank you Tim!
> 
>   I'll give it a go and report back.
> 

Here is the question -- "Which 'it's to I change to (eg: it6) in the code:

    for(KURL::List::const_iterator it = list.begin(); it != list.end(); ++it)
    {
        KURL imageUrl = *it;

        // Check if the new item already exist in the list.

        bool find = false;

->      TQListViewItemIterator it6(d->listView);
->      while (it.current())
        {
->          ImagesListViewItem* item = dynamic_cast<ImagesListViewItem*>(*it);

            if (item->url() == imageUrl)
                find = true;

->          ++it;  // does this become '++it6;'
        }

        if (!find)
        {
            new ImagesListViewItem(d->listView, imageUrl);
            urls.append(imageUrl);
        }
    }


How do I confirm that the 'it' I have marked with the sidebar '->' are the
correct 'it's to change to 'it6' and not 'it's that should remain 'it's under
the KURL::List construct??

-- 
David C. Rankin, J.D.,P.E.