Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
dbobjectsrequestwithStream.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 DBOBJECTSREQUESTWITHSTREAM_H
9
#define DBOBJECTSREQUESTWITHSTREAM_H
10
11
#include "
dbobjectsrequest.h
"
12
13
#include <QDataStream>
14
15
16
namespace
QH
{
17
namespace
PKG
{
18
25
template
<
class
T>
26
class
HEARTSHARED_EXPORT
DBObjectsRequestWithStream
final:
public
DBObjectsRequest
<T>
27
{
28
public
:
29
34
DBObjectsRequestWithStream
(
const
Package
& pkkg):
DBObjectsRequest
<T>(pkkg) {}
35
43
DBObjectsRequestWithStream
(
const
QString&
table
,
44
const
QString& conditions =
""
):
45
DBObjectsRequest
<T> (
table
, conditions) { };
46
47
protected
:
48
49
QDataStream &
fromStream
(QDataStream &stream)
override
{
50
DBObjectSet::fromStream
(stream);
51
52
int
size = 0;
53
stream >> size;
54
55
for
(
int
i = 0; i < size; ++i) {
56
auto
ptr = QSharedPointer<T>::create();
57
58
stream >> *ptr;
59
60
_data
.push_back(ptr);
61
}
62
63
return
stream;
64
};
65
66
QDataStream &
toStream
(QDataStream &stream)
const override
{
67
DBObjectSet::toStream
(stream);
68
69
stream << static_cast<int>(
_data
.size());
70
71
for
(
auto
object
:
_data
) {
72
stream << *object;
73
}
74
75
return
stream;
76
};
77
78
};
79
80
}
81
}
82
#endif
// DBOBJECTSREQUESTWITHSTREAM_H
QH::PKG::DBObjectSet::table
QString table() const override
table This method should be return name of the database table that should be contains objects with th...
Definition
dbobjectset.cpp:43
QH::PKG::DBObject::toStream
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
Definition
dbobject.cpp:251
QH::PKG::DBObject::fromStream
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
Definition
dbobject.cpp:243
QH::PKG::DBObjectsRequestWithStream::toStream
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
Definition
dbobjectsrequestwithStream.h:66
QH::PKG::DBObjectsRequestWithStream::DBObjectsRequestWithStream
DBObjectsRequestWithStream(const Package &pkkg)
DBObjectsRequest This is default constructor for parsing packages.
Definition
dbobjectsrequestwithStream.h:34
QH::PKG::DBObjectsRequestWithStream::fromStream
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
Definition
dbobjectsrequestwithStream.h:49
QH::PKG::DBObjectsRequestWithStream::DBObjectsRequestWithStream
DBObjectsRequestWithStream(const QString &table, const QString &conditions="")
DBObjectsRequest This contsrucor create a object with request the array of T objects.
Definition
dbobjectsrequestwithStream.h:43
QH::PKG::DBObjectsRequest::DBObjectsRequest
DBObjectsRequest(const Package &pkkg)
DBObjectsRequest This is default constructor for parsing packages.
Definition
dbobjectsrequest.h:41
QH::PKG::DBObjectsRequest::_data
QList< QSharedPointer< T > > _data
Definition
dbobjectsrequest.h:121
QH::Package
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition
package.h:23
dbobjectsrequest.h
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
src
public
packages
dbobjectsrequestwithStream.h
Generated by
1.18.0