Heart 1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Loading...
Searching...
No Matches
multiversiondata.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023-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 MULTIVERSIONDATA_H
9#define MULTIVERSIONDATA_H
10
11#include "abstractdata.h"
12
13
14namespace QH {
15namespace PKG {
16
18 std::function<QDataStream& (QDataStream& stream)> from = nullptr;
19 std::function<QDataStream& (QDataStream& stream)> to = nullptr;
20};
21
67class HEARTSHARED_EXPORT MultiversionData: public AbstractData
68{
69public:
74 MultiversionData(const QMap<unsigned short /*version*/, SerializationBox>& serializers);
75
80 const DistVersion& packageVersion() const;
81
82 QDataStream& fromStream(QDataStream& stream) override final;
83 QDataStream& toStream(QDataStream& stream) const override final;
84
91 QByteArray toBytesOf(const DistVersion &version) const;
92
99 QDataStream& toStreamOf(QDataStream& stream, const DistVersion &version) const;
100
101
102 bool toPackage(Package &package, const DistVersion &reqVersion, unsigned int triggerHash = 0) const override final;
103
104
105private:
106 DistVersion _packageVersion;
107 QMap<unsigned short /*version*/, SerializationBox> _serializers;
108
109
110};
111}
112}
113#endif // MULTIVERSIONDATA_H
The DistVersion class This is information of supported versions of the destinations api.
Definition distversion.h:21
AbstractData()
AbstractData - Base constructor of this object.
QDataStream & toStreamOf(QDataStream &stream, const DistVersion &version) const
toStreamOf This overrload of the base toStream method for support the multi version packages.
QDataStream & fromStream(QDataStream &stream) override final
fromStream This method should be read all bytes from the stream object and full the current object.
QByteArray toBytesOf(const DistVersion &version) const
toBytesOf This is overload method of StreamBase::toBytes for support multi versions of packages.
MultiversionData(const QMap< unsigned short, SerializationBox > &serializers)
MultiversionData main constructor.
bool toPackage(Package &package, const DistVersion &reqVersion, unsigned int triggerHash=0) const override final
toPackage This method convert this class object to the package. For more info see Package class.
const DistVersion & packageVersion() const
packageVersion This method should be return number of the pacakge version.
QDataStream & toStream(QDataStream &stream) const override final
fromStream This method should be write all members of the current object to the stream object.
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition package.h:23
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
std::function< QDataStream &(QDataStream &stream)> to
std::function< QDataStream &(QDataStream &stream)> from