summaryrefslogtreecommitdiffstats
path: root/async/src/debug.h
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2015-05-18 15:20:35 +0200
committerDan Vrátil <dvratil@redhat.com>2015-05-18 15:20:35 +0200
commit5e580299e342bd77fc7479bbfd235f4446d7f05b (patch)
tree648aacd4de1f239d72be89ab9f2d4a97867d7920 /async/src/debug.h
parentb43c0cf97615957e097daef29ff8febc1ec884c8 (diff)
downloadsink-5e580299e342bd77fc7479bbfd235f4446d7f05b.tar.gz
sink-5e580299e342bd77fc7479bbfd235f4446d7f05b.zip
KAsync has moved to it's own kasync.git repository
Diffstat (limited to 'async/src/debug.h')
-rw-r--r--async/src/debug.h82
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
30namespace KAsync
31{
32
33Q_DECLARE_LOGGING_CATEGORY(Debug)
34Q_DECLARE_LOGGING_CATEGORY(Trace)
35
36KASYNC_EXPORT QString demangleName(const char *name);
37
38namespace Private
39{
40class Execution;
41}
42
43class KASYNC_EXPORT Tracer
44{
45public:
46 Tracer(Private::Execution *execution);
47 ~Tracer();
48
49private:
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