Graphical Class View
Mejdi Anakreon
amejdi at i.singular.gr
Wed Jul 25 07:46:50 UTC 2001
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 ===========================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfxClassBox.zip
Type: application/octet-stream
Size: 5520 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20010725/7c04ef3d/attachment.obj>
More information about the KDevelop-devel
mailing list