qtecomplugins/xqplugins/inc/xqpluginloaderprivate.h
changeset 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:  Private plugin loader implementation
       
    19 *
       
    20 */
       
    21 
       
    22 #ifndef QPLUGINLOADER2PRIVATE_H
       
    23 #define QPLUGINLOADER2PRIVATE_H
       
    24 
       
    25 #include <QObject>
       
    26 #include <QString>
       
    27 #include <QList>
       
    28 #include <QtGlobal>
       
    29 #include <QLibrary>
       
    30 #include <QSettings>
       
    31 
       
    32 //Incudes
       
    33 #include <ecom/implementationinformation.h>
       
    34 #include <ecom/ecom.h>
       
    35 
       
    36 //Forward class declaration
       
    37 class XQPluginInfo;
       
    38 
       
    39 //Class declaration
       
    40 class XQPluginLoaderPrivate
       
    41 {
       
    42 public:
       
    43     int pHnd;
       
    44 
       
    45     QString fileName;
       
    46     const int uid;
       
    47     bool loadPlugin(); 
       
    48     bool unload();
       
    49     void release();
       
    50 
       
    51     static XQPluginLoaderPrivate *findOrCreate(const QString &fileName, const QString &version = QString());
       
    52     static XQPluginLoaderPrivate *findOrCreate(int, const QString &version = QString());
       
    53 
       
    54     QString errorString;
       
    55     QLibrary::LoadHints loadHints;
       
    56 
       
    57     bool isPlugin(QSettings *settings = 0);
       
    58 
       
    59     QObject* instance();
       
    60 
       
    61     /**
       
    62      * Function retrive plugin description information from ECom framework
       
    63      * @param infoArr - plugins description array
       
    64      *                  ( definition from ECom framework )
       
    65      * @param interfaceName - reqursted plugin interface name
       
    66      * @param impls - list of plugin descrpions. plugins implement requested 
       
    67      *                interface 
       
    68      */ 
       
    69     static void listImplementationsL( 
       
    70             RImplInfoPtrArray& infoArr, 
       
    71             const QString &interfaceName, 
       
    72             QList<XQPluginInfo> &impls);
       
    73     
       
    74 private:
       
    75     XQPluginLoaderPrivate( int uid, const QString &version= QString() );
       
    76     ~XQPluginLoaderPrivate();
       
    77     
       
    78     void loadL();
       
    79     static void findOrCreateL( XQPluginLoaderPrivate*& pluginLoader, const QString &fileName, const QString &version );
       
    80     void setFileName(const QString& fileName);
       
    81     QObject* pluginInstance;
       
    82     
       
    83     QAtomicInt loaderRefCount;
       
    84     QAtomicInt loaderUnloadCount;    
       
    85     
       
    86 };
       
    87 
       
    88 #endif // QPLUGINLOADER2PRIVATE_H