Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
hostaddress.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018-2025 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 HOSTADDRESS_H
10
#define HOSTADDRESS_H
11
#include "heart_global.h"
12
13
#include <QHostAddress>
14
#include "
config.h
"
15
16
namespace
QH
{
17
21
class
HEARTSHARED_EXPORT
HostAddress
:
public
QHostAddress
22
{
23
public
:
24
explicit
HostAddress
();
25
explicit
HostAddress
(
const
QHostAddress& other,
int
port
=
DEFAULT_PORT
);
26
explicit
HostAddress
(
const
QString& other,
int
port
=
DEFAULT_PORT
);
27
HostAddress
(
const
SpecialAddress& other,
int
port
=
DEFAULT_PORT
);
28
29
HostAddress
(
const
HostAddress
& other);
30
31
36
unsigned
short
port
()
const
;
37
42
void
setPort
(
unsigned
short
port
);
43
44
friend
QDataStream& operator << (QDataStream& stream,
const
HostAddress
& address);
45
friend
QDataStream& operator >> (QDataStream& stream,
HostAddress
& address);
46
47
friend
bool
& operator == (QDataStream& stream,
HostAddress
& address);
48
friend
bool
& operator != (QDataStream& stream,
HostAddress
& address);
49
50
HostAddress
& operator = (
const
HostAddress
& right);;
56
static
bool
isIP
(
const
QString& address);
57
62
bool
isValid
()
const
;
63
68
QString
toString
()
const
;
69
74
QByteArray
toBytes
()
const
;
75
81
bool
fromBytes
(
const
QByteArray& array);
82
83
private
:
84
unsigned
short
_port = 0;
85
86
};
87
88
uint
qHash
(
const
HostAddress
& address);
89
}
90
91
Q_DECLARE_METATYPE
(
QH::HostAddress
);
92
93
#endif
// HOSTADDRESS_H
QH::HostAddress
The Host Address class this is wrapper of QHostAddress. Contains the NetworkAddress and network port.
Definition
hostaddress.h:22
QH::HostAddress::toBytes
QByteArray toBytes() const
toBytes This method convert a network address to a byte array.
Definition
hostaddress.cpp:64
QH::HostAddress::HostAddress
HostAddress()
Definition
hostaddress.cpp:14
QH::HostAddress::port
unsigned short port() const
The port method return port of node.
Definition
hostaddress.cpp:37
QH::HostAddress::toString
QString toString() const
toString this method convert the Host Address value to string value.
Definition
hostaddress.cpp:60
QH::HostAddress::setPort
void setPort(unsigned short port)
setPort This method set new port value.
Definition
hostaddress.cpp:41
QH::HostAddress::isValid
bool isValid() const
isValid This method return true if the current network address is valid.
Definition
hostaddress.cpp:56
QH::HostAddress::fromBytes
bool fromBytes(const QByteArray &array)
fromBytes This method applay array obejct. (conver a byte array to a newtwork address object)
Definition
hostaddress.cpp:71
QH::HostAddress::isIP
static bool isIP(const QString &address)
isIP This method return true if the address is valid.
Definition
hostaddress.cpp:52
config.h
DEFAULT_PORT
#define DEFAULT_PORT
Definition
config.h:22
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QH::HostAddress)
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
QH::qHash
uint qHash(NodeCoonectionStatus status)
qHash - Simple hash function of NodeCoonectionStatus
Definition
abstractnodeinfo.cpp:269
src
public
hostaddress.h
Generated by
1.18.0