Heart 1.4.918.d927d9c
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-2025 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 "abstractdata.h"
12#include "abstracterrorcodes.h"
13
14namespace QH{
15namespace PKG {
16
20struct ErrorData {
24 unsigned char code = 0;
28 QString msg;
29};
30
34class HEARTSHARED_EXPORT BadRequest : public AbstractData
35{
36 QH_PACKAGE("BadRequest")
37public:
38
44 explicit BadRequest(unsigned char errocode = ErrorCodes::InvalidRequest, const QString & err = "");
45
50 explicit BadRequest(const ErrorData& data);
51 explicit BadRequest(const Package& package);
52
57 QString err() const;
58
63 void setErr(const QString &err);
64
65 // StreamBase interface
66 QDataStream &fromStream(QDataStream &stream) override;
67 QDataStream &toStream(QDataStream &stream) const override;
68
73 unsigned char errCode() const;
74
79 void setErrCode(unsigned char code);
80
81private:
82 QString _err;
83 unsigned char _errCode;
84
85};
86}
87}
88
89#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 namesapce - 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:20
unsigned char code
code This is code of error. By Default this member equals EccorCodes::UnknownError.
Definition badrequest.h:24
QString msg
msg This is message of error.
Definition badrequest.h:28