Heart
1.4.984.b4712811
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-2027 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 "
package.h
"
12
#include <QSharedPointer>
13
#include <
streambase.h
>
14
#include <crc/crchash.h>
15
19
#define PROTOCKOL_VERSION_COMMAND 0xFFFF
20
24
#define PROTOCKOL_VERSION_RECEIVED_COMMAND PROTOCKOL_VERSION_COMMAND - 1
25
33
#define QH_PACKAGE(S) \
34
public: \
35
static unsigned short command(){\
36
QByteArray ba = QString(S).toLocal8Bit();\
37
return qa_common::hash16(ba.data(), ba.size());\
38
} \
39
static QString commandText(){return S;} \
40
unsigned short cmd() const override {return command();} \
41
\
42
QString cmdString() const override {return S;} \
43
private:
44
45
namespace
QH
{
46
namespace
PKG {
47
81
class
HEARTSHARED_EXPORT
AbstractData
:
public
StreamBase
,
public
QuasarAppUtils::iHRO
82
{
83
public
:
84
85
~AbstractData
()
override
;
86
93
virtual
unsigned
short
cmd
()
const
= 0;
94
101
virtual
QString
cmdString
()
const
= 0;
102
111
virtual
bool
toPackage
(
Package
&package,
const
DistVersion
&reqVersion,
unsigned
int
triggerHash = 0)
const
;
112
117
bool
isValid
()
const override
;
118
123
QString
toString
()
const override
;
124
130
template
<
class
C,
class
... Args>
131
C*
create
(Args&&... args)
const
{
132
C*
object
=
new
C(std::forward<Args>(args)...);
133
return
object;
134
}
135
140
void
fromPackage(
const
Package
& pkg);
141
148
static
unsigned
int
command
(){
return
0;};
149
154
static
QString
commandText
(){
return
"NULL"
;};
155
156
protected
:
160
explicit
AbstractData
();
161
162
};
163
164
165
}
166
}
167
168
#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:82
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:20
QH::PKG::AbstractData::isValid
bool isValid() const override
isValid This method check current object to valid.
Definition
abstractdata.cpp:39
QH::PKG::AbstractData::create
C * create(Args &&... args) const
create - This is factory method for create a new object.
Definition
abstractdata.h:131
QH::PKG::AbstractData::command
static unsigned int command()
command This static method that return glaball code of this object.
Definition
abstractdata.h:148
QH::PKG::AbstractData::commandText
static QString commandText()
commandText This method return text of package command
Definition
abstractdata.h:154
QH::PKG::AbstractData::toString
QString toString() const override
toString - Return a string implementation for this object.
Definition
abstractdata.cpp:43
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:17
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