Heart 1.4.984.b4712811
Heart is base back end library for your c++ Qt projects.
Loading...
Searching...
No Matches
badrequest.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2027 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#ifndef BADREQUEST_H
9#define BADREQUEST_H
10
11#include "heart_global.h"
12#include "abstractdata.h"
13#include "abstracterrorcodes.h"
14
15namespace QH{
16namespace PKG {
17
21struct HEARTSHARED_EXPORT ErrorData {
25 unsigned char code = 0;
29 QString msg;
30};
31
35class HEARTSHARED_EXPORT BadRequest : public AbstractData
36{
37 QH_PACKAGE("BadRequest")
38public:
39
45 explicit BadRequest(unsigned char errocode = ErrorCodes::InvalidRequest, const QString & err = "");
46
51 explicit BadRequest(const ErrorData& data);
52 explicit BadRequest(const Package& package);
53
58 QString err() const;
59
64 void setErr(const QString &err);
65
66 // StreamBase interface
67 QDataStream &fromStream(QDataStream &stream) override;
68 QDataStream &toStream(QDataStream &stream) const override;
69
74 unsigned char errCode() const;
75
80 void setErrCode(unsigned char code);
81
82private:
83 QString _err;
84 unsigned char _errCode;
85
86};
87}
88}
89
90#endif // BADREQUEST_H
#define QH_PACKAGE(S)
QH_PACKAGE This macross prepare data to send and create a global id for package. For get global id us...
AbstractData()
AbstractData - Base constructor of this object.
void setErrCode(unsigned char code)
setErrCode This method set error code.
QString err() const
err This method return a text of error message.
unsigned char errCode() const
errCode This method return code of error.
void setErr(const QString &err)
setErr - Set a error message.
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
BadRequest(unsigned char errocode=ErrorCodes::InvalidRequest, const QString &err="")
BadRequest.
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition package.h:23
@ InvalidRequest
The sender to remote nodes request is invalid. This is default value.
The PKG namespace - this namespace contains all default packages of the Heart library....
Definition heart.h:211
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13
The ErrorData struct is simple structure for contains data of the error.
Definition badrequest.h:21
unsigned char code
code This is code of error. By Default this member equals EccorCodes::UnknownError.
Definition badrequest.h:25
QString msg
msg This is message of error.
Definition badrequest.h:29