diff options
Diffstat (limited to 'async/src/debug.h')
-rw-r--r-- | async/src/debug.h | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/async/src/debug.h b/async/src/debug.h deleted file mode 100644 index b2b2ff7..0000000 --- a/async/src/debug.h +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2015 Daniel Vrátil <dvratil@redhat.com> | ||
3 | * | ||
4 | * This library is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Library General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This library is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU Library General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Library General Public License | ||
15 | * along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef KASYNC_DEBUG_H | ||
19 | #define KASYNC_DEBUG_H | ||
20 | |||
21 | #include "kasync_export.h" | ||
22 | |||
23 | #include <QLoggingCategory> | ||
24 | #include <QStringBuilder> | ||
25 | |||
26 | #ifndef QT_NO_DEBUG | ||
27 | #include <typeinfo> | ||
28 | #endif | ||
29 | |||
30 | namespace KAsync | ||
31 | { | ||
32 | |||
33 | Q_DECLARE_LOGGING_CATEGORY(Debug) | ||
34 | Q_DECLARE_LOGGING_CATEGORY(Trace) | ||
35 | |||
36 | KASYNC_EXPORT QString demangleName(const char *name); | ||
37 | |||
38 | namespace Private | ||
39 | { | ||
40 | class Execution; | ||
41 | } | ||
42 | |||
43 | class KASYNC_EXPORT Tracer | ||
44 | { | ||
45 | public: | ||
46 | Tracer(Private::Execution *execution); | ||
47 | ~Tracer(); | ||
48 | |||
49 | private: | ||
50 | enum MsgType { | ||
51 | Start, | ||
52 | End | ||
53 | }; | ||
54 | void msg(MsgType); | ||
55 | |||
56 | int mId; | ||
57 | Private::Execution *mExecution; | ||
58 | |||
59 | static int lastId; | ||
60 | }; | ||
61 | |||
62 | } | ||
63 | |||
64 | #ifndef QT_NO_DEBUG | ||
65 | template<typename T> | ||
66 | QString storeExecutorNameExpanded() { | ||
67 | return KAsync::demangleName(typeid(T).name()); | ||
68 | } | ||
69 | |||
70 | template<typename T, typename ... Tail> | ||
71 | typename std::enable_if<sizeof ... (Tail) != 0, QString>::type | ||
72 | storeExecutorNameExpanded() { | ||
73 | return storeExecutorNameExpanded<T>() % QStringLiteral(", ") % storeExecutorNameExpanded<Tail ...>(); | ||
74 | } | ||
75 | |||
76 | #define STORE_EXECUTOR_NAME(name, ...) \ | ||
77 | ExecutorBase::mExecutorName = QStringLiteral(name) % QStringLiteral("<") % storeExecutorNameExpanded<__VA_ARGS__>() % QStringLiteral(">") | ||
78 | #else | ||
79 | #define STORE_EXECUTOR_NAME(...) | ||
80 | #endif | ||
81 | |||
82 | #endif // KASYNC_DEBUG_H \ No newline at end of file | ||