|
NetSim 1.0.0
An educational network simulation software for students
|
Represents an IPv4 address. More...
#include <ipaddress.h>
Public Member Functions | |
| IPAddress ()=default | |
| Default constructor. | |
| IPAddress (const QVector< quint8 > &address) | |
| Constructs an IPAddress from a given byte array. | |
| QString | toString () const |
| Converts the IP address to a string format. | |
| QVector< quint8 > | toArray () const |
| Converts the IP address to a byte array. | |
| quint32 | toInt () const |
| Converts the IP address to an integer format. | |
| bool | operator< (const IPAddress &other) const |
| Overload of the less than operator. | |
| bool | operator== (const IPAddress &other) const |
| Overload of the equality operator. | |
Static Public Member Functions | |
| static IPAddress | getRandomAddress (bool isLocal=false) |
| Generates a random IP address. | |
Represents an IPv4 address.
This class provides functionalities to represent an IPv4 address, and offers various conversion utilities like converting to string, array or an integer format.
|
default |
Default constructor.

| IPAddress::IPAddress | ( | const QVector< quint8 > & | address | ) |
Constructs an IPAddress from a given byte array.
| address | A byte array representing the IP address. |
|
static |
Generates a random IP address.
If the isLocal parameter is true, the last byte of the IP address is set to 1.
| isLocal | Whether the IP address should be local or not. |


| bool IPAddress::operator< | ( | const IPAddress & | other | ) | const |
Overload of the less than operator.
Compares this IP address to another based on their integer format.
| other | The other IP address to compare against. |

| bool IPAddress::operator== | ( | const IPAddress & | other | ) | const |
Overload of the equality operator.
Checks if this IP address is equal to another based on their integer format.
| other | The other IP address to compare against. |

| QVector< quint8 > IPAddress::toArray | ( | ) | const |
Converts the IP address to a byte array.

| quint32 IPAddress::toInt | ( | ) | const |
Converts the IP address to an integer format.

| QString IPAddress::toString | ( | ) | const |
Converts the IP address to a string format.
