Deskflow 1.24.0.365
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 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
15
18class BaseException : public std::runtime_error
19{
20public:
24 explicit BaseException(const std::string &msg);
25 ~BaseException() throw() override = default;
26
28 const char *what() const throw() override;
29
30protected:
32 virtual std::string getWhat() const noexcept
33 {
34 return "";
35 }
36
38
43 virtual std::string format(const char *id, const char *defaultFormat, ...) const noexcept;
44
45private:
46 mutable std::string m_what;
47};
virtual std::string 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
virtual std::string getWhat() const noexcept
Get a human readable string describing the exception.
Definition BaseException.h:32
const char * what() const override
Reason for exception.
Definition BaseException.cpp:28
~BaseException() override=default
Definition Config.h:28