Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
apiversionparser.h
Go to the documentation of this file.
1//#
2//# Copyright (C) 2022-2024 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
9#ifndef APIVERSIONPARSER_H
10#define APIVERSIONPARSER_H
11
12#include "abstractnodeinfo.h"
13#include "iparser.h"
14
15namespace QH {
16
17namespace PKG {
18class APIVersion;
19class VersionIsReceived;
20}
26{
28public:
30
32 const Header &pkgHeader,
33 AbstractNodeInfo *sender) override;
34 int version() const override;
35 QString parserId() const override;
36
41 QString toString() const override;
42
52 searchPackage(unsigned short cmd,
54
63
71
79
84 unsigned int parsersTypedCount() const;
85
94
102 unsigned short version) const;
103
111 AbstractNodeInfo *sender) const;
112
118 unsigned short maximumApiVersion(const QString& apiKey) const;
119
125 unsigned short minimumApiVersion(const QString& apiKey) const;
126
133
134 unsigned short selectPackageVersion(const VersionData& local, const VersionData& dist);
135
136signals:
137
143 void sigNoLongerSupport(const QString& ApiKey, unsigned short version);
144
145private:
146
148 selectParserImpl(unsigned short cmd, AbstractNodeInfo *sender) const;
149
151 selectParserImpl(const QString& key, AbstractNodeInfo *sender) const;
152
153 bool processAppVersion(const QSharedPointer<PKG::APIVersion> &message,
155 const QH::Header &);
156 bool versionDeliveredSuccessful(const QSharedPointer<PKG::VersionIsReceived> &,
158 const QH::Header &);
159
161
162 // This is internal check of registered commands.
163 // works only in debug.
164 bool commandsValidation(const QSharedPointer<iParser> &parserObject);
165};
166}
167#endif // APIVERSIONPARSER_H
The APIVersionParser class This is main parser forthe main command. This parsers work only with the A...
int version() const override
version This method return version of parser object
QSharedPointer< PKG::AbstractData > searchPackage(unsigned short cmd, AbstractNodeInfo *sender) const
searchPackage This method search package recursive in all registered pararsers. Searching will be in ...
unsigned short minimumApiVersion(const QString &apiKey) const
minimumApiVersion This method return minimum supported api version of this node.
QHash< QString, QSharedPointer< QH::iParser > > selectParser(const VersionData &distVersion) const
selectParser This method select api parser betwin nodes.
unsigned short maximumApiVersion(const QString &apiKey) const
maximumApiVersion This method return maximum supported api version of this node.
const QSharedPointer< QH::iParser > & addApiParser(const QSharedPointer< QH::iParser > &parserObject)
addApiParser This method add new Api parser for this node.
ParserResult parsePackage(const QSharedPointer< PKG::AbstractData > &pkg, const Header &pkgHeader, AbstractNodeInfo *sender) override
parsePackage This is main method of all childs classes of an AbstractNode class. This method work on ...
void sigNoLongerSupport(const QString &ApiKey, unsigned short version)
sigNoLongerSupport This signal will be emit when node receive incomplite versions.
QSharedPointer< iParser > getSelectedApiParser(const QString &apiKey, QH::AbstractNodeInfo *node) const
getSelectedApiParser This method return apiParser for selected node
unsigned int parsersTypedCount() const
parsersTypedCount This method return count of the parsers types.
QString toString() const override
toString This method show all supported commands and them names.
QString parserId() const override
parserId This is id of the parsers. All parser will be synced betwin nodes by ids.
unsigned short selectPackageVersion(const VersionData &local, const VersionData &dist)
bool sendSupportedAPI(AbstractNodeInfo *dist) const
sendSupportedAPI This method sents all ainformation about suppported api.
The AbstractNodeInfo class contains information about client or server connection and tcp socket of n...
The AbstractNode class - Abstract implementation of node. this implementation have a methods for send...
The iParser class This class provide functions for parsing income packages. For yousing just override...
Definition iparser.h:51
void registerPackageType()
registerPackageType This method register package type T. This is need to prepare pacakge for parsing ...
Definition iparser.h:62
AbstractNode * node() const
Definition iparser.cpp:46
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13
ParserResult
The ParserResult enum. Error - parser detect a errorob package. NotProcessed - the parser does not kn...
Definition iparser.h:35
QHash< QString, DistVersion > VersionData
VersionData This is array of all available apis and supported its versions.
Definition distversion.h:73
The Header struct 32 bytes.
Definition header.h:19