Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
ping.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-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#include "ping.h"
10
11#include <QDataStream>
12namespace QH {
13namespace PKG {
14
16
17}
18
19Ping::Ping(const Package &from): Ping() {
20 fromBytes(from.data);
21}
22
23bool Ping::isValid() const {
24 return AbstractData::isValid();
25}
26
27bool Ping::ansver() const {
28 return _ansver;
29}
30
31void Ping::setAnsver(bool ansver) {
32 _ansver = ansver;
33}
34
35QDataStream &Ping::fromStream(QDataStream &stream) {
36
37 stream >> _ansver;
38 return stream;
39
40}
41
42QDataStream &Ping::toStream(QDataStream &stream) const {
43 stream << _ansver;
44 return stream;
45}
46}
47}
virtual bool isValid() const
isValid This method check current object to valid.
The Ping class - test class for translate data on network.
Definition ping.h:22
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
Definition ping.cpp:35
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
Definition ping.cpp:42
void setAnsver(bool ansver)
setAnsver - Set the answer option.
Definition ping.cpp:31
bool isValid() const override
isValid - Check this package if valid.
Definition ping.cpp:23
bool ansver() const
answer This is bool value for check this object that it is answer or request. Using on tests.
Definition ping.cpp:27
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition package.h:23
QByteArray data
data This is source data of package.
Definition package.h:33
bool fromBytes(const QByteArray &data)
fromBytes This method provide initialization of object from byte array.
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13