LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
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 
32  template<typename T>
34  , public T
35  {
36  public:
39  ConcurrentException () = default;
40 
49  template<typename... Args>
50  requires requires (Args&&... args) { T { std::forward<Args> (args)... }; }
51  explicit ConcurrentException (Args&&... args)
52  : T { std::forward<Args> (args)... }
53  {
54  }
55 
60  void raise () const override
61  {
62  throw ConcurrentException<T> { *this };
63  }
64 
69  ConcurrentException<T>* clone () const override
70  {
71  return new ConcurrentException<T> { *this };
72  }
73 
78  const char* what () const noexcept override
79  {
80  return T::what ();
81  }
82  };
83 
85 }
86 
std::shared_ptr< QtException_t > QtException_ptr
requires requires(Args &&... args)
Constructs the exception object with the given args.
const char * what() const noexcept override
Overrides base pure virtual.
A concurrent exception that plays nicely with Qt.
ConcurrentException()=default
Default-constructs the exception object.
Q_DECLARE_METATYPE(QVariantList *)
auto Tup2 &&tup2 noexcept
Definition: ctstringutils.h:41
QException QtException_t
ConcurrentException< T > * clone() const override
Constructs a copy of this object.