ctkPlugin.cxx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #include "ctkPlugin.h"
  16. #include "ctkPluginPrivate_p.h"
  17. #include "ctkPluginArchive_p.h"
  18. #include <QStringList>
  19. namespace ctk {
  20. Plugin::Plugin(PluginFrameworkContextPrivate* fw,
  21. PluginArchive* pa)
  22. : d_ptr(new PluginPrivate(*this, fw, pa))
  23. {
  24. }
  25. Plugin::Plugin(PluginPrivate& dd)
  26. : d_ptr(&dd)
  27. {
  28. }
  29. Plugin::~Plugin()
  30. {
  31. delete d_ptr;
  32. }
  33. Plugin::State Plugin::getState() const
  34. {
  35. Q_D(const Plugin);
  36. return d->state;
  37. }
  38. void Plugin::start()
  39. {
  40. }
  41. void Plugin::stop()
  42. {
  43. }
  44. PluginContext* Plugin::getPluginContext() const
  45. {
  46. //TODO security checks
  47. Q_D(const Plugin);
  48. return d->pluginContext;
  49. }
  50. int Plugin::getPluginId() const
  51. {
  52. Q_D(const Plugin);
  53. return d->id;
  54. }
  55. QString Plugin::getLocation() const
  56. {
  57. //TODO security
  58. Q_D(const Plugin);
  59. return d->location;
  60. }
  61. QString Plugin::getSymbolicName() const
  62. {
  63. Q_D(const Plugin);
  64. return d->symbolicName;
  65. }
  66. QStringList Plugin::getResourceList(const QString& path) const
  67. {
  68. Q_D(const Plugin);
  69. return d->archive->findResourcesPath(path);
  70. }
  71. QByteArray Plugin::getResource(const QString& path) const
  72. {
  73. Q_D(const Plugin);
  74. return d->archive->getPluginResource(path);
  75. }
  76. Version Plugin::getVersion() const
  77. {
  78. Q_D(const Plugin);
  79. return d->version;
  80. }
  81. }