LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
defaulthookproxy.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 <QMap>
12
#include "
xpcconfig.h
"
13
#include "
interfaces/iinfo.h
"
14
#include "
interfaces/core/ihookproxy.h
"
15
16
namespace
LC::Util
17
{
25
class
UTIL_XPC_API
DefaultHookProxy
:
public
IHookProxy
26
{
27
bool
Cancelled_ =
false
;
28
QVariant ReturnValue_;
29
30
QMap<QByteArray, QVariant>
Name2NewVal_;
31
public
:
34
DefaultHookProxy
() =
default
;
35
43
explicit
DefaultHookProxy
(
QMap<QByteArray, QVariant>
values);
44
49
void
CancelDefault
()
override
;
50
60
bool
IsCancelled
()
const
;
61
64
const
QVariant&
GetReturnValue
()
const override
;
65
68
void
SetReturnValue
(
const
QVariant&)
override
;
69
81
template
<
typename
T>
82
void
FillValue
(
const
QByteArray& name, T& val)
83
{
84
if
(!Name2NewVal_.contains (name))
85
return
;
86
87
const
QVariant& newVal = Name2NewVal_ [name];
88
if
(!newVal.isValid ())
89
return
;
90
91
val = newVal.value<T> ();
92
}
93
96
QVariant GetValue (
const
QByteArray&)
const override
;
97
100
void
SetValue (
const
QByteArray&,
const
QVariant&)
override
;
101
};
102
103
using
DefaultHookProxy_ptr
= std::shared_ptr<DefaultHookProxy>;
104
}
LC::IHookProxy
Class for hook-based communication between plugins.
Definition
ihookproxy.h:54
LC::Util::DefaultHookProxy::FillValue
void FillValue(const QByteArray &name, T &val)
Fills the value of the given parameter set by SetValue().
Definition
defaulthookproxy.h:82
LC::Util::DefaultHookProxy::SetReturnValue
void SetReturnValue(const QVariant &) override
Reimplemented from IHookProxy::SetReturnValue().
Definition
defaulthookproxy.cpp:33
LC::Util::DefaultHookProxy::IsCancelled
bool IsCancelled() const
Returns whether the default implementation is canceled.
Definition
defaulthookproxy.cpp:23
LC::Util::DefaultHookProxy::GetReturnValue
const QVariant & GetReturnValue() const override
Reimplemented from IHookProxy::GetReturnValue().
Definition
defaulthookproxy.cpp:28
LC::Util::DefaultHookProxy::DefaultHookProxy
DefaultHookProxy()=default
Creates a new hook proxy.
LC::Util::DefaultHookProxy::CancelDefault
void CancelDefault() override
Reimplemented from IHookProxy::CancelDefault().
Definition
defaulthookproxy.cpp:18
QMap
Definition
anutil.h:15
ihookproxy.h
iinfo.h
LC::Util
Definition
icoreproxy.h:34
LC::Util::DefaultHookProxy_ptr
std::shared_ptr< DefaultHookProxy > DefaultHookProxy_ptr
Definition
defaulthookproxy.h:103
xpcconfig.h
UTIL_XPC_API
#define UTIL_XPC_API
Definition
xpcconfig.h:16
src
util
xpc
defaulthookproxy.h
Generated by
1.17.0