ctkXnatAPI_p.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifndef __ctkXnatAPI_h
  16. #define __ctkXnatAPI_h
  17. #include "qRestAPI.h"
  18. #include <QList>
  19. #include <QScriptEngine>
  20. #include <QScriptValue>
  21. /**
  22. * ctkXnatAPI is a simple interface class to communicate with an XNAT
  23. * server through its REST API.
  24. */
  25. class ctkXnatAPI : public qRestAPI
  26. {
  27. Q_OBJECT
  28. typedef qRestAPI Superclass;
  29. public:
  30. explicit ctkXnatAPI(QObject* parent = 0);
  31. virtual ~ctkXnatAPI();
  32. using Superclass::get;
  33. virtual QUuid get(const QString& resource,
  34. const Parameters& parameters = Parameters(),
  35. const RawHeaders& rawHeaders = RawHeaders());
  36. protected:
  37. void parseResponse(qRestResult* restResult, const QByteArray& result);
  38. private:
  39. QList<QVariantMap> parseXmlResponse(qRestResult* restResult, const QByteArray& response);
  40. QList<QVariantMap> parseJsonResponse(qRestResult* restResult, const QByteArray& response);
  41. QScriptEngine ScriptEngine;
  42. Q_DISABLE_COPY(ctkXnatAPI)
  43. };
  44. #endif