ctkXnatObject.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*=============================================================================
  2. Plugin: org.commontk.xnat
  3. Copyright (c) University College London,
  4. Centre for Medical Image Computing
  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 ctkXnatObject_h
  16. #define ctkXnatObject_h
  17. #include "ctkXNATCoreExport.h"
  18. #include <QList>
  19. #include <QObject>
  20. #include <QString>
  21. #include <QSharedPointer>
  22. #include <QMetaType>
  23. class ctkXnatConnection;
  24. class ctkXnatObjectPrivate;
  25. class CTK_XNAT_CORE_EXPORT ctkXnatObject
  26. {
  27. public:
  28. typedef QSharedPointer<ctkXnatObject> Pointer;
  29. typedef QWeakPointer<ctkXnatObject> WeakPointer;
  30. virtual ~ctkXnatObject();
  31. QString getId() const;
  32. QString getName() const;
  33. QString getDescription() const;
  34. QString getProperty(const QString& name) const;
  35. void setProperty(const QString& name, const QVariant& value);
  36. ctkXnatObject::Pointer getParent() const;
  37. QList<ctkXnatObject::Pointer> getChildren() const;
  38. void addChild(Pointer& child);
  39. bool isFetched() const;
  40. virtual void reset();
  41. void fetch();
  42. virtual void download(const QString&);
  43. virtual void upload(const QString&);
  44. virtual void add(const QString&);
  45. virtual void remove();
  46. virtual bool isFile() const;
  47. virtual bool receivesFiles() const;
  48. virtual bool holdsFiles() const;
  49. virtual bool isDeletable() const;
  50. virtual bool isModifiable() const;
  51. protected:
  52. ctkXnatObject();
  53. ctkXnatObject(ctkXnatObjectPrivate& dd);
  54. virtual ctkXnatConnection* getConnection() const;
  55. void setId(const QString& id);
  56. void setName(const QString& name);
  57. void setDescription(const QString& description);
  58. const QScopedPointer<ctkXnatObjectPrivate> d_ptr;
  59. private:
  60. friend class ctkXnatConnection;
  61. virtual void fetchImpl() = 0;
  62. Q_DECLARE_PRIVATE(ctkXnatObject)
  63. Q_DISABLE_COPY(ctkXnatObject)
  64. };
  65. Q_DECLARE_METATYPE(ctkXnatObject::Pointer)
  66. #endif