ctkPluginFramework_global.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) 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 CTKPLUGINFRAMEWORK_GLOBAL_H
  16. #define CTKPLUGINFRAMEWORK_GLOBAL_H
  17. #include <QHash>
  18. #include <QStringList>
  19. #include <QVariant>
  20. /**
  21. * \ingroup PluginFramework
  22. * @{
  23. */
  24. typedef QHash<QString, QVariant> ctkProperties;
  25. typedef ctkProperties ctkDictionary;
  26. #if QT_VERSION < 0x040700
  27. #include <QSharedPointer>
  28. template<class T>
  29. inline uint qHash(const QSharedPointer<T>& ptr)
  30. {
  31. return qHash<T>(ptr.data());
  32. }
  33. #endif
  34. //----------------------------------------------------------------------------
  35. template<class A>
  36. QStringList getIIDs()
  37. {
  38. return QStringList(qobject_interface_iid<A*>());
  39. }
  40. //----------------------------------------------------------------------------
  41. template<class A, class B>
  42. QStringList getIIDs()
  43. {
  44. QStringList ids;
  45. ids << qobject_interface_iid<A*>();
  46. ids << qobject_interface_iid<B*>();
  47. return ids;
  48. }
  49. //----------------------------------------------------------------------------
  50. template<class A, class B, class C>
  51. QStringList getIIDs()
  52. {
  53. QStringList ids;
  54. ids << qobject_interface_iid<A*>();
  55. ids << qobject_interface_iid<B*>();
  56. ids << qobject_interface_iid<C*>();
  57. return ids;
  58. }
  59. //----------------------------------------------------------------------------
  60. template<class A, class B, class C, class D>
  61. QStringList getIIDs()
  62. {
  63. QStringList ids;
  64. ids << qobject_interface_iid<A*>();
  65. ids << qobject_interface_iid<B*>();
  66. ids << qobject_interface_iid<C*>();
  67. ids << qobject_interface_iid<D*>();
  68. return ids;
  69. }
  70. /** @}*/
  71. #endif // CTKPLUGINFRAMEWORK_GLOBAL_H