libnick 2024.9.2
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
ipv4address.h
Go to the documentation of this file.
1
23#ifndef IPV4ADDRESS_H
24#define IPV4ADDRESS_H
25
26#include <optional>
27#include <string>
28
29namespace Nickvision::Network
30{
35 {
36 public:
44 IPv4Address(unsigned char first, unsigned char second, unsigned char third, unsigned char fourth);
49 IPv4Address(unsigned long address);
54 unsigned char getFirst() const;
59 unsigned char getSecond() const;
64 unsigned char getThird() const;
69 unsigned char getFourth() const;
74 std::string str() const;
80 static std::optional<IPv4Address> parse(const std::string& address);
81
82 private:
83 unsigned char m_first;
84 unsigned char m_second;
85 unsigned char m_third;
86 unsigned char m_fourth;
87 };
88}
89
90#endif //IPV4ADDRESS_H
A model of an IPv4 address.
Definition ipv4address.h:35
unsigned char getFirst() const
Gets the first byte of the address.
static std::optional< IPv4Address > parse(const std::string &address)
Parses an IPv4Address from a string.
IPv4Address(unsigned char first, unsigned char second, unsigned char third, unsigned char fourth)
Constructs an IPv4Address.
unsigned char getThird() const
Gets the third byte of the address.
std::string str() const
Gets the string representation of the address.
IPv4Address(unsigned long address)
Constructs an IPv4Address.
unsigned char getFourth() const
Gets the fourth byte of the address.
unsigned char getSecond() const
Gets the second byte of the address.
Definition curleasy.h:33