File indexing completed on 2024-05-12 17:08:30

0001 /*
0002  * SPDX-FileCopyrightText: 2018-2019 Daniel Vrátil <dvratil@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef FAKESERVER_H
0008 #define FAKESERVER_H
0009 
0010 #include <QString>
0011 
0012 #include <memory>
0013 
0014 class FakeServerException : public std::runtime_error
0015 {
0016 public:
0017     FakeServerException(const char *what)
0018         : std::runtime_error(what)
0019     {
0020     }
0021     FakeServerException(const QString &what)
0022         : std::runtime_error(what.toStdString())
0023     {
0024     }
0025 };
0026 
0027 class FakeManager;
0028 class FakeServer
0029 {
0030 public:
0031     explicit FakeServer(const QString &file);
0032     explicit FakeServer();
0033     ~FakeServer();
0034 
0035     static void enableFakeEnv();
0036 
0037     FakeManager *manager() const;
0038 
0039 private:
0040     std::unique_ptr<FakeManager> mManager;
0041 };
0042 
0043 #endif