AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AInet4Address.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 Alex2772 and Contributors
4 *
5 * SPDX-License-Identifier: MPL-2.0
6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 */
11
12#pragma once
13
14#include <cstdint>
15#include <AUI/Common/AString.h>
16#include <AUI/Network.h>
17
18struct sockaddr_in;
19
24class API_AUI_NETWORK AInet4Address
25{
26private:
27 uint32_t mAddr;
28 uint16_t mPort;
29
30public:
31 uint64_t toLong() const;
32 uint32_t toLongAddressOnly() const;
33 AInet4Address();
34 AInet4Address(const sockaddr_in& other);
35 AInet4Address(const AInet4Address& other);
36 AInet4Address(uint8_t ip[4], uint16_t port = -1);
37 AInet4Address(uint32_t ip, uint16_t port = -1);
38 AInet4Address(const AString& addr, uint16_t port = -1);
39
40 sockaddr_in addr() const;
41 bool operator>(const AInet4Address& r) const;
42 bool operator<(const AInet4Address& r) const;
43 bool operator==(const AInet4Address& o) const;
44
45 AString toString() const;
46};
Represents a Unicode character string.
Definition AString.h:37