ctkCmdLineModuleXslTransform.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*=============================================================================
  2. Library: CTK
  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 CTKCMDLINEMODULEXSLTRANSFORM_H
  16. #define CTKCMDLINEMODULEXSLTRANSFORM_H
  17. #include "ctkCommandLineModulesCoreExport.h"
  18. #include "ctkCmdLineModuleXmlValidator.h"
  19. #include <QString>
  20. class QIODevice;
  21. /**
  22. * \ingroup CommandLineModulesCore
  23. */
  24. class CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleXslTransform
  25. : public ctkCmdLineModuleXmlValidator
  26. {
  27. public:
  28. ctkCmdLineModuleXslTransform(QIODevice* input = 0, QIODevice* output = 0);
  29. void setOutput(QIODevice* output);
  30. QIODevice* output() const;
  31. void setOutputSchema(QIODevice* output);
  32. /**
  33. * @brief Transforms an XML input via a XSL transformation.
  34. *
  35. * This method assumes that the input set via setInput() or supplied
  36. * in the constructor is a valid XML fragment.
  37. *
  38. * @return
  39. */
  40. bool transform();
  41. void setXslTransformation(QIODevice* transformation);
  42. void setValidateOutput(bool validate);
  43. bool error() const;
  44. QString errorString() const;
  45. private:
  46. bool validateOutput();
  47. bool Validate;
  48. QIODevice* OutputSchema;
  49. QIODevice* Transformation;
  50. QIODevice* Output;
  51. QString ErrorStr;
  52. };
  53. #endif // CTKCMDLINEMODULEXSLTRANSFORM_H