Graphical Class View

Harald Fernengel harry at bnro.de
Wed Jul 25 09:27:10 UTC 2001


Hi,

look at the documentation how to run through an Iterator. You have to set it 
to first() before you can access it. Just use the example for(;;) loop from 
the QListIterator documentation.

Harry

> I did a little  testing with  CGfxClassBox class and found somthing realy
> supprising.
> Each CGfxClassBox instance is insatiated with a CParsedClass instance which
> can be null.
> An CParsedClass (the memeber m_class for CGfxClassBox) has some iterators
> which give access to the methods and members of
> the class parsed.
> So I wrote the above two methods to see how it works.
> The generateIcon() calls the addMembers for every iterator which can be
> taken from the m_class.
> And here is the strange thing.
> The iteraretor has count()>0 but every element accessed via
> iterator.current() is NULL.
> Why???
> Here is the code I wrote and I send you the altered .h ,.cpp files of
> CGfxClassBox.
> I would like to communicate with the author of GfxView.
> Please mail me if you are reding this.
> Thanks.
> Anakreon.
>
> ==================================   Sample Code
> ===============================
> void CGfxClassBox::generateIcon(){
>   cout<<"Data for class:"<<m_class->name<<endl;
>   addMembers(MODE_PRIVATE,
>              m_class->attributeIterator);
>   addMembers(MODE_PROTECTED,
>              m_class->attributeIterator);
>   addMembers(MODE_PUBLIC,
>              m_class->attributeIterator);
>   addMembers(MODE_PRIVATE,
>              (QListIterator<CParsedAttribute>&)m_class->methodIterator);
>   addMembers(MODE_PROTECTED,
>              (QListIterator<CParsedAttribute>&)m_class->methodIterator);
>   addMembers(MODE_PUBLIC,
>              (QListIterator<CParsedAttribute>&)m_class->methodIterator);
>   addMembers(MODE_PRIVATE,
>              (QListIterator<CParsedAttribute>&)m_class->slotIterator);
>   addMembers(MODE_PROTECTED,
>              (QListIterator<CParsedAttribute>&)m_class->slotIterator);
>   addMembers(MODE_PUBLIC,
>              (QListIterator<CParsedAttribute>&)m_class->slotIterator);
>   addMembers(MODE_IGNORE,
>              (QListIterator<CParsedAttribute>&)m_class->signalIterator);
> }
>
>
> /**
>  * This method intended to add all attributes toString() method result in
> QStringList.
>  * After that it would make some painting.
>  * However all the elements of the QList seems to be NULL.
>  * The QList is not empty.Just all the elements are NULL.
>  * I wonder if is my fault this happens or the QList<CClassTreeNode>*
> passed at GfxClassTreeWindow
>  * containes only the names of the classes and nothing more.
>  */
> void CGfxClassBox::addMembers(int mode,QListIterator<CParsedAttribute>&
> iterator){
>   QStringList attrHolder;
>   QString     currentAtribute;
>   for(uint i=0;i<iterator.count();i++){
>     if(iterator.current()==0){                                  //Allways
> is NULL.Why???
>       cout<<"current for index:"<<i<<" is NULL"<<endl;
>       ++iterator;
>        continue;
>     }
>   ..........Here does other things.........
>
> ============================= End of Sample code
> ===========================

-
to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop-devel mailing list