qtecomplugins/xqplugins/inc/xqpluginloaderprivate.h
branchRCL_3
changeset 9 5d007b20cfd0
equal deleted inserted replaced
8:885c2596c964 9:5d007b20cfd0
       
     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's 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 #include <ecom/implementationinformation.h>
       
    33 #include <ecom/ecom.h>
       
    34 
       
    35 class XQPluginInfo;
       
    36 
       
    37 class XQPluginLoaderPrivate
       
    38 {
       
    39 public:
       
    40     int pHnd;
       
    41 
       
    42     QString fileName;
       
    43     const int uid;
       
    44     bool loadPlugin(); 
       
    45     bool unload();
       
    46     void release();
       
    47 
       
    48     static XQPluginLoaderPrivate *findOrCreate(const QString &fileName, const QString &version = QString());
       
    49     static XQPluginLoaderPrivate *findOrCreate(int, const QString &version = QString());
       
    50 
       
    51     QString errorString;
       
    52     QLibrary::LoadHints loadHints;
       
    53 
       
    54     bool isPlugin(QSettings *settings = 0);
       
    55 
       
    56     QObject* instance();
       
    57 
       
    58     /**
       
    59      * Function retrive plugin description information from ECom framework
       
    60      * @param infoArr - plugins description array
       
    61      *                  ( definition from ECom framework )
       
    62      * @param interfaceName - reqursted plugin interface name
       
    63      * @param impls - list of plugin descrpions. plugins implement requested 
       
    64      *                interface 
       
    65      */ 
       
    66     static void listImplementationsL( 
       
    67             RImplInfoPtrArray& infoArr, 
       
    68             const QString &interfaceName, 
       
    69             QList<XQPluginInfo> &impls);
       
    70     
       
    71 private:
       
    72     XQPluginLoaderPrivate( int uid, const QString &version= QString() );
       
    73     ~XQPluginLoaderPrivate();
       
    74     
       
    75     void loadL();
       
    76     static void findOrCreateL( XQPluginLoaderPrivate*& pluginLoader, const QString &fileName, const QString &version );
       
    77     void setFileName(const QString& fileName);
       
    78     QObject* pluginInstance;
       
    79     
       
    80     QAtomicInt loaderRefCount;
       
    81     QAtomicInt loaderUnloadCount;    
       
    82     
       
    83 };
       
    84 
       
    85 #endif // QPLUGINLOADER2PRIVATE_H