File indexing completed on 2024-05-12 05:26:19

0001 /*
0002  * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU General Public License as published by
0006  *   the Free Software Foundation; either version 2 of the License, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details.
0013  *
0014  *   You should have received a copy of the GNU General Public License
0015  *   along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
0018  */
0019 
0020 #pragma once
0021 
0022 #include <QTextStream>
0023 
0024 class State
0025 {
0026 public:
0027     State();
0028 
0029     void print(const QString &message, unsigned int indentationLevel = 0) const;
0030     void printLine(const QString &message = QString(), unsigned int indentationLevel = 0) const;
0031     void printError(const QString &errorMessage, const QString &errorCode = QString()) const;
0032 
0033     void stageTableLine(const QStringList &) const;
0034     void flushTable() const;
0035 
0036     void setDebugLevel(unsigned int level);
0037     unsigned int debugLevel() const;
0038 
0039     void setCommandTiming(bool);
0040     bool commandTiming() const;
0041 
0042     int commandStarted() const;
0043     void commandFinished(int returnCode = 0) const;
0044 
0045     void setLoggingLevel(const QString &level) const;
0046     QString loggingLevel() const;
0047 
0048     static void setHasEventLoop(bool evented);
0049     static bool hasEventLoop();
0050 
0051 private:
0052     void printTable(const QList<QStringList> &) const;
0053 
0054 private:
0055     class Private;
0056     Private *const d;
0057 };