umbrello API Documentation

classimport.cpp

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *  copyright (C) 2006                                                     *
00009  *  Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                   *
00010  ***************************************************************************/
00011 
00012 // own header
00013 #include "classimport.h"
00014 // qt/kde includes
00015 #include <qregexp.h>
00016 #include <klocale.h>
00017 // app includes
00018 #include "../umldoc.h"
00019 #include "../uml.h"
00020 #include "idlimport.h"
00021 #include "pythonimport.h"
00022 #include "javaimport.h"
00023 #include "adaimport.h"
00024 #include "pascalimport.h"
00025 #include "cppimport.h"
00026 
00027 void ClassImport::importFiles(const QStringList &fileList) {
00028     initialize();
00029     UMLDoc *umldoc = UMLApp::app()->getDocument();
00030     uint processedFilesCount = 0;
00031     for (QStringList::const_iterator fileIT = fileList.begin();
00032             fileIT != fileList.end(); ++fileIT) {
00033         QString fileName = (*fileIT);
00034         umldoc->writeToStatusBar(i18n("Importing file: %1 Progress: %2/%3").
00035                                  arg(fileName).arg(processedFilesCount).arg(fileList.size()));
00036         parseFile(fileName);
00037         processedFilesCount++;
00038     }
00039     umldoc->writeToStatusBar(i18n("Ready."));
00040 }
00041 
00042 ClassImport *ClassImport::createImporterByFileExt(const QString &filename) {
00043     ClassImport *classImporter;
00044     if (filename.endsWith(".idl"))
00045         classImporter = new IDLImport();
00046     else if (filename.endsWith(".py"))
00047         classImporter = new PythonImport();
00048     else if (filename.endsWith(".java"))
00049         classImporter = new JavaImport();
00050     else if (filename.contains( QRegExp("\\.ad[sba]$") ))
00051         classImporter = new AdaImport();
00052     else if (filename.endsWith(".pas"))
00053         classImporter = new PascalImport();
00054     else
00055         classImporter = new CppImport();  // the default.
00056     return classImporter;
00057 }
00058 
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:55 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003