ctkErrorLogTerminalOutput.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  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.txt
  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 CTKERRORLOGTERMINALOUTPUT_H
  15. #define CTKERRORLOGTERMINALOUTPUT_H
  16. // Qt includes
  17. #include <QScopedPointer>
  18. #include <QObject>
  19. // CTK includes
  20. #include <ctkCoreExport.h>
  21. //------------------------------------------------------------------------------
  22. class ctkErrorLogTerminalOutputPrivate;
  23. //------------------------------------------------------------------------------
  24. /// \ingroup Core
  25. class CTK_CORE_EXPORT ctkErrorLogTerminalOutput : public QObject
  26. {
  27. Q_OBJECT
  28. Q_FLAGS(TerminalOutputs)
  29. public:
  30. ctkErrorLogTerminalOutput();
  31. virtual ~ctkErrorLogTerminalOutput();
  32. enum TerminalOutput
  33. {
  34. None = 0x0,
  35. StandardError = 0x1,
  36. StandardOutput = 0x2,
  37. All = StandardError | StandardOutput
  38. };
  39. Q_DECLARE_FLAGS(TerminalOutputs, TerminalOutput)
  40. bool enabled()const;
  41. void setEnabled(bool value);
  42. int fileDescriptor()const;
  43. void setFileDescriptor(int fd);
  44. void output(const QString& text);
  45. protected:
  46. QScopedPointer<ctkErrorLogTerminalOutputPrivate> d_ptr;
  47. private:
  48. Q_DECLARE_PRIVATE(ctkErrorLogTerminalOutput)
  49. Q_DISABLE_COPY(ctkErrorLogTerminalOutput)
  50. };
  51. Q_DECLARE_OPERATORS_FOR_FLAGS(ctkErrorLogTerminalOutput::TerminalOutputs)
  52. #endif // CTKERRORLOGTERMINALOUTPUT_H