Sascha Zelzer пре 14 година
родитељ
комит
98b4e6965d

+ 153 - 152
Libs/PluginFramework/ctkPluginArchive_p.h

@@ -36,172 +36,173 @@ class QIODevice;
 class ctkPluginStorage;
 
 /**
-* Class for managing plugin data.
-*
-*/
-class ctkPluginArchive {
+ * Class for managing plugin data.
+ *
+ */
+class ctkPluginArchive
+{
 
 public:
 
-/**
- * Autostart setting stopped.
- * @see PluginArchiveInterface#setAutostartSetting(const QString&)
- */
-static const QString AUTOSTART_SETTING_STOPPED; // = "stopped"
+  /**
+   * Autostart setting stopped.
+   * @see PluginArchiveInterface#setAutostartSetting(const QString&)
+   */
+  static const QString AUTOSTART_SETTING_STOPPED; // = "stopped"
 
-/**
- * Autostart setting eager.
- * @see PluginArchiveInterface#setAutostartSetting(const QString&)
- */
-static const QString AUTOSTART_SETTING_EAGER; // = "eager"
+  /**
+   * Autostart setting eager.
+   * @see PluginArchiveInterface#setAutostartSetting(const QString&)
+   */
+  static const QString AUTOSTART_SETTING_EAGER; // = "eager"
 
-/**
- * Autostart setting declared activation policy.
- * @see PluginArchiveInterface#setAutostartSetting(const QString&)
- */
-static const QString AUTOSTART_SETTING_ACTIVATION_POLICY; // = "activation_policy"
+  /**
+   * Autostart setting declared activation policy.
+   * @see PluginArchiveInterface#setAutostartSetting(const QString&)
+   */
+  static const QString AUTOSTART_SETTING_ACTIVATION_POLICY; // = "activation_policy"
 
 private:
 
-int autostartSetting;
-int id;
-QDateTime lastModified;
-QUrl location;
-QString localPluginPath;
-ctkPluginManifest manifest;
-ctkPluginStorage* storage;
+  int autostartSetting;
+  int id;
+  QDateTime lastModified;
+  QUrl location;
+  QString localPluginPath;
+  ctkPluginManifest manifest;
+  ctkPluginStorage* storage;
 
 public:
 
-/**
- * Construct new plugin archive.
- *
- */
-ctkPluginArchive(ctkPluginStorage* pluginStorage, const QUrl& pluginLocation,
-	      const QString& localPluginPath, int pluginId);
-
-/**
- * Get an attribute from the manifest of a plugin.
- *
- * Not localized
- *
- * @param key Name of attribute to get.
- * @return A string with result or null if the entry doesn't exists.
- */
-QString getAttribute(const QString& key) const;
-
-/**
- * @returns the (raw/unlocalized) attributes
- */
-QHash<QString,QString> getUnlocalizedAttributes() const;
-
+  /**
+   * Construct new plugin archive.
+   *
+   */
+  ctkPluginArchive(ctkPluginStorage* pluginStorage, const QUrl& pluginLocation,
+                   const QString& localPluginPath, int pluginId);
+
+  /**
+   * Get an attribute from the manifest of a plugin.
+   *
+   * Not localized
+   *
+   * @param key Name of attribute to get.
+   * @return A string with result or null if the entry doesn't exists.
+   */
+  QString getAttribute(const QString& key) const;
+
+  /**
+   * @returns the (raw/unlocalized) attributes
+   */
+  QHash<QString,QString> getUnlocalizedAttributes() const;
+
+
+  /**
+   * Get plugin identifier for this plugin archive.
+   *
+   * @return ctkPlugin identifier.
+   */
+  int getPluginId() const;
+
+
+  /**
+   * Get plugin location for this plugin archive.
+   *
+   * @return Bundle location.
+   */
+  QUrl getPluginLocation() const;
+
+  /**
+   * Get the path to the plugin library on the local
+   * file system
+   *
+   * @return Path to the plugin library
+   */
+  QString getLibLocation() const;
+
+
+  /**
+   * Get a Qt resource as a byte array from a plugin. The resource
+   * is cached and may be aquired even if the plugin is not active.
+   *
+   * @param component Resource to get the byte array from.
+   * @return QByteArray to the entry (empty if it doesn't exist).
+   */
+  QByteArray getPluginResource(const QString& component) const;
+
+
+  /**
+   * Returns a QStringList of all the paths
+   * to entries within the plugin whose longest sub-path matches the supplied
+   * path argument.
+   *
+   * @param name
+   * @return
+   */
+  QStringList findResourcesPath(const QString& path) const;
+
+
+  /**
+   * Get stored plugin start level.
+   */
+  int getStartLevel() const;
+
+
+  /**
+   * Set stored plugin start level.
+   */
+  void setStartLevel(int level);
+
+
+  /**
+   * Get last modified timestamp.
+   */
+  QDateTime getLastModified() const;
+
+
+  /**
+   * Set stored last modified timestamp.
+   */
+  void setLastModified(const QDateTime& timemillisecs);
+
+
+  /**
+   * Get auto-start setting.
+   *
+   * @return the autostart setting. "-1" if the plugin is not started.
+   */
+  int getAutostartSetting() const;
+
+
+  /**
+   * Set the auto-start setting.
+   *
+   * @param setting the autostart setting to use.
+   */
+  void setAutostartSetting(int setting);
+
+
+  /**
+   * Get certificate chains associated with a plugin.
+   *
+   * @param onlyTrusted Only return trusted certificates.
+   * @return All certificates or null if bundle is unsigned.
+   */
+  //QList<> getCertificateChains(bool onlyTrusted) const;
 
-/**
- * Get plugin identifier for this plugin archive.
- *
- * @return ctkPlugin identifier.
- */
-int getPluginId() const;
-
-
-/**
- * Get plugin location for this plugin archive.
- *
- * @return Bundle location.
- */
-QUrl getPluginLocation() const;
-
- /**
-  * Get the path to the plugin library on the local
-  * file system
-  *
-  * @return Path to the plugin library
-  */
- QString getLibLocation() const;
-
-
-/**
- * Get a Qt resource as a byte array from a plugin. The resource
- * is cached and may be aquired even if the plugin is not active.
- *
- * @param component Resource to get the byte array from.
- * @return QByteArray to the entry (empty if it doesn't exist).
- */
-QByteArray getPluginResource(const QString& component) const;
-
-
-/**
- * Returns a QStringList of all the paths
- * to entries within the plugin whose longest sub-path matches the supplied
- * path argument.
- *
- * @param name
- * @return
- */
-QStringList findResourcesPath(const QString& path) const;
 
+  /**
+   * Mark certificate associated with the plugin as trusted.
+   *
+   */
+  //void trustCertificateChain(QList<> trustedChain);
 
-/**
- * Get stored plugin start level.
- */
-int getStartLevel() const;
-
-
-/**
- * Set stored plugin start level.
- */
-void setStartLevel(int level);
-
-
-/**
- * Get last modified timestamp.
- */
-QDateTime getLastModified() const;
-
-
-/**
- * Set stored last modified timestamp.
- */
-void setLastModified(const QDateTime& timemillisecs);
-
-
-/**
- * Get auto-start setting.
- *
- * @return the autostart setting. "-1" if the plugin is not started.
- */
-int getAutostartSetting() const;
-
-
-/**
- * Set the auto-start setting.
- *
- * @param setting the autostart setting to use.
- */
-void setAutostartSetting(int setting);
-
-
-/**
- * Get certificate chains associated with a plugin.
- *
- * @param onlyTrusted Only return trusted certificates.
- * @return All certificates or null if bundle is unsigned.
- */
-//QList<> getCertificateChains(bool onlyTrusted) const;
-
-
-/**
- * Mark certificate associated with the plugin as trusted.
- *
- */
-//void trustCertificateChain(QList<> trustedChain);
-
-
-/**
- * Remove plugin from persistent storage.
- * This will delete the current ctkPluginArchive instance.
- */
-void purge();
+
+  /**
+   * Remove plugin from persistent storage.
+   * This will delete the current ctkPluginArchive instance.
+   */
+  void purge();
 
 };
 

Разлика између датотеке није приказан због своје велике величине
+ 500 - 501
Libs/PluginFramework/ctkPluginContext.h


+ 2 - 1
Libs/PluginFramework/ctkPluginDatabase_p.h

@@ -29,7 +29,8 @@
 class ctkPluginStorage;
 class ctkPluginArchive;
 
-class ctkPluginDatabase {
+class ctkPluginDatabase
+{
 
 public:
 

+ 2 - 1
Libs/PluginFramework/ctkPluginFrameworkContext_p.h

@@ -36,7 +36,8 @@ class ctkPlugin;
 class ctkPluginStorage;
 class ctkServices;
 
-class ctkPluginFrameworkContext {
+class ctkPluginFrameworkContext
+{
 
 public:
 

+ 12 - 13
Libs/PluginFramework/ctkPluginFrameworkFactory.cpp

@@ -24,20 +24,19 @@
 #include "ctkPluginFrameworkContext_p.h"
 
 
-  ctkPluginFrameworkFactory::ctkPluginFrameworkFactory(const ctkProperties& initProps)
-    : fwCtx(new ctkPluginFrameworkContext(initProps))
-  {
+ctkPluginFrameworkFactory::ctkPluginFrameworkFactory(const ctkProperties& initProps)
+  : fwCtx(new ctkPluginFrameworkContext(initProps))
+{
 
-  }
-
-  ctkPluginFrameworkFactory::~ctkPluginFrameworkFactory()
-  {
-    fwCtx->uninit();
-    delete fwCtx;
-  }
+}
 
-  QSharedPointer<ctkPluginFramework> ctkPluginFrameworkFactory::getFramework()
-  {
-    return fwCtx->systemPlugin;
+ctkPluginFrameworkFactory::~ctkPluginFrameworkFactory()
+{
+  fwCtx->uninit();
+  delete fwCtx;
+}
 
+QSharedPointer<ctkPluginFramework> ctkPluginFrameworkFactory::getFramework()
+{
+  return fwCtx->systemPlugin;
 }

+ 2 - 1
Libs/PluginFramework/ctkPluginFrameworkFactory.h

@@ -37,7 +37,8 @@
   /**
    * A factory for creating ctkPluginFramework instances.
    */
-  class CTK_PLUGINFW_EXPORT ctkPluginFrameworkFactory {
+  class CTK_PLUGINFW_EXPORT ctkPluginFrameworkFactory
+  {
 
   public:
 

+ 15 - 15
Libs/PluginFramework/ctkPluginManifest_p.h

@@ -27,30 +27,30 @@
 class QIODevice;
 
 
-  class ctkPluginManifest
-  {
+class ctkPluginManifest
+{
 
-  public:
+public:
 
-    typedef QHash<QString,QString> Attributes;
+  typedef QHash<QString,QString> Attributes;
 
-    ctkPluginManifest();
-    ctkPluginManifest(const QByteArray& in);
+  ctkPluginManifest();
+  ctkPluginManifest(const QByteArray& in);
 
-    void read(const QByteArray& in);
+  void read(const QByteArray& in);
 
-    Attributes getMainAttributes() const;
-    QString getAttribute(const QString& key) const;
-    Attributes getAttributes(const QString& section) const;
+  Attributes getMainAttributes() const;
+  QString getAttribute(const QString& key) const;
+  Attributes getAttributes(const QString& section) const;
 
-    QStringList getSections() const;
+  QStringList getSections() const;
 
-  private:
+private:
 
-    Attributes mainAttributes;
-    QHash<QString, Attributes> sections;
+  Attributes mainAttributes;
+  QHash<QString, Attributes> sections;
 
-  };
+};
 
 
 #endif // CTKPLUGINMANIFEST_P_H

+ 0 - 1
Libs/PluginFramework/ctkPluginStorage.cpp

@@ -148,5 +148,4 @@ QStringList ctkPluginStorage::findResourcesPath(long pluginId, const QString& pa
     qDebug() << QString("Getting plugin resource paths for %1 failed:").arg(path) << exc;
     return QStringList();
   }
-
 }

+ 105 - 104
Libs/PluginFramework/ctkPluginStorage_p.h

@@ -31,113 +31,114 @@
 class QIODevice;
 
 
-  // CTK class forward declarations
-  class ctkPluginArchive;
-  class ctkPluginFrameworkContext;
+// CTK class forward declarations
+class ctkPluginArchive;
+class ctkPluginFrameworkContext;
+
+/**
+ * Storage of all plugin meta-data and resources
+ */
+class ctkPluginStorage
+{
+
+private:
+
+  QMutex archivesLock;
+
+  /**
+   * ctkPlugin id sorted list of all active plugin archives.
+   */
+  QList<ctkPluginArchive*> archives;
+
+  /**
+   * Framework handle.
+   */
+  ctkPluginFrameworkContext* framework;
+
+  /**
+   * SQLite db caching plug-in metadata and resources
+   */
+  ctkPluginDatabase pluginDatabase;
+
+public:
+
+  /**
+   * Create a container for all plugin data in this framework.
+   * Try to restore all saved plugin archive state.
+   *
+   */
+  ctkPluginStorage(ctkPluginFrameworkContext* framework);
+
+
+  /**
+   * Insert a plugin (shared library) into the persistent storage
+   *
+   * @param location Location of the plugin.
+   * @param localPath Path to the plugin on the local file system
+   * @return ctkPlugin archive object.
+   */
+  ctkPluginArchive* insertPlugin(const QUrl& location, const QString& localPath);
+
 
   /**
-   * Storage of all plugin meta-data and resources
+   * Insert a new plugin (shared library) into the persistent
+   * storagedata as an update
+   * to an existing plugin archive. To commit this data a call to
+   * <code>replacePluginArchive</code> is needed.
+   *
+   * @param old ctkPluginArchive to be replaced.
+   * @param localPath Path to a plugin on the local file system.
+   * @return ctkPlugin archive object.
    */
-  class ctkPluginStorage {
-
-  private:
-
-    QMutex archivesLock;
-
-    /**
-     * ctkPlugin id sorted list of all active plugin archives.
-     */
-    QList<ctkPluginArchive*> archives;
-
-    /**
-     * Framework handle.
-     */
-    ctkPluginFrameworkContext* framework;
-
-    /**
-     * SQLite db caching plug-in metadata and resources
-     */
-    ctkPluginDatabase pluginDatabase;
-
-  public:
-
-    /**
-     * Create a container for all plugin data in this framework.
-     * Try to restore all saved plugin archive state.
-     *
-     */
-    ctkPluginStorage(ctkPluginFrameworkContext* framework);
-
-
-    /**
-     * Insert a plugin (shared library) into the persistent storage
-     *
-     * @param location Location of the plugin.
-     * @param localPath Path to the plugin on the local file system
-     * @return ctkPlugin archive object.
-     */
-    ctkPluginArchive* insertPlugin(const QUrl& location, const QString& localPath);
-
-
-    /**
-     * Insert a new plugin (shared library) into the persistent
-     * storagedata as an update
-     * to an existing plugin archive. To commit this data a call to
-     * <code>replacePluginArchive</code> is needed.
-     *
-     * @param old ctkPluginArchive to be replaced.
-     * @param localPath Path to a plugin on the local file system.
-     * @return ctkPlugin archive object.
-     */
-    ctkPluginArchive* updatePluginArchive(ctkPluginArchive* old, const QString& localPath);
-
-
-    /**
-     * Replace old plugin archive with a new updated plugin archive, that
-     * was created with updatePluginArchive.
-     *
-     * @param oldPA ctkPluginArchive to be replaced.
-     * @param newPA new ctkPluginArchive.
-     */
-    void replacePluginArchive(ctkPluginArchive* oldPA, ctkPluginArchive* newPA);
-
-    /**
-     * Remove plugin archive from archives list and persistent storage.
-     * The plugin archive is deleted and must not be used afterwards, if
-     * this method returns \a true.
-     *
-     * @param pa ctkPlugin archive to remove.
-     * @return true if element was removed.
-     */
-    bool removeArchive(ctkPluginArchive* pa);
-
-
-    /**
-     * Get all plugin archive objects.
-     *
-     * @return QList of all PluginArchives.
-     */
-    QList<ctkPluginArchive*> getAllPluginArchives() const;
-
-
-    /**
-     * Get all plugins to start at next launch of framework.
-     * This list is sorted in increasing plugin id order.
-     *
-     * @return A List with plugin locations.
-     */
-    QList<QString> getStartOnLaunchPlugins();
-
-    QByteArray getPluginResource(long pluginId, const QString& res) const;
-
-    QStringList findResourcesPath(long pluginId, const QString& path) const;
-
-    /**
-     * Close this plugin storage and all bundles in it.
-     */
-    void close();
-
-    ~ctkPluginStorage();
+  ctkPluginArchive* updatePluginArchive(ctkPluginArchive* old, const QString& localPath);
+
+
+  /**
+   * Replace old plugin archive with a new updated plugin archive, that
+   * was created with updatePluginArchive.
+   *
+   * @param oldPA ctkPluginArchive to be replaced.
+   * @param newPA new ctkPluginArchive.
+   */
+  void replacePluginArchive(ctkPluginArchive* oldPA, ctkPluginArchive* newPA);
+
+  /**
+   * Remove plugin archive from archives list and persistent storage.
+   * The plugin archive is deleted and must not be used afterwards, if
+   * this method returns \a true.
+   *
+   * @param pa ctkPlugin archive to remove.
+   * @return true if element was removed.
+   */
+  bool removeArchive(ctkPluginArchive* pa);
+
+
+  /**
+   * Get all plugin archive objects.
+   *
+   * @return QList of all PluginArchives.
+   */
+  QList<ctkPluginArchive*> getAllPluginArchives() const;
+
+
+  /**
+   * Get all plugins to start at next launch of framework.
+   * This list is sorted in increasing plugin id order.
+   *
+   * @return A List with plugin locations.
+   */
+  QList<QString> getStartOnLaunchPlugins();
+
+  QByteArray getPluginResource(long pluginId, const QString& res) const;
+
+  QStringList findResourcesPath(long pluginId, const QString& path) const;
+
+  /**
+   * Close this plugin storage and all bundles in it.
+   */
+  void close();
+
+  ~ctkPluginStorage();
 
 };
 

+ 104 - 104
Libs/PluginFramework/ctkServiceRegistration.h

@@ -29,117 +29,117 @@
 #include "ctkPluginFrameworkExport.h"
 
 
-  class ctkServiceRegistrationPrivate;
+class ctkServiceRegistrationPrivate;
+
+/**
+ * A registered service.
+ *
+ * <p>
+ * The Framework returns a <code>ctkServiceRegistration</code> object when a
+ * <code>ctkPluginContext#registerService()</code> method invocation is successful.
+ * The <code>ctkServiceRegistration</code> object is for the private use of the
+ * registering plugin and should not be shared with other plugins.
+ * <p>
+ * The <code>ctkServiceRegistration</code> object may be used to update the
+ * properties of the service or to unregister the service.
+ *
+ * @see ctkPluginContext#registerService()
+ * @threadsafe
+ */
+class CTK_PLUGINFW_EXPORT ctkServiceRegistration {
+
+  Q_DECLARE_PRIVATE(ctkServiceRegistration)
+
+public:
 
   /**
-   * A registered service.
+   * Returns a <code>ctkServiceReference</code> object for a service being
+   * registered.
+   * <p>
+   * The <code>ctkServiceReference</code> object may be shared with other
+   * plugins.
+   *
+   * @throws std::logic_error If this
+   *         <code>ctkServiceRegistration</code> object has already been
+   *         unregistered.
+   * @return <code>ctkServiceReference</code> object.
+   */
+  ctkServiceReference getReference() const;
+
+  /**
+   * Updates the properties associated with a service.
    *
    * <p>
-   * The Framework returns a <code>ctkServiceRegistration</code> object when a
-   * <code>ctkPluginContext#registerService()</code> method invocation is successful.
-   * The <code>ctkServiceRegistration</code> object is for the private use of the
-   * registering plugin and should not be shared with other plugins.
+   * The {@link ctkPluginConstants#OBJECTCLASS} and {@link ctkPluginConstants#SERVICE_ID} keys
+   * cannot be modified by this method. These values are set by the Framework
+   * when the service is registered in the environment.
+   *
+   * <p>
+   * The following steps are required to modify service properties:
+   * <ol>
+   * <li>The service's properties are replaced with the provided properties.
+   * <li>A service event of type {@link ServiceEvent#MODIFIED} is fired.
+   * </ol>
+   *
+   * @param properties The properties for this service. See {@link ctkPluginConstants}
+   *        for a list of standard service property keys. Changes should not
+   *        be made to this object after calling this method. To update the
+   *        service's properties this method should be called again.
+   *
+   * @throws std::logic_error If this <code>ctkServiceRegistration</code>
+   *         object has already been unregistered.
+   * @throws std::invalid_argument If <code>properties</code> contains
+   *         case variants of the same key name.
+   */
+  void setProperties(const ServiceProperties& properties);
+
+  /**
+   * Unregisters a service. Remove a <code>ctkServiceRegistration</code> object
+   * from the Framework service registry. All <code>ctkServiceReference</code>
+   * objects associated with this <code>ctkServiceRegistration</code> object
+   * can no longer be used to interact with the service once unregistration is
+   * complete.
+   *
    * <p>
-   * The <code>ctkServiceRegistration</code> object may be used to update the
-   * properties of the service or to unregister the service.
+   * The following steps are required to unregister a service:
+   * <ol>
+   * <li>The service is removed from the Framework service registry so that
+   * it can no longer be obtained.
+   * <li>A service event of type {@link ServiceEvent#UNREGISTERING} is fired
+   * so that plugins using this service can release their use of the service.
+   * Once delivery of the service event is complete, the
+   * <code>ctkServiceReference</code> objects for the service may no longer be
+   * used to get a service object for the service.
+   * <li>For each plugin whose use count for this service is greater than
+   * zero: <br>
+   * The plugin's use count for this service is set to zero. <br>
+   * If the service was registered with a {@link ctkServiceFactory} object, the
+   * <code>ctkServiceFactory#ungetService</code> method is called to release
+   * the service object for the plugin.
+   * </ol>
    *
-   * @see ctkPluginContext#registerService()
-   * @threadsafe
+   * @throws std::logic_error If this
+   *         <code>ctkServiceRegistration</code> object has already been
+   *         unregistered.
+   * @see BundleContext#ungetService
+   * @see ctkServiceFactory#ungetService
    */
-  class CTK_PLUGINFW_EXPORT ctkServiceRegistration {
-
-    Q_DECLARE_PRIVATE(ctkServiceRegistration)
-
-  public:
-
-    /**
-     * Returns a <code>ctkServiceReference</code> object for a service being
-     * registered.
-     * <p>
-     * The <code>ctkServiceReference</code> object may be shared with other
-     * plugins.
-     *
-     * @throws std::logic_error If this
-     *         <code>ctkServiceRegistration</code> object has already been
-     *         unregistered.
-     * @return <code>ctkServiceReference</code> object.
-     */
-    ctkServiceReference getReference() const;
-
-    /**
-     * Updates the properties associated with a service.
-     *
-     * <p>
-     * The {@link ctkPluginConstants#OBJECTCLASS} and {@link ctkPluginConstants#SERVICE_ID} keys
-     * cannot be modified by this method. These values are set by the Framework
-     * when the service is registered in the environment.
-     *
-     * <p>
-     * The following steps are required to modify service properties:
-     * <ol>
-     * <li>The service's properties are replaced with the provided properties.
-     * <li>A service event of type {@link ServiceEvent#MODIFIED} is fired.
-     * </ol>
-     *
-     * @param properties The properties for this service. See {@link ctkPluginConstants}
-     *        for a list of standard service property keys. Changes should not
-     *        be made to this object after calling this method. To update the
-     *        service's properties this method should be called again.
-     *
-     * @throws std::logic_error If this <code>ctkServiceRegistration</code>
-     *         object has already been unregistered.
-     * @throws std::invalid_argument If <code>properties</code> contains
-     *         case variants of the same key name.
-     */
-    void setProperties(const ServiceProperties& properties);
-
-    /**
-     * Unregisters a service. Remove a <code>ctkServiceRegistration</code> object
-     * from the Framework service registry. All <code>ctkServiceReference</code>
-     * objects associated with this <code>ctkServiceRegistration</code> object
-     * can no longer be used to interact with the service once unregistration is
-     * complete.
-     *
-     * <p>
-     * The following steps are required to unregister a service:
-     * <ol>
-     * <li>The service is removed from the Framework service registry so that
-     * it can no longer be obtained.
-     * <li>A service event of type {@link ServiceEvent#UNREGISTERING} is fired
-     * so that plugins using this service can release their use of the service.
-     * Once delivery of the service event is complete, the
-     * <code>ctkServiceReference</code> objects for the service may no longer be
-     * used to get a service object for the service.
-     * <li>For each plugin whose use count for this service is greater than
-     * zero: <br>
-     * The plugin's use count for this service is set to zero. <br>
-     * If the service was registered with a {@link ctkServiceFactory} object, the
-     * <code>ctkServiceFactory#ungetService</code> method is called to release
-     * the service object for the plugin.
-     * </ol>
-     *
-     * @throws std::logic_error If this
-     *         <code>ctkServiceRegistration</code> object has already been
-     *         unregistered.
-     * @see BundleContext#ungetService
-     * @see ctkServiceFactory#ungetService
-     */
-    virtual void unregister();
-
-    bool operator<(const ctkServiceRegistration& o) const;
-
-  protected:
-
-    friend class ctkServices;
-
-    ctkServiceRegistration(ctkPluginPrivate* plugin, QObject* service,
-                        const ServiceProperties& props);
-
-    ctkServiceRegistration(ctkServiceRegistrationPrivate& dd);
-
-    const QScopedPointer<ctkServiceRegistrationPrivate> d_ptr;
-
-  };
+  virtual void unregister();
+
+  bool operator<(const ctkServiceRegistration& o) const;
+
+protected:
+
+  friend class ctkServices;
+
+  ctkServiceRegistration(ctkPluginPrivate* plugin, QObject* service,
+                         const ServiceProperties& props);
+
+  ctkServiceRegistration(ctkServiceRegistrationPrivate& dd);
+
+  const QScopedPointer<ctkServiceRegistrationPrivate> d_ptr;
+
+};
 
 
 #endif // CTKSERVICEREGISTRATION_H

+ 30 - 32
Libs/PluginFramework/ctkServices.cpp

@@ -36,53 +36,51 @@
 #include "ctkLDAPExpr_p.h"
 
 
-  using namespace QtMobility;
+using namespace QtMobility;
 
 
-
-  struct ServiceRegistrationComparator
+struct ServiceRegistrationComparator
+{
+  bool operator()(const ctkServiceRegistration* a, const ctkServiceRegistration* b) const
   {
-    bool operator()(const ctkServiceRegistration* a, const ctkServiceRegistration* b) const
-    {
-      return *a < *b;
-    }
-  };
+    return *a < *b;
+  }
+};
 
-  ServiceProperties ctkServices::createServiceProperties(const ServiceProperties& in,
-                                                      const QStringList& classes,
-                                                      long sid)
-  {
-    static qlonglong nextServiceID = 1;
-    ServiceProperties props;
+ServiceProperties ctkServices::createServiceProperties(const ServiceProperties& in,
+                                                       const QStringList& classes,
+                                                       long sid)
+{
+  static qlonglong nextServiceID = 1;
+  ServiceProperties props;
 
-    if (!in.isEmpty())
+  if (!in.isEmpty())
+  {
+    for (ServiceProperties::const_iterator it = in.begin(); it != in.end(); ++it)
     {
-      for (ServiceProperties::const_iterator it = in.begin(); it != in.end(); ++it)
+      const QString key = it.key();
+      const QString lcKey = it.key().toLower();
+      for (QListIterator<QString> i(props.keys()); i.hasNext(); )
       {
-        const QString key = it.key();
-        const QString lcKey = it.key().toLower();
-        for (QListIterator<QString> i(props.keys()); i.hasNext(); )
+        if (lcKey == i.next())
         {
-          if (lcKey == i.next())
-          {
-            throw std::invalid_argument(std::string("Several entries for property: ") + key.toStdString());
-          }
+          throw std::invalid_argument(std::string("Several entries for property: ") + key.toStdString());
         }
-
-        props.insert(lcKey, in.value(key));
       }
-    }
 
-    if (!classes.isEmpty())
-    {
-      props.insert(ctkPluginConstants::OBJECTCLASS, classes);
+      props.insert(lcKey, in.value(key));
     }
+  }
 
-    props.insert(ctkPluginConstants::SERVICE_ID, sid != -1 ? sid : nextServiceID++);
-
-    return props;
+  if (!classes.isEmpty())
+  {
+    props.insert(ctkPluginConstants::OBJECTCLASS, classes);
   }
 
+  props.insert(ctkPluginConstants::SERVICE_ID, sid != -1 ? sid : nextServiceID++);
+
+  return props;
+}
 
 ctkServices::ctkServices(ctkPluginFrameworkContext* fwCtx)
   : mutex(QMutex::Recursive), framework(fwCtx)