ctkCmdLineModuleBackendXMLChecker.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) University College London
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =============================================================================*/
  14. #ifndef CTKCMDLINEMODULEBACKENDXMLCHECKER_H
  15. #define CTKCMDLINEMODULEBACKENDXMLCHECKER_H
  16. #include "ctkCmdLineModuleBackend.h"
  17. #include "ctkCommandLineModulesBackendXMLCheckerExport.h"
  18. #include <QScopedPointer>
  19. struct ctkCmdLineModuleBackendXMLCheckerPrivate;
  20. /**
  21. * @ingroup CommandLineModulesBackendXMLChecker_API
  22. *
  23. * @brief Provides a ctkCmdLineModuleBackend implementation
  24. * to pretend to run a command line process, but actually
  25. * it returns a fixed, static piece of XML which can then
  26. * be validated by the core library.
  27. */
  28. class CTK_CMDLINEMODULEBACKENDXMLCHECKER_EXPORT ctkCmdLineModuleBackendXMLChecker : public ctkCmdLineModuleBackend
  29. {
  30. public:
  31. ctkCmdLineModuleBackendXMLChecker();
  32. ctkCmdLineModuleBackendXMLChecker(const QString &xmlToValidate);
  33. ~ctkCmdLineModuleBackendXMLChecker();
  34. virtual QString name() const;
  35. virtual QString description() const;
  36. /**
  37. * @brief This back-end can handle the "xml checker" URL scheme.
  38. * @return Returns the schemes this back-end can handle.
  39. */
  40. virtual QList<QString> schemes() const;
  41. /**
  42. * @brief Returns the last modified time of the module at \c location.
  43. * @param location The location URL of the module for which to get the timestamp.
  44. * @return A timestamp.
  45. */
  46. virtual qint64 timeStamp(const QUrl &location) const;
  47. /**
  48. * @brief Get the raw XML description from the module at \c location.
  49. * @param location The location URL of the module for which to get the XML description.
  50. * @return The raw XML description.
  51. *
  52. * This method always calls the executable with a \c &ndash;&ndash;xml argument and returns
  53. * the complete data emitted on the standard output channel.
  54. */
  55. virtual QByteArray rawXmlDescription(const QUrl& location);
  56. /**
  57. * @brief Run a front-end for this module in a local process.
  58. * @param frontend The front-end to run.
  59. * @return A future object for communicating with the running process.
  60. */
  61. virtual ctkCmdLineModuleFuture run(ctkCmdLineModuleFrontend *frontend);
  62. void setXML(const QString& xml);
  63. QString xml() const;
  64. private:
  65. QScopedPointer<ctkCmdLineModuleBackendXMLCheckerPrivate> d;
  66. };
  67. #endif // CTKCMDLINEMODULEBACKENDLOCALPROCESS_H