File indexing completed on 2024-05-12 04:38:43

0001 /*
0002     SPDX-FileCopyrightText: 2012 Olivier de Gaalon <olivier.jg@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #ifndef KDEVPLATFORM_DELAYEDOUTPUT_H
0008 #define KDEVPLATFORM_DELAYEDOUTPUT_H
0009 
0010 #include <tests/testsexport.h>
0011 
0012 #include <QScopedPointer>
0013 
0014 namespace KDevelop {
0015 class DelayedOutputPrivate;
0016 
0017 ///Used to invert and visually nest error output generated by nested/recursive functions
0018 ///Used in TestSuite.h, use only at your own, singleton educated risk
0019 class KDEVPLATFORMTESTS_EXPORT DelayedOutput
0020 {
0021 public:
0022     class KDEVPLATFORMTESTS_EXPORT Delay
0023     {
0024 public:
0025         explicit Delay(DelayedOutput* output);
0026         ~Delay();
0027 
0028 private:
0029         DelayedOutput* m_output;
0030     };
0031     ~DelayedOutput();
0032     static DelayedOutput& self();
0033     void push(const QString& output);
0034 
0035 private:
0036     DelayedOutput();
0037     Q_DISABLE_COPY(DelayedOutput)
0038     const QScopedPointer<class DelayedOutputPrivate> d_ptr;
0039     Q_DECLARE_PRIVATE(DelayedOutput)
0040 };
0041 }
0042 
0043 #endif //KDEVPLATFORM_DELAYEDOUTPUT_H