[Uml-devel] branches/KDE/3.5/kdesdk/umbrello
JP Fournier
jfournier121 at rogers.com
Sun Aug 6 21:06:08 UTC 2006
Oliver Kellogg wrote:
>SVN commit 570457 by okellogg:
>
>Attachment 17246 from JP Fournier adds logic to keep track of files already
>parsed to avoid gratuitous reparsing.
>JP, I've added you as co-author to the javaimport.h, hope that's okay :)
>BUG:131961
>
>
>
No concerns on my end, but I am only tweaking. Also, thanks for
applying my patches
so quickly. It definitely encourages me to try to contribute more.
Will the patch below work as is? Unless I'm misunderstanding things,
m_parseDepth and
m_FilesAlreadyParsed are not static, which I think means that when we
spawn off another
instance of JavaImport to resolve any other types we run into, we get a
new empty
instances of these member vars, so we'll reparse files we already parsed
- or am I
missing something?
regards
jp
> M +1 -0 ChangeLog
> M +12 -5 umbrello/codeimport/javaimport.cpp
> M +13 -0 umbrello/codeimport/javaimport.h
>
>
>--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #570456:570457
>@@ -5,6 +5,7 @@
> instead of public (131327)
> * Python code generation not independent of diagram view (131790)
> * Java import - method parameter types not resolved correctly (131825)
>+* Java import: unable to import AzareusCore (131961)
>
> Version 1.5.4
>
>--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #570456:570457
>@@ -38,6 +38,7 @@
> }
>
> void JavaImport::initVars() {
>+ m_parseDepth = 0;
> m_isStatic = false;
> }
>
>@@ -130,19 +131,18 @@
>
> ///Spawn off an import of the specifed file
> void JavaImport::spawnImport( QString file ) {
>- static QStringList filesBeingParsed;
> // if the file is being parsed, don't bother
> //
>- if (filesBeingParsed.contains( file ) ) {
>+ if (m_filesAlreadyParsed.contains( file ) ) {
> return;
> }
> if (QFile::exists(file)) {
> JavaImport importer;
> QStringList fileList;
> fileList.append( file );
>- filesBeingParsed.append( file );
>+ m_filesAlreadyParsed.append( file );
> importer.importFiles( fileList );
>- filesBeingParsed.remove( file );
>+
> }
> }
>
>@@ -233,8 +233,15 @@
> // public for member vars and methods
> m_defaultCurrentAccess = Uml::Visibility::Implementation;
> m_currentAccess = m_defaultCurrentAccess;
>-
>+ m_parseDepth++;
> NativeImportBase::parseFile(filename);
>+ m_parseDepth--;
>+ if ( m_parseDepth <= 0 ) {
>+ // if the user decides to clear things out and reparse, we need
>+ // to honour the request, so reset things for next time.
>+ m_filesAlreadyParsed.clear();
>+ m_parseDepth = 0;
>+ }
> }
>
>
>--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.h #570456:570457
>@@ -18,6 +18,7 @@
> /**
> * Java code import
> * @author Oliver Kellogg
>+ * @author JP Fournier
> * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
> */
> class JavaImport : public NativeImportBase {
>@@ -86,6 +87,18 @@
> QStringList m_imports;
>
> /**
>+ * Keep track of the files we have already parsed so we don't
>+ * reparse the same ones over and over again.
>+ */
>+ QStringList m_filesAlreadyParsed;
>+
>+ /**
>+ * Keep track of the parses so that the filesAlreadyParsed
>+ * can be reset when we're done.
>+ */
>+ int m_parseDepth;
>+
>+ /**
> * The current visibility for when the visibility is absent
> */
> Uml::Visibility m_defaultCurrentAccess;
>
>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share your
>opinions on IT & business topics through brief surveys -- and earn cash
>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>_______________________________________________
>Uml-devel mailing list
>umbrello-devel at kde.org
>https://mail.kde.org/mailman/listinfo/umbrello-devel
>
>
>
More information about the umbrello-devel
mailing list