ctkPluginPrivate_p.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) 2010 German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKPLUGINPRIVATE_P_H
  16. #define CTKPLUGINPRIVATE_P_H
  17. #include "ctkPlugin.h"
  18. #include "ctkPluginException.h"
  19. #include <QHash>
  20. namespace ctk {
  21. class PluginActivator;
  22. class PluginArchive;
  23. class PluginFrameworkContextPrivate;
  24. class PluginPrivate {
  25. protected:
  26. Q_DECLARE_PUBLIC(Plugin)
  27. Plugin * const q_ptr;
  28. public:
  29. /**
  30. * Construct a new plugin based on a PluginArchive.
  31. *
  32. * @param fw PluginFrameworkContext for this plugin.
  33. * @param ba Plugin archive representing the shared library and cached data
  34. * @param checkContext AccessConrolContext to do permission checks against.
  35. * @exception std::invalid_argument Faulty manifest for bundle
  36. */
  37. PluginPrivate(Plugin& qq, PluginFrameworkContextPrivate* fw,
  38. PluginArchive* pa /*, Object checkContext*/);
  39. /**
  40. * Construct a new empty Plugin.
  41. *
  42. * Only called for the system plugin
  43. *
  44. * @param fw Framework for this plugin.
  45. */
  46. PluginPrivate(Plugin& qq,
  47. PluginFrameworkContextPrivate* fw,
  48. int id,
  49. const QString& loc,
  50. const QString& sym,
  51. const Version& ver);
  52. virtual ~PluginPrivate();
  53. /**
  54. * Get updated plugin state. That means check if an installed
  55. * plugin has been resolved.
  56. *
  57. * @return Plugin state
  58. */
  59. Plugin::States getUpdatedState();
  60. QHash<QString, QString> getHeaders(const QString& locale);
  61. /**
  62. * Union of flags allowing plugin class access
  63. */
  64. static const Plugin::States RESOLVED_FLAGS;
  65. PluginFrameworkContextPrivate * const fwCtx;
  66. /**
  67. * Plugin identifier
  68. */
  69. const int id;
  70. /**
  71. * Plugin location identifier
  72. */
  73. const QString location;
  74. /**
  75. * Plugin symbolic name
  76. */
  77. QString symbolicName;
  78. /**
  79. * Plugin version
  80. */
  81. Version version;
  82. /**
  83. * State of the plugin
  84. */
  85. Plugin::State state;
  86. /**
  87. * Plugin archive
  88. */
  89. PluginArchive* archive;
  90. /**
  91. * PluginContext for the plugin
  92. */
  93. PluginContext* pluginContext;
  94. /**
  95. * PluginActivator for the plugin
  96. */
  97. PluginActivator* pluginActivator;
  98. /**
  99. * Time when the plugin was last modified
  100. */
  101. long lastModified;
  102. /**
  103. * Stores the default locale entries when uninstalled
  104. */
  105. QHash<QString, QString> cachedHeaders;
  106. /**
  107. * Stores the raw manifest headers
  108. */
  109. QHash<QString, QString> cachedRawHeaders;
  110. bool lazyActivation;
  111. /** True during the finalization of an activation. */
  112. bool activating;
  113. /** True during the state change from active to resolved. */
  114. bool deactivating;
  115. /** Saved exception of resolve failure */
  116. PluginException resolveFailException;
  117. private:
  118. /**
  119. * Check manifest and cache certain manifest headers as variables.
  120. */
  121. void checkManifestHeaders();
  122. };
  123. }
  124. #endif // CTKPLUGINPRIVATE_P_H