[KDev4] let's clearify VCS interfaces

Andreas Pakulat apaku at gmx.de
Sun Apr 1 11:30:37 UTC 2007


On 01.04.07 04:15:58, dukju ahn wrote:
> 2007/4/1, Andreas Pakulat <apaku at gmx.de>:
> > On 01.04.07 02:20:16, dukju ahn wrote:
> > > Currently statusSync() and statusASync() both return QList<VcsFileInfo>
> > > But what is the purpose of these methods? It is to retrieve any file/dir's
> > > status easily. If we only have QList, we should iterate all the way
> > > to retrieve some specific file/dir's status
> >
> > Well, I'd like to see if we can remove that class completely, because it
> > makes our interface not an abstract interface anymore, but a real class.
> 
> Do you mean VcsFileInfo? Rather than removing, we can make getters/setters
> pure virtual. Without this class, how can we represent the file/dir status?

I don't know yet, I haven't though about this yet.

> But one special case is static state2string(). I think we will
> need coherent string that describes the status.
> So, Is it possible to have a vertual class with inline static method?

No, inlines are bad for keeping BC, thats why I moved all the code into
a .cpp. 

> > > 3. Don't return reference which is Out-Of-Bound.
> >
> > What do you mean, out-of-bounds?
> 
> QMap& KSomeClass::getMap()
> {
>       QMap map;
>       map.insert(xxxx);
>       return map;
> }
> This is what I meant. The returned reference is invalid because it
> is destroyed after the function returns.
>
> Below is correct.
> void KSomeClass::getMap( QMap &map )
> {
>     map.insert(xxx);
> }

Well, we can make it QMap& KSomeClass::getMap() with this:

return QMap(map);

Because then the returned reference won't be destroyed but still contain
a copy of the map. You know I don't like parameters like QMap& too much,
unless they're really needed. It can easily be confused with const QMap&
and people will wonder what the parameter is supposed to do...

Andreas

-- 
You may get an opportunity for advancement today.  Watch it!




More information about the KDevelop-devel mailing list