[KDev4] let's clearify VCS interfaces

dukju ahn dukjuahn at gmail.com
Sun Apr 1 11:15:58 UTC 2007


2007/4/1, Andreas Pakulat <apaku at gmx.de>:
> On 01.04.07 02:20:16, dukju ahn wrote:
> > Current VCS interface is good but IMHO needs some modifications.
> >
> > 1. Use QMap instead of QList for VcsFileInfo
>
> Why? The VcsFileInfo class already contains the url

Yes, but it QMap is more efficient to get the specific items.
If we have only QList, we should iterate all over the list.

> > 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?

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?

> > 2. Allow statusSync() and statusASync() to be called on file.
> >
> > Currently, the argument to these method is KUrl &dirPath.
> > To retrieve the status of one file, one should find file's parent path
> > But it would be efficient if the caller can specify filename directly.
>
> But then 1. is totally bogus, because if you want to know the status of
> a specific file you can use this overload.

OK. I agree that.


> > 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);
}




More information about the KDevelop-devel mailing list