Heart 1.3.848.aa44c26
Heart is base back end library for your c++ Qt projects.
|
The APIVersionParser class This is main parser forthe main command. This parsers work only with the APIVersion packge;. More...
#include <apiversionparser.h>
Signals | |
void | sigNoLongerSupport (const QString &ApiKey, unsigned short version) |
sigNoLongerSupport This signal will be emit when node receive incomplite versions. | |
Public Member Functions | |
APIVersionParser (AbstractNode *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 own thread. If you ovveride this method you need to create this than an example: | |
int | version () const override |
version This method return version of parser object | |
QString | parserId () const override |
parserId This is id of the parsers. All parser will be synced betwin nodes by ids. | |
QString | toString () const override |
toString This method show all supported commands and them names. | |
QSharedPointer< PKG::AbstractData > | searchPackage (unsigned short cmd, AbstractNodeInfo *sender) const |
searchPackage This method search package recursive in all registered pararsers. Searching will be in compatibility versions. Before search methd choose compatibly verson. | |
QSharedPointer< iParser > | getSelectedApiParser (const QString &apiKey, QH::AbstractNodeInfo *node) const |
getSelectedApiParser This method return apiParser for selected node | |
const QSharedPointer< QH::iParser > & | addApiParser (const QSharedPointer< QH::iParser > &parserObject) |
addApiParser This method add new Api parser for this node. | |
QHash< QString, QSharedPointer< QH::iParser > > | selectParser (const VersionData &distVersion) const |
selectParser This method select api parser betwin nodes. | |
unsigned int | parsersTypedCount () const |
parsersTypedCount This method return count of the parsers types. | |
QSharedPointer< QH::iParser > | selectParser (unsigned short cmd, AbstractNodeInfo *sender) const |
selectParser This method select parser by command and sender. | |
QSharedPointer< QH::iParser > | selectParser (const QString &parserKey, unsigned short version) const |
selectParser This method select parser by command and sender. | |
QSharedPointer< QH::iParser > | selectParser (const QString &parserKey, AbstractNodeInfo *sender) const |
selectParser This method select parser by command and sender. | |
unsigned short | maximumApiVersion (const QString &apiKey) const |
maximumApiVersion This method return maximum supported api version of this node. | |
unsigned short | minimumApiVersion (const QString &apiKey) const |
minimumApiVersion This method return minimum supported api version of this node. | |
bool | sendSupportedAPI (AbstractNodeInfo *dist) const |
sendSupportedAPI This method sents all ainformation about suppported api. | |
unsigned short | selectPackageVersion (const VersionData &local, const VersionData &dist) |
Public Member Functions inherited from QH::iParser | |
iParser (AbstractNode *parentNode) | |
virtual | ~iParser ()=default |
template<class T > | |
void | registerPackageType () |
registerPackageType This method register package type T. This is need to prepare pacakge for parsing in the parsePackage method. | |
template<class PackageClass , class HandlerType , class HandlerMethod > | |
ParserResult | commandHandler (HandlerType handlerObject, HandlerMethod method, const QSharedPointer< QH::PKG::AbstractData > &pkg, QH::AbstractNodeInfo *sender, const QH::Header &pkgHeader) |
commandHandler This method it is simple wrapper for the handle pacakges in the AbstractNode::parsePackage method. Exmaple of use : | |
const PacksMap & | registeredTypes () const |
registeredTypes This method return list of registered command. | |
QSharedPointer< PKG::AbstractData > | genPackage (unsigned short cmd) const |
genPackage This is factory method that generate data pacakge objects by command. All object should be registered before using this method. | |
bool | checkCommand (unsigned short cmd) const |
checkCommand This method check command are if registered type or not. | |
virtual void | initSupportedCommands () |
initSupportedCommands This method will be invoked before add a parser into parser's storage. Use this method to register your command for this parser object. By default, this method does nothing, You still can register your command in the class constructor. But if you use inheritance between your APIs versions to you must use this method, because your constructors both all your commands, this broken API selector of your node. | |
QString | toString () const override |
const PackagesVersionData & | multiVersionPackages () const |
multiVersionPackages return list of the supported multiversions packages. | |
Additional Inherited Members | |
Static Public Member Functions inherited from QH::iParser | |
static QString | pareseResultToString (const ParserResult &parseResult) |
pareseResultToString This method convert ParserResult value to string. | |
Protected Member Functions inherited from QH::iParser | |
AbstractNode * | node () const |
virtual unsigned int | sendData (const PKG::AbstractData *resp, const HostAddress &address, const Header *req=nullptr) const |
sendData This method send data object another to node | |
virtual unsigned int | sendData (const PKG::AbstractData *resp, const AbstractNodeInfo *node, const Header *req=nullptr) const |
sendData This method send data object another to node | |
The APIVersionParser class This is main parser forthe main command. This parsers work only with the APIVersion packge;.
Definition at line 25 of file apiversionparser.h.
QH::APIVersionParser::APIVersionParser | ( | AbstractNode * | node | ) |
Definition at line 22 of file apiversionparser.cpp.
const QSharedPointer< QH::iParser > & QH::APIVersionParser::addApiParser | ( | const QSharedPointer< QH::iParser > & | parserObject | ) |
addApiParser This method add new Api parser for this node.
parserObject | This is bew api parser. |
Definition at line 160 of file apiversionparser.cpp.
QSharedPointer< iParser > QH::APIVersionParser::getSelectedApiParser | ( | const QString & | apiKey, |
QH::AbstractNodeInfo * | node | ||
) | const |
getSelectedApiParser This method return apiParser for selected node
apiKey | This is key of needed api. |
node | This is distanation node. |
Definition at line 115 of file apiversionparser.cpp.
maximumApiVersion This method return maximum supported api version of this node.
apiKey | This is api key. |
Definition at line 255 of file apiversionparser.cpp.
minimumApiVersion This method return minimum supported api version of this node.
apiKey | This is api key. |
Definition at line 265 of file apiversionparser.cpp.
|
overridevirtual |
parsePackage This is main method of all childs classes of an AbstractNode class. This method work on own thread. If you ovveride this method you need to create this than an example:
pkg | This is package with incomming data. |
sender | This is sender this pacakge. |
pkgHeader | This is header of the incoming packet is used to create a response. |
Implements QH::iParser.
Definition at line 26 of file apiversionparser.cpp.
|
overridevirtual |
parserId This is id of the parsers. All parser will be synced betwin nodes by ids.
Implements QH::iParser.
Definition at line 65 of file apiversionparser.cpp.
parsersTypedCount This method return count of the parsers types.
Definition at line 192 of file apiversionparser.cpp.
QSharedPointer< PKG::AbstractData > QH::APIVersionParser::searchPackage | ( | unsigned short | cmd, |
AbstractNodeInfo * | sender | ||
) | const |
searchPackage This method search package recursive in all registered pararsers. Searching will be in compatibility versions. Before search methd choose compatibly verson.
cmd | This is command for that shold be create pacakge object. |
ver | This is version for that shold be create pacakge object. |
sender | This is node that sent the cmd. |
Definition at line 83 of file apiversionparser.cpp.
unsigned short QH::APIVersionParser::selectPackageVersion | ( | const VersionData & | local, |
const VersionData & | dist | ||
) |
QSharedPointer< iParser > QH::APIVersionParser::selectParser | ( | const QString & | parserKey, |
AbstractNodeInfo * | sender | ||
) | const |
selectParser This method select parser by command and sender.
parserKey | this is key of the parser type.. |
sender | this is node that sent this command. |
Definition at line 206 of file apiversionparser.cpp.
QSharedPointer< iParser > QH::APIVersionParser::selectParser | ( | const QString & | parserKey, |
unsigned short | version | ||
) | const |
selectParser This method select parser by command and sender.
parserKey | this is key of the parser type.. |
version | this is needed version. |
Definition at line 219 of file apiversionparser.cpp.
QHash< QString, QSharedPointer< iParser > > QH::APIVersionParser::selectParser | ( | const VersionData & | distVersion | ) | const |
selectParser This method select api parser betwin nodes.
distVersion | This is information about distanation node version. |
Definition at line 176 of file apiversionparser.cpp.
QSharedPointer< iParser > QH::APIVersionParser::selectParser | ( | unsigned short | cmd, |
AbstractNodeInfo * | sender | ||
) | const |
selectParser This method select parser by command and sender.
cmd | this is command that need to parse. |
sender | this is node that sent this command. |
Definition at line 196 of file apiversionparser.cpp.
bool QH::APIVersionParser::sendSupportedAPI | ( | AbstractNodeInfo * | dist | ) | const |
sendSupportedAPI This method sents all ainformation about suppported api.
dist | This is distanation node. |
Definition at line 274 of file apiversionparser.cpp.
|
signal |
sigNoLongerSupport This signal will be emit when node receive incomplite versions.
ApiKey | This is key of not supported version. |
version | This is version |
|
override |
toString This method show all supported commands and them names.
Definition at line 69 of file apiversionparser.cpp.
|
overridevirtual |
version This method return version of parser object
Implements QH::iParser.
Definition at line 61 of file apiversionparser.cpp.