File indexing completed on 2024-04-14 04:45:10

0001 /*
0002     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_DEBUGGING_OUTPUT_CACHE_H_
0007 #define _K3B_DEBUGGING_OUTPUT_CACHE_H_
0008 
0009 #include <QMap>
0010 #include <QString>
0011 
0012 
0013 namespace K3b {
0014     /**
0015      * Class to cache the debug output and make sure we do not eat all the
0016      * memory by restricting the memory used and ignoring multiple identical
0017      * messages.
0018      */
0019     class DebuggingOutputCache
0020     {
0021     public:
0022         DebuggingOutputCache();
0023         ~DebuggingOutputCache();
0024 
0025         void addOutput( const QString& group, const QString& line );
0026 
0027         DebuggingOutputCache& operator<<( const QString& line );
0028 
0029         void clear();
0030 
0031         QString toString() const;
0032         QMap<QString, QString> toGroups() const;
0033 
0034         bool stderrEnabled() const;
0035         void enableStderr( bool b );
0036 
0037         static QString defaultGroup();
0038 
0039     private:
0040         class Private;
0041         Private* const d;
0042     };
0043 }
0044 
0045 #endif