Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
badrequest.cpp
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
#include "
badrequest.h
"
9
10
#include <QDataStream>
11
12
namespace
QH
{
13
namespace
PKG
{
14
15
16
BadRequest::BadRequest
(
unsigned
char
errocode,
const
QString &
err
) {
17
setErr
(
err
);
18
setErrCode
(errocode);
19
}
20
21
BadRequest::BadRequest
(
const
ErrorData
&data):
22
BadRequest
(data.code, data.msg) {
23
}
24
25
BadRequest::BadRequest
(
const
Package
&package):
26
BadRequest
() {
27
fromBytes
(package.
data
);
28
}
29
30
QDataStream &
BadRequest::fromStream
(QDataStream &stream) {
31
stream >> _errCode;
32
stream >> _err;
33
34
return
stream;
35
}
36
37
QDataStream &
BadRequest::toStream
(QDataStream &stream)
const
{
38
39
stream << _errCode;
40
stream << _err;
41
42
return
stream;
43
}
44
45
unsigned
char
BadRequest::errCode
()
const
{
46
return
_errCode;
47
48
}
49
50
void
BadRequest::setErrCode
(
unsigned
char
code) {
51
_errCode = code;
52
}
53
54
QString
BadRequest::err
()
const
{
55
return
_err;
56
}
57
58
void
BadRequest::setErr
(
const
QString &
err
) {
59
_err =
err
;
60
}
61
}
62
}
badrequest.h
QH::PKG::BadRequest::setErrCode
void setErrCode(unsigned char code)
setErrCode This method set error code.
Definition
badrequest.cpp:50
QH::PKG::BadRequest::err
QString err() const
err This method return a text of error message.
Definition
badrequest.cpp:54
QH::PKG::BadRequest::errCode
unsigned char errCode() const
errCode This method return code of error.
Definition
badrequest.cpp:45
QH::PKG::BadRequest::setErr
void setErr(const QString &err)
setErr - Set a error message.
Definition
badrequest.cpp:58
QH::PKG::BadRequest::fromStream
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
Definition
badrequest.cpp:30
QH::PKG::BadRequest::toStream
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
Definition
badrequest.cpp:37
QH::PKG::BadRequest::BadRequest
BadRequest(unsigned char errocode=ErrorCodes::InvalidRequest, const QString &err="")
BadRequest.
Definition
badrequest.cpp:16
QH::Package
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition
package.h:23
QH::Package::data
QByteArray data
data This is source data of package.
Definition
package.h:33
QH::StreamBase::fromBytes
bool fromBytes(const QByteArray &dataz)
fromBytes This method provide initialization of object from byte array.
Definition
streambase.cpp:21
QH::PKG
The PKG namesapce - this namespace contains all default packages of the Heart library....
Definition
heart.h:211
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
QH::PKG::ErrorData
The ErrorData struct is simple structure for contains data of the error.
Definition
badrequest.h:20
src
public
packages
badrequest.cpp
Generated by
1.18.0