Public Member Functions | Friends | Related Functions

# HEndpoint Class Reference

Class that represents a network endpoint, which is a combination of a host address and a port number. More...

`#include <HEndpoint>`

List of all members.

## Public Member Functions
| HEndpoint ()
| HEndpoint (const QHostAddress &hostAddress)
| HEndpoint (const QHostAddress &hostAddress, quint16 portNumber)
| HEndpoint (const QUrl &url)
| HEndpoint (const QString &arg)
bool | isNull () const
QHostAddress | hostAddress () const
quint16 | portNumber () const
bool | isMulticast () const
QString | toString () const
## Friends
H_UPNP_CORE_EXPORT bool | operator== (const HEndpoint &, const HEndpoint &)
H_UPNP_CORE_EXPORT quint32 | qHash (const HEndpoint &)
## Related Functions
(Note that these are not member functions.)
H_UPNP_CORE_EXPORT bool | operator!= (const HEndpoint &, const HEndpoint &)

## Detailed Description

Remarks:
  this class provides an assignment operator that is not thread-safe.

## Constructor & Destructor Documentation

HEndpoint | ( |  | ) |

Creates a new instance with host address set to `QHostAddress::Null` and port set to "0".

See also:
  isNull()

HEndpoint | ( | const QHostAddress & | hostAddress | ) |

Creates a new instance with the specified host address and port set to zero.

Parameters:

  | hostAddress | specifies the host address.

See also:
  isNull()

HEndpoint | ( | const QHostAddress & | hostAddress,
|  | quint16 | portNumber |
| ) |  |  |

Creates a new instance with the specified host address and port.

Parameters:

  | hostAddress | specifies the host address. If the host address is null the port number is set to zero.
  | portNumber | specifies the port number.

See also:
  isNull()

HEndpoint | ( | const QUrl & | url | ) |

Creates a new instance from the specified url.

Parameters:

  | url | specifies the url from which the endpoint and port information is extracted (if present). If the URL does not contain a valid host information the port number is set to zero.

See also:
  isNull()

HEndpoint | ( | const QString & | arg | ) |

Creates a new instance from the specified string.

following format "hostAddress:portNumber", where [:portNumber] is optional.

Parameters:

  | arg | specifies the string following format "hostAddress:portNumber", where [:portNumber] is optional. If the hostAddress is `QHostAddress::Null` the port number is set to zero.

See also:
  isNull()

## Member Function Documentation

bool isNull | ( |  | ) | const`[inline]`

Indicates whether or not the end point is properly defined.

Returns:
  true in case the end point is not defined.

QHostAddress hostAddress | ( |  | ) | const`[inline]`

Returns the host address of the endpoint.

Returns:
  the host address of the endpoint.

quint16 portNumber | ( |  | ) | const`[inline]`

Returns the port number of the endpoint.

Returns:
  the port number of the endpoint.

bool isMulticast | ( |  | ) | const

Indicates whether or not the end point refers to a multicast address.

Returns:
  true in case the end point refers to a multicast address.

QString toString | ( |  | ) | const

Returns a string representation of the endpoint.

Returns:
  the address and port number together separated by a ":". E.g `"192.168.0.1:80"`. If the instance is null, i.e. isNull() returns true then an empty string is returned.

## Friends And Related Function Documentation

H_UPNP_CORE_EXPORT bool operator== | ( | const HEndpoint & | ,
|  | const HEndpoint & |  |
| ) |  |  | `[friend]`

Compares the two objects for equality.

Returns:
  true in case the object are logically equivalent.

H_UPNP_CORE_EXPORT quint32 qHash | ( | const HEndpoint & |  | ) | `[friend]`

Returns a value that can be used as a unique key in a hash-map identifying the object.

Parameters:

  | key | specifies the object from which the hash value is created.

Returns:
  a value that can be used as a unique key in a hash-map identifying the object.

H_UPNP_CORE_EXPORT bool operator!= | ( | const HEndpoint & | ,
|  | const HEndpoint & |  |
| ) |  |  | `[related]`

Compares the two objects for inequality.

Returns:
  true in case the object are not logically equivalent.