ctkXnatResourceCatalogXmlParser.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*=============================================================================
  2. Library: XNAT/Core
  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 CTKXNATRESOURCECATALOGXMLPARSER_H
  16. #define CTKXNATRESOURCECATALOGXMLPARSER_H
  17. #include "ctkXNATCoreExport.h"
  18. #include <QList>
  19. #include <QVariantMap>
  20. class ctkXnatResourceCatalogXmlParserPrivate;
  21. /**
  22. * @brief Parses the xml response when requesting the catalog xml of a resource
  23. *
  24. * When sending the following request to XNAT:
  25. * <xnat-url>/projects/myProject/resources/<resource-id>
  26. * you get the catalog xml of the resource folder as response
  27. *
  28. * This class parses this response and returns the MD5 hashes of all the resource files,
  29. * which are contained by the resource folder.
  30. *
  31. * @ingroup XNAT_Core
  32. */
  33. class CTK_XNAT_CORE_EXPORT ctkXnatResourceCatalogXmlParser
  34. {
  35. public:
  36. ctkXnatResourceCatalogXmlParser();
  37. ~ctkXnatResourceCatalogXmlParser();
  38. /**
  39. * @brief Set the xml input for the parser
  40. * @param xmlInput as QByteArray
  41. */
  42. void setData(const QByteArray& xmlInput);
  43. /**
  44. * @brief Parses the xml input and extracts the md5 hashes of the resource catalog
  45. * @param result the QList in which the md5 hashes will be stored
  46. */
  47. void parseXml(QList<QVariantMap> &result);
  48. private:
  49. ctkXnatResourceCatalogXmlParser(const ctkXnatResourceCatalogXmlParser& );
  50. ctkXnatResourceCatalogXmlParser& operator=(const ctkXnatResourceCatalogXmlParser& );
  51. /// The private implementation part of the object.
  52. ctkXnatResourceCatalogXmlParserPrivate* d_ptr;
  53. Q_DECLARE_PRIVATE(ctkXnatResourceCatalogXmlParser)
  54. };
  55. #endif //CTKXNATRESOURCECATALOGXMLPARSER_H