Heart 1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Loading...
Searching...
No Matches
package.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 ABSTRACTPACKAGE_H
9#define ABSTRACTPACKAGE_H
10#include "header.h"
11#include "heart_global.h"
12#include "streambase.h"
13
14#include <QByteArray>
15
16namespace QH {
17
23class HEARTSHARED_EXPORT Package: public StreamBase {
24
25public:
33 QByteArray data;
34
35 Package();
36 virtual ~Package() = default;
37
43 bool isValid() const override;
44
48 virtual void reset();
49
54 QString toString() const;
55
60 unsigned int calcHash() const;
61
66 static unsigned int maximumSize();
67
68 // StreamBase interface
69protected:
70 QDataStream &fromStream(QDataStream &stream) override;
71 QDataStream &toStream(QDataStream &stream) const override;
72};
73
74}
75#endif // ABSTRACTPACKAGE_H
unsigned int calcHash() const
calcHash This method recalc hash sum for this pacakge.
Definition package.cpp:44
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
Definition package.cpp:53
QByteArray data
data This is source data of package.
Definition package.h:33
Header hdr
hdr This is header of package. For more information see the Header struct.
Definition package.h:29
bool isValid() const override
isValid This method validation a current package. Default implementation is checked a header and comp...
Definition package.cpp:18
QString toString() const
toString This method convert a package information to a string label.
Definition package.cpp:38
virtual void reset()
reset This method reset all data and set for package invalid status.
Definition package.cpp:33
static unsigned int maximumSize()
maximumSize This method return maximu size of pacakge. If pacakge large the maximum size then package...
Definition package.cpp:49
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
Definition package.cpp:67
virtual ~Package()=default
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13
The Header struct 32 bytes.
Definition header.h:19