AusweisApp
Lade ...
Suche ...
Keine Treffer
WorkflowRequest.h
gehe zur Dokumentation dieser Datei
1
5#pragma once
6
8
9#include <QPair>
10#include <QVariant>
11
12#include <functional>
13#include <utility>
14
15namespace governikus
16{
18 , UNHANDLED
19 , SKIP
20 , ENQUEUE
21 )
22
24
26{
28
29 using BusyHandler = std::function<WorkflowControl (const QSharedPointer<WorkflowRequest>&, const QSharedPointer<WorkflowRequest>&)>;
30
31 private:
32 const std::function<QSharedPointer<WorkflowController>(const QSharedPointer<WorkflowContext>& pContext)> mGeneratorController;
33 const std::function<QSharedPointer<WorkflowContext>()> mGeneratorContext;
34 const BusyHandler mBusyHandler;
35 const QVariant mData;
36
39
40 template<typename Controller, typename Context, typename ... Args>
41 static auto getGenerator(Args&& ... pArgs)
42 {
44 return QSharedPointer<Controller>::create(pContext.staticCast<Context>());
45 };
46
47 const auto& context = [pArgs ...]() mutable {
48 return QSharedPointer<Context>::create(std::forward<Args>(pArgs) ...);
49 };
50
52 }
53
54 public:
55 template<typename Controller, typename Context, typename ... Args>
57 {
58 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
59 return QSharedPointer<WorkflowRequest>::create(controller, context);
60 }
61
62
63 template<typename Controller, typename Context, typename ... Args>
65 {
66 return createHandler<Controller, Context, Args...>(pBusyHandler, QVariant(), std::forward<Args>(pArgs) ...);
67 }
68
69
70 template<typename Controller, typename Context, typename ... Args>
72 {
73 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
74 return QSharedPointer<WorkflowRequest>::create(controller, context, pBusyHandler, pData);
75 }
76
77
80 const BusyHandler& pHandler = BusyHandler(),
81 const QVariant& pData = QVariant());
82
83 void initialize();
84 [[nodiscard]] bool isInitialized() const;
85 [[nodiscard]] Action getAction() const;
88 [[nodiscard]] QVariant getData() const;
90};
91
92} // namespace governikus
#define defineEnumType(enumName,...)
Definition EnumHelper.h:85
Definition WorkflowController.h:24
Definition WorkflowRequest.h:26
Action getAction() const
Definition WorkflowRequest.cpp:45
void initialize()
Definition WorkflowRequest.cpp:30
static QSharedPointer< WorkflowRequest > createHandler(const BusyHandler &pBusyHandler, const QVariant &pData, Args &&... pArgs)
Definition WorkflowRequest.h:71
QSharedPointer< WorkflowContext > getContext() const
Definition WorkflowRequest.cpp:57
WorkflowRequest(const std::function< QSharedPointer< WorkflowController >(const QSharedPointer< WorkflowContext > &pContext)> &pGeneratorController, const std::function< QSharedPointer< WorkflowContext >()> &pGeneratorContext, const BusyHandler &pHandler=BusyHandler(), const QVariant &pData=QVariant())
QSharedPointer< WorkflowController > getController() const
Definition WorkflowRequest.cpp:51
static QSharedPointer< WorkflowRequest > createHandler(const BusyHandler &pBusyHandler, Args &&... pArgs)
Definition WorkflowRequest.h:64
static QSharedPointer< WorkflowRequest > create(Args &&... pArgs)
Definition WorkflowRequest.h:56
QVariant getData() const
Definition WorkflowRequest.cpp:63
bool isInitialized() const
Definition WorkflowRequest.cpp:39
WorkflowControl handleBusyWorkflow(const QSharedPointer< WorkflowRequest > &pActiveWorkflow, const QSharedPointer< WorkflowRequest > &pWaitingWorkflow) const
Definition WorkflowRequest.cpp:69
Implementation of GeneralAuthenticate response APDUs.
Definition CommandApdu.h:17
QSharedPointer< T > decodeObject(const QByteArray &pData, bool pLogging=true)
Template function for decoding an OpenSSL type from DER encoded QByteArray.
Definition ASN1TemplateUtil.h:114