CClassStore little patch
Pau Estalella Fernandez
pef at upcnet.upc.es
Sun Aug 1 15:30:40 BST 1999
Hi all.
What a great piece of work! :) Working a bit with it I found a few
things:
* CClassStore
Playing with ClassWizard I found it doesn't manage virtual methods
properly (I know its
not functional yet). The problem is that it doesn't show indirectly
inherited virtual methods. When I
went through the code I saw that in last term it gets the virtual
methods from CClassStore::getVirtualMethodsForClass, and this method
just looks for the virtual methods
declared in the parents, but not the virtual methods inherited by them.
I made a few modifications
and here is the result. Anybody could check it is correct?
void CClassStore::getVirtualMethodsForClass( const char *aName,
QList<CParsedMethod>
*implList,
QList<CParsedMethod>
*availList )
{
CParsedClass *aClass;
CParsedParent *aParent;
CParsedClass *parentClass;
// Deleted by pestale QList<CParsedMethod> *list;
// Added by pestale
QList<CParsedMethod> alist, ilist;
CParsedMethod *aMethod;
QDict<char> added;
QString str;
// Start by reseting the lists.
implList->setAutoDelete( false );
availList->setAutoDelete( false );
implList->clear();
availList->clear();
// Try to fetch the class
aClass = getClassByName( aName );
if( aClass != NULL )
{
// Iterate over all parents.
for( aParent = aClass->parents.first();
aParent != NULL;
aParent = aClass->parents.next() )
{
// Try to fetch the parent.
parentClass = getClassByName( aParent->name );
if( parentClass != NULL )
{
// Deleted by pestale list = parentClass->getVirtualMethodList();
// Added by pestale
getVirtualMethodsForClass(aParent->name, &ilist, &alist);
// Deleted by pestale for( aMethod = list->first();
// Deleted by pestale aMethod != NULL;
// Deleted by pestale aMethod = list->next() )
for( aMethod = alist.first();
aMethod != NULL;
aMethod = alist.next() )
{
// Check if we already have the method.
if( aClass->getMethod( *aMethod ) != NULL )
{
implList->append( aMethod );
added.insert( aMethod->asString( str ), "" );
}
else
availList->append( aMethod );
}
// Deleted by pestale delete list;
}
}
// Add all virtual methods defined in THIS class.
for( aClass->methodIterator.toFirst();
aClass->methodIterator.current();
++aClass->methodIterator )
{
aMethod = aClass->methodIterator.current();
if( aMethod->isVirtual &&
added.find( aMethod->asString( str ) ) == NULL )
{
availList->append( aMethod );
}
}
}
}
* hide(false) ----> hide/show .code generator
Trying to generate source code for dialog (yep, not functional too) the
compiler complained about the code generated (hide() doesn't take
parameters) so I decided to modify KDevelop a bit
atKDlgEdit::generateCommon. Anybody can check this?
if(props->getPropValue("IsHidden") != "")
{
if(props->getPropValue("IsHidden") == "true")
{
props->dumpPropCall(stream, "hide", "");
}
else
{
props->dumpPropCall(stream, "show", "");
}
}
// Deleted by pestale props->dumpBoolPropCall(stream, "hide",
"IsHidden", false);
* pure virtual methods
There should be a way to add pure virtual methods (maybe another
option in the "Add member function" dialog?). Give no implementation for
these methods. :)
That's all!
-- Pau Estalella --
pau.estalella at upcnet.upc.es
More information about the KDevelop
mailing list