AusweisApp2
GlobalStatus.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "EnumHelper.h"
10 
11 #include <QCoreApplication>
12 #include <QMap>
13 #include <QPair>
14 #include <QSharedData>
15 
16 namespace governikus
17 {
18 
20 {
21  Q_GADGET
22  Q_DECLARE_TR_FUNCTIONS(governikus::GlobalStatus)
23 
24  public:
25  enum class Code
26  {
28  No_Error,
29 
35 
41 
43 
83 
85 
87 
94 
110 
112 
118  };
119 
120  enum class Origin
121  {
122  Server, Client
123  };
124 
126  {
128  LAST_URL,
130  REDIRECT_URL,
132  URL_SCHEME,
134  };
135 
136  using ExternalInfoMap = QMap<ExternalInformation, QString>;
137 
138  Q_ENUM(Code)
139  Q_ENUM(Origin)
140  Q_ENUM(ExternalInformation)
141 
142  private:
143  class InternalStatus
144  : public QSharedData
145  {
146  public:
147  const Code mStatusCode;
148  const ExternalInfoMap mExternalInformation;
149  const Origin mOrigin;
150 
151  InternalStatus(Code pStatusCode, const ExternalInfoMap& pExternalInformation, const Origin pOrigin)
152  : mStatusCode(pStatusCode)
153  , mExternalInformation(pExternalInformation)
154  , mOrigin(pOrigin)
155  {
156  }
157 
158 
159  InternalStatus(Code pStatusCode, const QPair<ExternalInformation, QString>& pExternalInformation, const Origin pOrigin)
160  : mStatusCode(pStatusCode)
161  , mExternalInformation({
162  {pExternalInformation.first, pExternalInformation.second}
163  })
164  , mOrigin(pOrigin)
165  {
166  }
167 
168 
169  bool operator ==(const InternalStatus& pOther) const
170  {
171  return mStatusCode == pOther.mStatusCode &&
172  mExternalInformation == pOther.mExternalInformation &&
173  mOrigin == pOther.mOrigin;
174  }
175 
176 
177  };
178 
179  QSharedDataPointer<InternalStatus> d;
180  [[nodiscard]] QString getExternalInfo(ExternalInformation pType) const;
181 
182  [[nodiscard]] QString toErrorDescriptionInternal() const;
183 
184  public:
185  GlobalStatus(Code pStatusCode, const ExternalInfoMap& pExternalInformation, const Origin pOrigin = Origin::Client)
186  : d(new InternalStatus(pStatusCode, pExternalInformation, pOrigin))
187  {
188  }
189 
190 
191  GlobalStatus(Code pStatusCode, const QPair<ExternalInformation, QString>& pExternalInformation, const Origin pOrigin = Origin::Client)
192  : d(new InternalStatus(pStatusCode, pExternalInformation, pOrigin))
193  {
194  }
195 
196 
198  : d(new InternalStatus(pStatusCode, ExternalInfoMap(), pOrigin))
199  {
200  }
201 
202 
203  bool operator ==(const GlobalStatus& pOther) const;
204  [[nodiscard]] bool is(const Code pStatusCode) const;
205 
206  [[nodiscard]] Code getStatusCode() const;
207 
208  [[nodiscard]] QString toErrorDescription(const bool pSimplifiedVersion = false) const;
209  [[nodiscard]] QString getExternalInfo(const QString& pToken = QStringLiteral("; ")) const;
210 
211  [[nodiscard]] Origin getOrigin() const;
212  [[nodiscard]] bool isOriginServer() const;
213 
214  [[nodiscard]] bool isNoError() const;
215  [[nodiscard]] bool isError() const;
216  [[nodiscard]] bool isCancellationByUser() const;
217  [[nodiscard]] bool isMessageMasked() const;
218 };
219 
221 
223 
224 } // namespace governikus
225 
226 
227 QDebug operator <<(QDebug pDbg, const governikus::GlobalStatus& pStatus);
governikus::Enum
Definition: EnumHelper.h:90
governikus::GlobalStatus::getExternalInfo
QString getExternalInfo(const QString &pToken=QStringLiteral("; ")) const
governikus::GlobalStatus::Code::Workflow_TrustedChannel_Server_Format_Error
@ Workflow_TrustedChannel_Server_Format_Error
governikus::GlobalStatus::Code::Workflow_Network_Ssl_Hash_Not_In_Certificate_Description
@ Workflow_Network_Ssl_Hash_Not_In_Certificate_Description
governikus::GlobalStatus::ExternalInformation
ExternalInformation
Definition: GlobalStatus.h:126
governikus::GlobalStatus::Code::Paos_Error_AL_Communication_Error
@ Paos_Error_AL_Communication_Error
governikus::GlobalStatus::Code::Workflow_Certificate_No_Url_In_Description
@ Workflow_Certificate_No_Url_In_Description
defineEnumOperators
#define defineEnumOperators(enumName)
Definition: EnumHelper.h:30
governikus::GlobalStatus::Code::RemoteConnector_RemoteHostRefusedConnection
@ RemoteConnector_RemoteHostRefusedConnection
governikus::GlobalStatus::Code::Workflow_Server_Incomplete_Information_Provided
@ Workflow_Server_Incomplete_Information_Provided
governikus::GlobalStatus::operator==
bool operator==(const GlobalStatus &pOther) const
governikus::operator<<
QDebug operator<<(QDebug pDbg, const CardInfo &pCardInfo)
Definition: CardInfo.cpp:281
governikus::GlobalStatus::GlobalStatus
GlobalStatus(Code pStatusCode=Code::Unknown_Error, const Origin pOrigin=Origin::Client)
Definition: GlobalStatus.h:197
governikus::GlobalStatus::Code::Workflow_Preverification_Developermode_Error
@ Workflow_Preverification_Developermode_Error
Initializer.h
governikus::GlobalStatus::Code::Workflow_Wrong_Parameter_Invocation
@ Workflow_Wrong_Parameter_Invocation
governikus::GlobalStatus::Code::Workflow_No_Unique_AtCvc
@ Workflow_No_Unique_AtCvc
governikus::GlobalStatus::Code::Workflow_Network_Empty_Redirect_Url
@ Workflow_Network_Empty_Redirect_Url
governikus::GlobalStatus::Code::Workflow_TrustedChannel_Other_Network_Error
@ Workflow_TrustedChannel_Other_Network_Error
governikus::GlobalStatus::isNoError
bool isNoError() const
governikus::GlobalStatus::Code
Code
Definition: GlobalStatus.h:26
governikus::GlobalStatus::Code::Workflow_TrustedChannel_No_Data_Received
@ Workflow_TrustedChannel_No_Data_Received
governikus::GlobalStatus::Code::Network_TimeOut
@ Network_TimeOut
governikus::GlobalStatus::Code::Workflow_Unexpected_Message_From_EidServer
@ Workflow_Unexpected_Message_From_EidServer
governikus::GlobalStatus::Code::Card_NewPin_Mismatch
@ Card_NewPin_Mismatch
governikus::GlobalStatus::is
bool is(const Code pStatusCode) const
governikus::GlobalStatus::Code::Workflow_AlreadyInProgress_Error
@ Workflow_AlreadyInProgress_Error
governikus::GlobalStatus::Code::Downloader_Missing_Platform
@ Downloader_Missing_Platform
governikus::GlobalStatus::Code::Workflow_TrustedChannel_Ssl_Certificate_Unsupported_Algorithm_Or_Length
@ Workflow_TrustedChannel_Ssl_Certificate_Unsupported_Algorithm_Or_Length
governikus::GlobalStatus::Code::Paos_Error_AL_Unknown_Error
@ Paos_Error_AL_Unknown_Error
governikus::GlobalStatus::Code::RemoteConnector_InvalidRequest
@ RemoteConnector_InvalidRequest
governikus::GlobalStatus::Code::Workflow_Network_Malformed_Redirect_Url
@ Workflow_Network_Malformed_Redirect_Url
governikus::GlobalStatus::ExternalInformation::REDIRECT_URL
@ REDIRECT_URL
governikus::GlobalStatus::Code::Paos_Error_SAL_Cancellation_by_User
@ Paos_Error_SAL_Cancellation_by_User
governikus::GlobalStatus::Code::Workflow_Processing_Error
@ Workflow_Processing_Error
governikus::GlobalStatus::Code::Paos_Error_AL_Internal_Error
@ Paos_Error_AL_Internal_Error
governikus::GlobalStatus::ExternalInformation::LAST_URL
@ LAST_URL
governikus::GlobalStatus::Code::Workflow_TrustedChannel_Establishment_Error
@ Workflow_TrustedChannel_Establishment_Error
governikus::GlobalStatus::Code::RemoteConnector_ConnectionTimeout
@ RemoteConnector_ConnectionTimeout
governikus::GlobalStatus::Code::Card_Invalid_Can
@ Card_Invalid_Can
governikus::GlobalStatus::toErrorDescription
QString toErrorDescription(const bool pSimplifiedVersion=false) const
governikus::GlobalStatus::Code::Card_NewPin_Invalid_Length
@ Card_NewPin_Invalid_Length
governikus::GlobalStatus::Code::Paos_Generic_Server_Error
@ Paos_Generic_Server_Error
governikus::GlobalStatus::ExternalInformation::ECARDAPI_ERROR
@ ECARDAPI_ERROR
governikus::GlobalStatus::Code::Downloader_Cannot_Save_File
@ Downloader_Cannot_Save_File
governikus::GlobalStatus::isCancellationByUser
bool isCancellationByUser() const
governikus::GlobalStatus::Code::Paos_Unexpected_Warning
@ Paos_Unexpected_Warning
governikus::GlobalStatus::Code::Paos_Error_DP_Trusted_Channel_Establishment_Failed
@ Paos_Error_DP_Trusted_Channel_Establishment_Failed
governikus::GlobalStatus::Code::Unknown_Error
@ Unknown_Error
governikus::GlobalStatus::Code::Downloader_Data_Corrupted
@ Downloader_Data_Corrupted
governikus::GlobalStatus::Code::No_Error
@ No_Error
governikus::GlobalStatus::GlobalStatus
GlobalStatus(Code pStatusCode, const QPair< ExternalInformation, QString > &pExternalInformation, const Origin pOrigin=Origin::Client)
Definition: GlobalStatus.h:191
governikus::GlobalStatus::Code::Workflow_Communication_Missing_Redirect_Url
@ Workflow_Communication_Missing_Redirect_Url
governikus::GlobalStatus::getOrigin
Origin getOrigin() const
governikus::GlobalStatus::Code::Card_Puk_Blocked
@ Card_Puk_Blocked
governikus::GlobalStatus::Code::Card_Protocol_Error
@ Card_Protocol_Error
governikus::GlobalStatus::Code::Workflow_Redirect_Transmission_Error
@ Workflow_Redirect_Transmission_Error
governikus::GlobalStatus::ExternalInformation::URL_SCHEME
@ URL_SCHEME
governikus::GlobalStatus::Code::Workflow_TrustedChannel_Hash_Not_In_Description
@ Workflow_TrustedChannel_Hash_Not_In_Description
GlobalStatus.h
governikus
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15
governikus::GlobalStatus::Code::Workflow_TrustedChannel_TimeOut
@ Workflow_TrustedChannel_TimeOut
INIT_FUNCTION
INIT_FUNCTION([] { qRegisterMetaType< GlobalStatus::Code >("GlobalStatus::Code");qRegisterMetaType< GlobalStatus >("GlobalStatus");}) QString GlobalStatus
Definition: GlobalStatus.cpp:14
governikus::GlobalStatus::Code::Workflow_No_Permission_Error
@ Workflow_No_Permission_Error
governikus::GlobalStatus::ExternalInformation::CERTIFICATE_ISSUER_NAME
@ CERTIFICATE_ISSUER_NAME
governikus::GlobalStatus::Code::Workflow_Unknown_Paos_From_EidServer
@ Workflow_Unknown_Paos_From_EidServer
governikus::GlobalStatus::Code::Workflow_Network_Ssl_Certificate_Unsupported_Algorithm_Or_Length
@ Workflow_Network_Ssl_Certificate_Unsupported_Algorithm_Or_Length
governikus::GlobalStatus::Code::Workflow_No_Unique_DvCvc
@ Workflow_No_Unique_DvCvc
governikus::GlobalStatus::Code::Card_Unexpected_Transmit_Status
@ Card_Unexpected_Transmit_Status
governikus::LanguageLoader::getLocalCode
static QString getLocalCode(const QLocale &pLocale=getInstance().getUsedLocale())
Definition: LanguageLoader.cpp:54
governikus::GlobalStatus::Code::Card_Pin_Not_Blocked
@ Card_Pin_Not_Blocked
governikus::GlobalStatus::Code::Workflow_TrustedChannel_Proxy_Error
@ Workflow_TrustedChannel_Proxy_Error
EnumHelper.h
governikus::GlobalStatus::Code::RemoteConnector_ConnectionError
@ RemoteConnector_ConnectionError
governikus::GlobalStatus::Code::RemoteReader_CloseCode_AbnormalClose
@ RemoteReader_CloseCode_AbnormalClose
governikus::GlobalStatus::Code::Workflow_Certificate_No_Description
@ Workflow_Certificate_No_Description
governikus::GlobalStatus::Code::Card_Not_Found
@ Card_Not_Found
governikus::GlobalStatus::Code::Workflow_Reader_Became_Inaccessible
@ Workflow_Reader_Became_Inaccessible
governikus::GlobalStatus::Code::Card_Communication_Error
@ Card_Communication_Error
governikus::GlobalStatus::GlobalStatus
GlobalStatus(Code pStatusCode, const ExternalInfoMap &pExternalInformation, const Origin pOrigin=Origin::Client)
Definition: GlobalStatus.h:185
governikus::GlobalStatus::Origin::Server
@ Server
governikus::GlobalStatus::Code::Card_Invalid_Puk
@ Card_Invalid_Puk
governikus::GlobalStatus::Origin::Client
@ Client
governikus::GlobalStatus::Code::Downloader_File_Not_Found
@ Downloader_File_Not_Found
governikus::GlobalStatus
Definition: GlobalStatus.h:20
governikus::GlobalStatus::isOriginServer
bool isOriginServer() const
governikus::GlobalStatus::isMessageMasked
bool isMessageMasked() const
governikus::GlobalStatus::Code::Network_Ssl_Establishment_Error
@ Network_Ssl_Establishment_Error
governikus::GlobalStatus::Code::Workflow_Cancellation_By_User
@ Workflow_Cancellation_By_User
governikus::GlobalStatus::Code::Workflow_TrustedChannel_ServiceUnavailable
@ Workflow_TrustedChannel_ServiceUnavailable
governikus::GlobalStatus::Code::Downloader_Aborted
@ Downloader_Aborted
governikus::GlobalStatus::Code::Paos_Error_SAL_Invalid_Key
@ Paos_Error_SAL_Invalid_Key
governikus::GlobalStatus::Code::Network_Proxy_Error
@ Network_Proxy_Error
governikus::GlobalStatus::Code::Card_Invalid_Pin
@ Card_Invalid_Pin
governikus::GlobalStatus::Code::Workflow_Certificate_Hash_Error
@ Workflow_Certificate_Hash_Error
governikus::GlobalStatus::Code::Workflow_Network_Invalid_Scheme
@ Workflow_Network_Invalid_Scheme
governikus::GlobalStatus::ExternalInformation::HTTP_STATUS_CODE
@ HTTP_STATUS_CODE
governikus::GlobalStatus::Code::Workflow_Cannot_Confirm_IdCard_Authenticity
@ Workflow_Cannot_Confirm_IdCard_Authenticity
governikus::GlobalStatus::Code::Network_ServiceUnavailable
@ Network_ServiceUnavailable
governikus::GlobalStatus::isError
bool isError() const
governikus::GlobalStatus::Code::Workflow_TrustedChannel_Error_From_Server
@ Workflow_TrustedChannel_Error_From_Server
governikus::GlobalStatus::Code::Workflow_Error_Page_Transmission_Error
@ Workflow_Error_Page_Transmission_Error
governikus::GlobalStatus::Code::RemoteConnector_NoSupportedApiLevel
@ RemoteConnector_NoSupportedApiLevel
governikus::GlobalStatus::Code::Update_Execution_Failed
@ Update_Execution_Failed
governikus::GlobalStatus::Code::Workflow_Network_Expected_Redirect
@ Workflow_Network_Expected_Redirect
governikus::GlobalStatus::Code::Card_Cancellation_By_User
@ Card_Cancellation_By_User
governikus::GlobalStatus::Origin
Origin
Definition: GlobalStatus.h:121
governikus::GlobalStatus::Code::Card_Pin_Blocked
@ Card_Pin_Blocked
governikus::GlobalStatus::Code::Network_Other_Error
@ Network_Other_Error
governikus::GlobalStatus::Code::Workflow_Card_Removed
@ Workflow_Card_Removed
operator<<
QDebug operator<<(QDebug pDbg, const governikus::GlobalStatus &pStatus)
governikus::GlobalStatus::getStatusCode
Code getStatusCode() const
governikus::GlobalStatus::Code::Workflow_Certificate_Sop_Error
@ Workflow_Certificate_Sop_Error
LanguageLoader.h
governikus::GlobalStatus::Code::Card_ValidityVerificationFailed
@ Card_ValidityVerificationFailed
governikus::GlobalStatus::Code::Workflow_Preverification_Error
@ Workflow_Preverification_Error
governikus::GlobalStatus::Code::Workflow_Network_Ssl_Connection_Unsupported_Algorithm_Or_Length
@ Workflow_Network_Ssl_Connection_Unsupported_Algorithm_Or_Length
governikus::GlobalStatus::Code::Card_Input_TimeOut
@ Card_Input_TimeOut
governikus::GlobalStatus::ExternalInfoMap
QMap< ExternalInformation, QString > ExternalInfoMap
Definition: GlobalStatus.h:136
governikus::GlobalStatus::ExternalInformation::ACTIVATION_ERROR
@ ACTIVATION_ERROR