tools/icheck/ichecklib.cpp
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include "ichecklib.h"
       
    43 #include "parsemanager.h"
       
    44 #include <QtCore/QCoreApplication>
       
    45 #include <QString>
       
    46 #include <QStringList>
       
    47 #include <iostream>
       
    48 #include <QDebug>
       
    49 #include <QDir>
       
    50 #include <QFile>
       
    51 #include <QFileInfo>
       
    52 #include <QProcess>
       
    53 #include <QLibraryInfo>
       
    54 
       
    55 QT_USE_NAMESPACE
       
    56 
       
    57 QStringList getQTIncludePath()
       
    58 {
       
    59     QStringList ret;
       
    60     QString qtpath = QLibraryInfo::location(QLibraryInfo::HeadersPath);
       
    61 
       
    62     ret << qtpath;
       
    63     ret << qtpath + "/ActiveQt";
       
    64     ret << qtpath + "/phonon";
       
    65     ret << qtpath + "/phonon_compat";
       
    66     ret << qtpath + "/Qt";
       
    67     ret << qtpath + "/Qt3Support";
       
    68     ret << qtpath + "/QtAssistant";
       
    69     ret << qtpath + "/QtCore";
       
    70     ret << qtpath + "/QtDBus";
       
    71     ret << qtpath + "/QtDeclarative";
       
    72     ret << qtpath + "/QtDesigner";
       
    73     ret << qtpath + "/QtGui";
       
    74     ret << qtpath + "/QtHelp";
       
    75     ret << qtpath + "/QtMultimedia";
       
    76     ret << qtpath + "/QtNetwork";
       
    77     ret << qtpath + "/QtOpenGL";
       
    78     ret << qtpath + "/QtOpenVG";
       
    79     ret << qtpath + "/QtScript";
       
    80     ret << qtpath + "/QtScriptTools";
       
    81     ret << qtpath + "/QtSql";
       
    82     ret << qtpath + "/QtSvg";
       
    83     ret << qtpath + "/QtTest";
       
    84     ret << qtpath + "/QtUiTools";
       
    85     ret << qtpath + "/QtWebKit";
       
    86     ret << qtpath + "/QtXml";
       
    87     ret << qtpath + "/QtXmlPatterns";
       
    88 
       
    89     return ret;
       
    90 }
       
    91 
       
    92 ICheckLib::ICheckLib()
       
    93 : pParseManager(0)
       
    94 {
       
    95 }
       
    96 
       
    97 void ICheckLib::ParseHeader(const QStringList& includePath, const QStringList& filelist)
       
    98 {
       
    99     if(pParseManager)
       
   100         delete pParseManager;
       
   101     pParseManager = 0;
       
   102     pParseManager = new CPlusPlus::ParseManager();
       
   103     pParseManager->setIncludePath(includePath);
       
   104     pParseManager->parse(filelist);
       
   105 }
       
   106 
       
   107 bool ICheckLib::check(const ICheckLib& ichecklib /*ICheckLib from interface header*/, QString outputfile)
       
   108 {
       
   109     if(pParseManager){
       
   110         CPlusPlus::ParseManager* cpparsemanager = ichecklib.pParseManager;
       
   111         return pParseManager->checkAllMetadatas(cpparsemanager, outputfile);
       
   112     }
       
   113     return false;
       
   114 }
       
   115 
       
   116 QStringList ICheckLib::getErrorMsg()
       
   117 {
       
   118     QStringList ret;
       
   119     if(pParseManager){
       
   120         ret.append(pParseManager->getErrorMsg());
       
   121     }
       
   122     else
       
   123         ret << "no file was parsed.";
       
   124     return ret;
       
   125 }