swift
servererror.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_CORE_FSD_SERVERERROR_H
7 #define SWIFT_CORE_FSD_SERVERERROR_H
8 
9 #include "core/fsd/enums.h"
10 #include "core/fsd/messagebase.h"
11 
12 namespace swift::core::fsd
13 {
16  {
17  public:
19  ServerError(const QString &sender, const QString &receiver, ServerErrorCode errorCode,
20  const QString &causingParameter, const QString &description);
21 
23  bool isFatalError() const;
24 
26  QStringList toTokens() const;
27 
29  static ServerError fromTokens(const QStringList &tokens);
30 
32  static QString pdu() { return "$ER"; }
33 
36  const QString &getCausingParameter() const
37  {
38  static const QString n("no details");
39  return m_causingParameter.isEmpty() ? n : m_causingParameter;
40  }
41  const QString &getDescription() const
42  {
43  static const QString n("no description");
44  return m_description.isEmpty() ? n : m_description;
45  }
47 
50  ServerErrorCode m_errorNumber {};
52  QString m_description;
54 
55  private:
57  ServerError();
58  };
59 
61  inline bool operator==(const ServerError &lhs, const ServerError &rhs)
62  {
63  return lhs.sender() == rhs.sender() && lhs.receiver() == rhs.receiver() &&
65  lhs.m_description == rhs.m_description;
66  }
67 
69  inline bool operator!=(const ServerError &lhs, const ServerError &rhs) { return !(lhs == rhs); }
70 } // namespace swift::core::fsd
71 
72 #endif // SWIFT_CORE_FSD_SERVERERROR_H
bool operator!=(const AddAtc &lhs, const AddAtc &rhs)
Not equal operator.
Definition: addatc.h:68
FSD message base class.
Definition: messagebase.h:58
QString sender() const
get message sender
Definition: messagebase.h:73
QString receiver() const
Get message receiver.
Definition: messagebase.h:79
FSD Message Server Error.
Definition: servererror.h:16
static QString pdu()
PDU identifier.
Definition: servererror.h:32
QString m_description
Properties.
Definition: servererror.h:52
const QString & getCausingParameter() const
Getter.
Definition: servererror.h:36
const QString & getDescription() const
Getter.
Definition: servererror.h:41
QString m_causingParameter
Properties.
Definition: servererror.h:51
ServerErrorCode m_errorNumber
Properties.
Definition: servererror.h:50
ServerErrorCode
Server error codes.
Definition: enums.h:99
#define SWIFT_CORE_EXPORT
Export a class or function from the library.