[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: weird code :-(
From: Aurélien_Gâteau <aurelien.gateau () mail ! dotcom ! fr>
Date: 2002-09-10 14:20:54
[Download RAW message or body]
tech@bishop.dhs.org wrote:
> Maybe it's just too late (and I'm going to bed after sending this) but I
> just can't figure out what in the heck this code is supposed to do.
> Normally I'd ask the original author, but they dropped support for it
> (TheKompany's KDEStudio*) :-(
>
> As far as I can tell by how it's used, this routine is *supposed* to
> get a list of all libraries used by this project (to help in creating
> the Makefile.am).
>
> void Workspace::getAllLibrary( QStrList& list )
> {
> if ( getType() == SHARED_LIB || getType() == STATIC_LIB ) list.append( name );
>
> QStrList sub;
> wConfig->setGroup( configPath );
> wConfig->readListEntry( "Group", sub );
> for ( uint k = 0; k < sub.count(); k++ )
> {
> Workspace* ws = new Workspace( this, sub.at( sub.count() - 1 - k) );
> ws->getAllLibrary( list );
> delete ws;
> }
> }
>
> How it's actually used:
> 1st layer
> mainWorkspace->getAllProjectLibrary( prjLib );
> 2nd (in a .h)
> void getAllProjectLibrary( QStrList& list ){ getAllLibrary( list ); }
> 3rd is above
>
> Explanation of function calls and objects:
>
> wConfig is a KSimpleConfig object. "Group" seems to contain just the
> name of the "Project" (i.e., Project "Foo" with several shared libs and
> executables contained within it). getType() returns what kind of project
> it is you're making, and in the case that I'm testing, is EXECUTABLE.
>
> My immediate question is: why create an object, call the same function,
> and then delete the object? AFAICT, that for loop is the only thing
> that *does* anything, and even at that, nothing important! Does anyone
> see someplace that an actual assignment might be taking place, that I'm
> missing? Recursion is fine, but there has to be results.
I guess KDE Studio supports workspaces in workspaces : thus this append the
names of the current workspace to the list if this workspace is a library,
then instantiates all sub-workspaces and call getAllLibrary on them so that
they can append their names to the list if necessary.
>
> My second is: why have the "middle" class? Why wouldn't they just go
> straight from the first layer to the third?
Sorry, I don't understand what you mean by "middle" class :'(
Regards,
Aurélien
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic