R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ENetAddress.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Created by IamSwan on 06/12/2025.
4** File description:
5** ENetAddress.hpp
6*/
7
8#pragma once
9
10#include <enet/enet.h>
11#include <string>
12#include "IAddress.hpp"
13
14class ENetAddressWrapper final : public IAddress {
15 public:
16 explicit ENetAddressWrapper(const std::string &hostname, uint16_t port);
17 explicit ENetAddressWrapper(const ENetAddress &address);
20
21 [[nodiscard]] std::string getHost() const override;
22 [[nodiscard]] uint16_t getPort() const override;
23 void setHost(const std::string &hostname) override;
24 void setPort(uint16_t port) override;
25
26 [[nodiscard]] const ENetAddress &getNativeAddress() const;
27 [[nodiscard]] ENetAddress &getNativeAddress();
28
29 private:
30 ENetAddress _address;
31};
void setHost(const std::string &hostname) override
Set the hostname or IP address.
std::string getHost() const override
Get the hostname or IP address as a string.
ENetAddressWrapper & operator=(const ENetAddressWrapper &other)
ENetAddress _address
uint16_t getPort() const override
Get the port number.
void setPort(uint16_t port) override
Set the port number.
const ENetAddress & getNativeAddress() const
Interface representing a network address (IP + port).
Definition IAddress.hpp:21