AusweisApp2
MsgContext.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
10 #include "MsgTypes.h"
11 
12 namespace governikus
13 {
14 
16 {
17  Q_DISABLE_COPY(MsgContext)
18 
19  protected:
20  MsgLevel mApiLevel;
21  QList<MsgType> mStateMessages;
22  QSharedPointer<WorkflowContext> mContext;
23 
24  public:
25  MsgContext();
26 
27  void setApiLevel(MsgLevel pApiLevel);
28  [[nodiscard]] MsgLevel getApiLevel() const;
29 
30  [[nodiscard]] MsgType getLastStateMsg() const;
31 
32  [[nodiscard]] bool isActiveWorkflow() const;
33 
34  template<typename T = WorkflowContext>
35  QSharedPointer<const T> getContext() const
36  {
37  static_assert(std::is_base_of<WorkflowContext, T>::value, "T must derive WorkflowContext");
38 
39  if (mContext)
40  {
41  return mContext.objectCast<const T>();
42  }
43 
44  return QSharedPointer<const T>();
45  }
46 
47 
48  template<typename T = WorkflowContext>
49  QSharedPointer<T> getContext()
50  {
51  static_assert(std::is_base_of<WorkflowContext, T>::value, "T must derive WorkflowContext");
52 
53  if (mContext)
54  {
55  return mContext.objectCast<T>();
56  }
57 
58  return QSharedPointer<T>();
59  }
60 
61 
62 };
63 
65  : public MsgContext
66 {
67  public:
68  void clear();
69  void addStateMsg(MsgType pMsgType);
70  void setWorkflowContext(const QSharedPointer<WorkflowContext>& pContext);
71 };
72 
73 } // namespace governikus
Definition: MsgContext.h:16
QList< MsgType > mStateMessages
Definition: MsgContext.h:21
MsgType getLastStateMsg() const
Definition: MsgContext.cpp:40
bool isActiveWorkflow() const
Definition: MsgContext.cpp:22
MsgContext()
Definition: MsgContext.cpp:14
QSharedPointer< const T > getContext() const
Definition: MsgContext.h:35
QSharedPointer< T > getContext()
Definition: MsgContext.h:49
MsgLevel getApiLevel() const
Definition: MsgContext.cpp:34
void setApiLevel(MsgLevel pApiLevel)
Definition: MsgContext.cpp:28
QSharedPointer< WorkflowContext > mContext
Definition: MsgContext.h:22
MsgLevel mApiLevel
Definition: MsgContext.h:20
Definition: MsgContext.h:66
void addStateMsg(MsgType pMsgType)
Definition: MsgContext.cpp:57
void setWorkflowContext(const QSharedPointer< WorkflowContext > &pContext)
Definition: MsgContext.cpp:51
void clear()
Definition: MsgContext.cpp:63
#define T(v)
Definition: http_parser.cpp:237
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15