IProjectFileManager::import and parse

Andreas Pakulat apaku at gmx.de
Fri Jun 22 09:12:03 UTC 2007


On 22.06.07 09:16:33, Andras Mantia wrote:
> On Friday 22 June 2007, Andreas Pakulat wrote:
> > Uhm, you can easily create the whole structure in your item and then
> > just use the given item to return the sub-folders. I don't see why
> > you'd need to reparse every time.
> Sure, but in that case the same information (the layout of files and 
> folders of a project) would be stored twice:
> - in my data structure which is read somewhere in the import phase and 
> used as a base for "parsing"
> - in the Project*Item objects

Yes, for project types that purely use the directory/file layout for the
treeview this is right. However quite not all project types have this.
Also if you look at the genericprojectmanager in kdevplatform it doesn't
store anything at all, it just selects all files/folders. So maybe
instead of storing the long list of files that belong to a project, how
about storing (and attaching to the folder items) only which subentries
do _not_ belong to the project?

> > > 2) Is there a real need to "parse" for anything else than the top
> > > level item? Of course now it is, due to the code in
> > > ImportProjectJob::start, but I don't see any other need for it. The
> > > project file manager plugin should read only once the project file:
> > > when the project is loaded. If there is a need for a list of
> > > files/folders under one folder, this list should (and can) be
> > > obtained from the Project*Item tree structure.
> >
> > Uhm, this is also the interface for the buildsystem managers and
> > these have multiple files in multiple dirs to parse.
> 
> Sure, most projects have multiple files and multiple directories. ;)

Thats not what I meant. I meant that a buildsystem needs to _parse_
different files in different directories all over the project subtree.

> But this still doesn't answer the question is parse can be called
> later on as well, or it is only used to initially read the project. It
> is important if I do the above "caching" of the project layout, do I
> need to keep it until the project is cached?

parse() is called whenever a certain subtree of a project wasn't parsed
yet. After parse() finished a project*item exists and the
project*item carries all information needed for further usage (including
any data structures you created)

Andreas

-- 
Good news.  Ten weeks from Friday will be a pretty good day.




More information about the KDevelop-devel mailing list