LeechCraft
0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
introspectable.cpp
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
#include "
introspectable.h
"
10
#include <string>
11
#include <QtDebug>
12
13
namespace
LC::Util
14
{
15
Introspectable
&
Introspectable::Instance
()
16
{
17
static
Introspectable
inst
;
18
return
inst
;
19
}
20
21
QVariantMap
Introspectable::operator()
(
const
QVariant
&
variant
)
const
22
{
23
if
(!
variant
.isValid ())
24
throw
std::runtime_error {
"Invalid variant."
};
25
26
const
auto
type =
variant
.userType ();
27
28
if
(type <
static_cast<
int
>
(QVariant::UserType))
29
return
{ {
"data"
,
variant
} };
30
31
if
(Intros_.contains (type))
32
return
Intros_ [type] (
variant
);
33
34
qWarning
() <<
Q_FUNC_INFO
35
<<
"unregistered type"
36
<< type
37
<<
variant
;
38
throw
std::runtime_error {
"Unregistered type: "
+ std::to_string (type) };
39
}
40
}
LC::Util::Introspectable
Definition
introspectable.h:22
LC::Util::Introspectable::operator()
QVariantMap operator()(const T &t) const
Definition
introspectable.h:45
LC::Util::Introspectable::Instance
static Introspectable & Instance()
Definition
introspectable.cpp:15
introspectable.h
LC::Util
Definition
icoreproxy.h:34
LC::Util::Filter
Container< T > Filter(const Container< T > &c, F f)
Definition
prelude.h:118
src
util
xpc
introspectable.cpp
Generated by
1.10.0