2024-03-19 21:10:31 +01:00
|
|
|
/*
|
2024-12-30 22:44:47 +01:00
|
|
|
* Copyright (C) 2024-2025 QuasarApp.
|
2024-03-19 21:10:31 +01:00
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef STREAMMULTIVERSION_H
|
|
|
|
#define STREAMMULTIVERSION_H
|
|
|
|
|
|
|
|
#include "streambase.h"
|
|
|
|
|
|
|
|
namespace QH {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The StreamMultiversion class this parser works with simple multiversion packages.
|
|
|
|
*/
|
|
|
|
class HEARTSHARED_EXPORT StreamMultiversion: public StreamBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
StreamMultiversion();
|
|
|
|
|
|
|
|
// StreamBase interface
|
|
|
|
/**
|
|
|
|
* @brief version override this method to sets version of package.
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
virtual int version() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief realVersion This method return value of the version that was be saved in the bytes array.
|
|
|
|
* @return
|
|
|
|
* @note use this method to check version of read package in the fromStream method..
|
|
|
|
*/
|
|
|
|
virtual int realVersion() const;
|
2024-03-24 21:23:27 +01:00
|
|
|
protected:
|
|
|
|
QDataStream &fromStream(QDataStream &stream) override;
|
|
|
|
QDataStream &toStream(QDataStream &stream) const override;
|
|
|
|
|
|
|
|
|
2024-03-19 21:10:31 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
int _realVersion = 0;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // STREAMMULTIVERSION_H
|