LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
concurrentexception.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <memory>
12
#include <QFuture>
13
#include <
util/sll/newtype.h
>
14
15
namespace
LC::Util
16
{
17
using
QtException_t
= QException;
18
19
using
QtException_ptr
= std::shared_ptr<QtException_t>;
20
29
template
<
typename
T>
30
class
ConcurrentException
:
public
QtException_t
31
,
public
T
32
{
33
public
:
36
ConcurrentException
() =
default
;
37
46
template
<
typename
... Args>
47
requires
requires
(Args&&... args) { T { std::forward<Args> (args)... }; }
48
explicit
ConcurrentException
(Args&&... args)
49
: T { std::forward<Args> (args)... }
50
{
51
}
52
57
void
raise
()
const override
58
{
59
throw
ConcurrentException<T>
{ *
this
};
60
}
61
66
ConcurrentException<T>
*
clone
()
const override
67
{
68
return
new
ConcurrentException<T>
{ *
this
};
69
}
70
75
const
char
*
what
() const noexcept
override
76
{
77
return
T::what ();
78
}
79
};
80
81
using
ConcurrentStdException
=
Util::ConcurrentException<Util::NewType<std::exception, struct StdException>
>;
82
}
83
84
Q_DECLARE_METATYPE
(
LC::Util::QtException_ptr
)
LC::Util::ConcurrentException
A concurrent exception that plays nicely with Qt.
Definition
concurrentexception.h:32
LC::Util::ConcurrentException::clone
ConcurrentException< T > * clone() const override
Constructs a copy of this object.
Definition
concurrentexception.h:66
LC::Util::ConcurrentException::ConcurrentException
ConcurrentException()=default
Default-constructs the exception object.
LC::Util::ConcurrentException::what
const char * what() const noexcept override
Overrides base pure virtual.
Definition
concurrentexception.h:75
LC::Util::ConcurrentException::raise
void raise() const override
Rethrows an exception of exactly this type and state.
Definition
concurrentexception.h:57
LC::Util::ConcurrentException::ConcurrentException
ConcurrentException(Args &&... args)
Constructs the exception object with the given args.
Definition
concurrentexception.h:48
LC::Util
Definition
icoreproxy.h:34
LC::Util::QtException_ptr
std::shared_ptr< QtException_t > QtException_ptr
Definition
concurrentexception.h:19
LC::Util::QtException_t
QException QtException_t
Definition
concurrentexception.h:17
LC::Util::ConcurrentStdException
Util::ConcurrentException< Util::NewType< std::exception, struct StdException > > ConcurrentStdException
Definition
concurrentexception.h:81
newtype.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QVariantList *)
src
util
threads
concurrentexception.h
Generated by
1.17.0