ctkXnatFile.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*=============================================================================
  2. Library: XNAT/Core
  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. #include "ctkXnatFile.h"
  16. #include "ctkXnatObjectPrivate.h"
  17. #include "ctkXnatSession.h"
  18. const QString ctkXnatFile::FILE_NAME = "Name";
  19. const QString ctkXnatFile::FILE_TAGS = "file_tags";
  20. const QString ctkXnatFile::FILE_FORMAT = "file_format";
  21. const QString ctkXnatFile::FILE_CONTENT = "file_content";
  22. //----------------------------------------------------------------------------
  23. class ctkXnatFilePrivate : public ctkXnatObjectPrivate
  24. {
  25. public:
  26. ctkXnatFilePrivate()
  27. : ctkXnatObjectPrivate()
  28. {
  29. }
  30. void reset()
  31. {
  32. // uri.clear();
  33. }
  34. // QString uri;
  35. };
  36. //----------------------------------------------------------------------------
  37. ctkXnatFile::ctkXnatFile(ctkXnatObject* parent, const QString& schemaType)
  38. : ctkXnatObject(*new ctkXnatFilePrivate(), parent, schemaType)
  39. {
  40. }
  41. //----------------------------------------------------------------------------
  42. ctkXnatFile::~ctkXnatFile()
  43. {
  44. }
  45. //----------------------------------------------------------------------------
  46. void ctkXnatFile::setName(const QString &name)
  47. {
  48. this->setProperty(FILE_NAME, name);
  49. }
  50. //----------------------------------------------------------------------------
  51. QString ctkXnatFile::name() const
  52. {
  53. return this->property(FILE_NAME);
  54. }
  55. //----------------------------------------------------------------------------
  56. void ctkXnatFile::setFileFormat(const QString &fileFormat)
  57. {
  58. this->setProperty(FILE_FORMAT, fileFormat);
  59. }
  60. QString ctkXnatFile::fileFormat() const
  61. {
  62. return this->property(FILE_FORMAT);
  63. }
  64. //----------------------------------------------------------------------------
  65. void ctkXnatFile::setFileContent(const QString &fileContent)
  66. {
  67. this->setProperty(FILE_CONTENT, fileContent);
  68. }
  69. QString ctkXnatFile::fileContent() const
  70. {
  71. return this->property(FILE_CONTENT);
  72. }
  73. //----------------------------------------------------------------------------
  74. void ctkXnatFile::setFileTags(const QString &fileTags)
  75. {
  76. this->setProperty(FILE_TAGS, fileTags);
  77. }
  78. QString ctkXnatFile::fileTags() const
  79. {
  80. return this->property(FILE_TAGS);
  81. }
  82. //----------------------------------------------------------------------------
  83. QString ctkXnatFile::resourceUri() const
  84. {
  85. return QString("%1/files/%2").arg(parent()->resourceUri(), this->name());
  86. }
  87. //----------------------------------------------------------------------------
  88. void ctkXnatFile::download(const QString& filename)
  89. {
  90. this->session()->download(this, filename);
  91. }
  92. //----------------------------------------------------------------------------
  93. void ctkXnatFile::upload(const QString& /*filename*/)
  94. {
  95. }
  96. //----------------------------------------------------------------------------
  97. void ctkXnatFile::reset()
  98. {
  99. ctkXnatObject::reset();
  100. }
  101. //----------------------------------------------------------------------------
  102. void ctkXnatFile::fetchImpl()
  103. {
  104. }