Deskflow 1.26.0.207
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
BaseException.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2025 - 2026 Deskflow Developers
4 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
5 * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
6 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
7 */
8
9#pragma once
10
11#include <stdexcept>
12#include <string>
13
14#include <QString>
15
17
20class BaseException : public std::runtime_error
21{
22public:
26 explicit BaseException(const QString &msg);
27 ~BaseException() throw() override = default;
28
30 const char *what() const throw() override;
31
32protected:
34 virtual QString getWhat() const noexcept
35 {
36 return {};
37 }
38
40
45 virtual QString format(const char *id, const char *defaultFormat, ...) const noexcept;
46
47private:
48 mutable QString m_what;
49};
virtual QString getWhat() const noexcept
Get a human readable string describing the exception.
Definition BaseException.h:34
virtual QString format(const char *id, const char *defaultFormat,...) const noexcept
Format a string.
Definition BaseException.cpp:38
BaseException()
Use getWhat() as the result of what().
Definition BaseException.cpp:18
const char * what() const override
Reason for exception.
Definition BaseException.cpp:28
~BaseException() override=default