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 <QXmlDefaultHandler>
  19. class ctkXnatResourceCatalogXmlParserPrivate;
  20. /**
  21. * @brief Parses the xml response when requesting the catalog xml of a resource
  22. *
  23. * When sending the following request to XNAT:
  24. * <xnat-url>/projects/myProject/resources/<resource-id>
  25. * you get the catalog xml of the resource folder as response
  26. *
  27. * This class parses this response and returns the MD5 hashes of all the resource files,
  28. * which are contained by the resource folder.
  29. *
  30. * @ingroup XNAT_Core
  31. */
  32. class CTK_XNAT_CORE_EXPORT ctkXnatResourceCatalogXmlParser : public QXmlDefaultHandler
  33. {
  34. public:
  35. ctkXnatResourceCatalogXmlParser();
  36. ~ctkXnatResourceCatalogXmlParser();
  37. /**
  38. * Overwrites QXmlDefaultHandler::startElement()
  39. */
  40. bool startElement(const QString &namespaceURI, const QString &localName,
  41. const QString &qName, const QXmlAttributes &atts);
  42. /**
  43. * @brief Returns the md5 hashes of the resource files
  44. * @return A list of QVariantMaps, which contain the md5 hashes
  45. */
  46. const QList<QVariantMap>& md5Hashes();
  47. private:
  48. ctkXnatResourceCatalogXmlParser(const ctkXnatResourceCatalogXmlParser& );
  49. ctkXnatResourceCatalogXmlParser& operator=(const ctkXnatResourceCatalogXmlParser& );
  50. /// The private implementation part of the object.
  51. ctkXnatResourceCatalogXmlParserPrivate* d_ptr;
  52. Q_DECLARE_PRIVATE(ctkXnatResourceCatalogXmlParser)
  53. };
  54. #endif //CTKXNATRESOURCECATALOGXMLPARSER_H