![]() |
Heart 1.3.845.21d07c2
Heart is base back end library for your c++ Qt projects.
|
The StreamBase class add support streaming data for all children classes. For correctly working all serializations functions you need to override fromStream and toStream methods. All implementations of overridden method should be contains a invoke of method of base class. More...
#include <streambase.h>
Public Member Functions | |
StreamBase () | |
virtual | ~StreamBase () |
bool | fromBytes (const QByteArray &data) |
fromBytes This method provide initialization of object from byte array. | |
QByteArray | toBytes () const |
toBytes This method convert a current object to bytes array. | |
bool | fromBase64 (const QString &data) |
fromBase64 This method provide initialization of object from the base64 string. | |
bool | fromBase64 (const QByteArray &data) |
fromBase64 This method provide initialization of object from the base64 string. | |
QByteArray | toBase64 () const |
toBase64 This method convert a current object to the base64 string. | |
template<class T > | |
T & | copy (const StreamBase &right) |
copy This is base copy method for all StreamBase structures. Default implementation it is copy from byteArray. | |
template<class T > | |
bool | compare (const T &right) |
compare This method compare array signatures of this and right objects. | |
Protected Member Functions | |
virtual int | parsingVersion () const |
parsingVersion this method return parsing version of Qt. By Default is 0 (last available parsing). see https://doc.qt.io/qt-6/qdatastream.html#Version-enum | |
virtual QDataStream & | fromStream (QDataStream &stream)=0 |
fromStream This method should be read all bytes from the stream object and full the current object. | |
virtual QDataStream & | toStream (QDataStream &stream) const =0 |
fromStream This method should be write all members of the current object to the stream object. | |
virtual unsigned int | typeId () const |
typeId This method return id of type. | |
Friends | |
HEARTSHARED_EXPORT friend QDataStream & | operator<< (QDataStream &stream, const StreamBase &obj) |
This is wrapper over toStream. | |
HEARTSHARED_EXPORT friend QDataStream & | operator>> (QDataStream &stream, StreamBase &obj) |
This is wraper over fromStream. For see more information see toStream method. | |
The StreamBase class add support streaming data for all children classes. For correctly working all serializations functions you need to override fromStream and toStream methods. All implementations of overridden method should be contains a invoke of method of base class.
Definition at line 27 of file streambase.h.
|
default |
|
virtualdefault |
|
inline |
compare This method compare array signatures of this and right objects.
right | This is comparable object. |
Definition at line 105 of file streambase.h.
|
inline |
copy This is base copy method for all StreamBase structures. Default implementation it is copy from byteArray.
right | input data object. |
Definition at line 90 of file streambase.h.
bool QH::StreamBase::fromBase64 | ( | const QByteArray & | data | ) |
fromBase64 This method provide initialization of object from the base64 string.
data | This is input base64 data. |
Definition at line 51 of file streambase.cpp.
bool QH::StreamBase::fromBase64 | ( | const QString & | data | ) |
fromBase64 This method provide initialization of object from the base64 string.
data | This is input base64 data. |
Definition at line 47 of file streambase.cpp.
bool QH::StreamBase::fromBytes | ( | const QByteArray & | data | ) |
fromBytes This method provide initialization of object from byte array.
Definition at line 21 of file streambase.cpp.
|
protectedpure virtual |
fromStream This method should be read all bytes from the stream object and full the current object.
stream | This is Qt stream object. |
Examle of base simple implementation:
Implemented in QH::AccessToken, QH::DbAddress, QH::PKG::APIVersion, QH::PKG::VersionIsReceived, QH::DistVersion, QH::Package, QH::PKG::BadRequest, QH::PKG::BigDataBase, QH::PKG::BigDataHeader, QH::PKG::BigDataPart, QH::PKG::BigDataRequest, QH::PKG::BigDataWraper, QH::PKG::CloseConnection, QH::PKG::DataPack< Package >, QH::PKG::DBObject, QH::PKG::DBObjectsRequest< T >, QH::PKG::DBObjectsRequestWithStream< T >, QH::PKG::DeleteObject, QH::PKG::Ping, QH::StreamMultiversion, QH::PKG::MultiversionData, and QH::PKG::UniversalData.
|
protectedvirtual |
parsingVersion this method return parsing version of Qt. By Default is 0 (last available parsing). see https://doc.qt.io/qt-6/qdatastream.html#Version-enum
Definition at line 59 of file streambase.cpp.
QByteArray QH::StreamBase::toBase64 | ( | ) | const |
toBase64 This method convert a current object to the base64 string.
Definition at line 55 of file streambase.cpp.
QByteArray QH::StreamBase::toBytes | ( | ) | const |
toBytes This method convert a current object to bytes array.
Definition at line 35 of file streambase.cpp.
|
protectedpure virtual |
fromStream This method should be write all members of the current object to the stream object.
stream | This is Qt stream object. |
Examle of base simple implementation:
Implemented in QH::AccessToken, QH::DbAddress, QH::PKG::APIVersion, QH::PKG::VersionIsReceived, QH::DistVersion, QH::Package, QH::PKG::BadRequest, QH::PKG::BigDataBase, QH::PKG::BigDataHeader, QH::PKG::BigDataPart, QH::PKG::BigDataRequest, QH::PKG::BigDataWraper, QH::PKG::CloseConnection, QH::PKG::DataPack< Package >, QH::PKG::DBObject, QH::PKG::DBObjectsRequest< T >, QH::PKG::DBObjectsRequestWithStream< T >, QH::PKG::DeleteObject, QH::PKG::Ping, QH::StreamMultiversion, QH::PKG::MultiversionData, and QH::PKG::UniversalData.
|
protectedvirtual |
typeId This method return id of type.
Definition at line 63 of file streambase.cpp.
|
friend |
This is wrapper over toStream.
stream | This is qt data stream object. |
obj | This is serialized object. |
Definition at line 67 of file streambase.cpp.
|
friend |
This is wraper over fromStream. For see more information see toStream method.
stream | This is qt data stream object. |
obj | This is serialized object. |
Definition at line 71 of file streambase.cpp.