Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
abstractdata.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018-2025 QuasarApp.
3
* Distributed under the GPLv3 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 ABSTRACTDATA_H
9
#define ABSTRACTDATA_H
10
#include "
distversion.h
"
11
#include "humanreadableobject.h"
12
#include "
package.h
"
13
#include <QSharedPointer>
14
#include <
streambase.h
>
15
#include <crc/crchash.h>
16
20
#define PROTOCKOL_VERSION_COMMAND 0xFFFF
21
25
#define PROTOCKOL_VERSION_RECEIVED_COMMAND PROTOCKOL_VERSION_COMMAND - 1
26
34
#define QH_PACKAGE(S) \
35
public: \
36
static unsigned short command(){\
37
QByteArray ba = QString(S).toLocal8Bit();\
38
return qa_common::hash16(ba.data(), ba.size());\
39
} \
40
static QString commandText(){return S;} \
41
unsigned short cmd() const override {return command();} \
42
\
43
QString cmdString() const override {return S;} \
44
private:
45
46
namespace
QH
{
47
namespace
PKG {
48
82
class
HEARTSHARED_EXPORT
AbstractData
:
public
StreamBase
,
public
QuasarAppUtils::iHRO
83
{
84
public
:
85
86
~AbstractData
()
override
;
87
94
virtual
unsigned
short
cmd
()
const
= 0;
95
102
virtual
QString
cmdString
()
const
= 0;
103
112
virtual
bool
toPackage
(
Package
&package,
const
DistVersion
&reqVersion,
unsigned
int
triggerHash = 0)
const
;
113
118
bool
isValid
()
const override
;
119
124
QString
toString
()
const override
;
125
131
template
<
class
C,
class
... Args>
132
C*
create
(Args&&... args)
const
{
133
C*
object
=
new
C(std::forward<Args>(args)...);
134
return
object;
135
}
136
141
void
fromPakcage(
const
Package
& pkg);
142
149
static
unsigned
int
command
(){
return
0;};
150
155
static
QString
commandText
(){
return
"NULL"
;};
156
157
protected
:
161
explicit
AbstractData
();
162
163
};
164
165
166
}
167
}
168
169
#endif
// ABSTRACTDATA_H
QH::DistVersion
The DistVersion class This is information of supported versions of the destinations api.
Definition
distversion.h:21
QH::PKG::AbstractData
The AbstractData class is provide base functions for transport data by network For create you own pac...
Definition
abstractdata.h:83
QH::PKG::AbstractData::toPackage
virtual bool toPackage(Package &package, const DistVersion &reqVersion, unsigned int triggerHash=0) const
toPackage This method convert this class object to the package. For more info see Package class.
Definition
abstractdata.cpp:21
QH::PKG::AbstractData::isValid
bool isValid() const override
isValid This method check current object to valid.
Definition
abstractdata.cpp:40
QH::PKG::AbstractData::create
C * create(Args &&... args) const
create - This is factory method for create a new object.
Definition
abstractdata.h:132
QH::PKG::AbstractData::command
static unsigned int command()
command This static method that return glaball code of this object.
Definition
abstractdata.h:149
QH::PKG::AbstractData::commandText
static QString commandText()
commandText This method return text of package command
Definition
abstractdata.h:155
QH::PKG::AbstractData::toString
QString toString() const override
toString - Return a string implementation for this object.
Definition
abstractdata.cpp:44
QH::PKG::AbstractData::cmdString
virtual QString cmdString() const =0
cmdString - This is command string of this object, (for generate cmd use macross QH_PACKAGE)
QH::PKG::AbstractData::cmd
virtual unsigned short cmd() const =0
cmd - This is command of this object, (for generate cmd use macross QH_PACKAGE)
QH::PKG::AbstractData::AbstractData
AbstractData()
AbstractData - Base constructor of this object.
Definition
abstractdata.cpp:18
QH::Package
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition
package.h:23
QH::StreamBase::StreamBase
StreamBase()
distversion.h
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
package.h
streambase.h
src
public
packages
abstractdata.h
Generated by
1.18.0