eolib-cpp 0.1.0-beta.7
Core C++ library for writing Endless Online applications
Loading...
Searching...
No Matches
eolib::protocol::net::client::PacketFactory Class Reference

Creates client packets from packet family and action identifiers. More...

#include <eolib/protocol/net/client/packet_factory.hpp>

Public Member Functions

 PacketFactory ()=delete

Static Public Member Functions

static std::unique_ptr< Packet > Create (PacketFamily family, PacketAction action)
 Creates a default-initialized client packet with the specified family and action.
static bool Contains (PacketFamily family, PacketAction action) noexcept
 Checks whether a client packet exists with the specified family and action, without creating it.
static std::unique_ptr< Packet > Deserialize (PacketFamily family, PacketAction action, data::EoReader &reader)
 Creates a client packet with the specified family and action, and deserializes it from the reader.

Detailed Description

Creates client packets from packet family and action identifiers.

Constructor & Destructor Documentation

◆ PacketFactory()

eolib::protocol::net::client::PacketFactory::PacketFactory ( )
delete

Member Function Documentation

◆ Create()

std::unique_ptr< Packet > eolib::protocol::net::client::PacketFactory::Create ( PacketFamily family,
PacketAction action )
static

Creates a default-initialized client packet with the specified family and action.

Parameters
familythe packet family.
actionthe packet action.
Returns
the packet, or nullptr if no client packet has the specified family and action.

◆ Contains()

bool eolib::protocol::net::client::PacketFactory::Contains ( PacketFamily family,
PacketAction action )
staticnoexcept

Checks whether a client packet exists with the specified family and action, without creating it.

Parameters
familythe packet family.
actionthe packet action.
Returns
true if a client packet has the specified family and action, otherwise false.

◆ Deserialize()

std::unique_ptr< Packet > eolib::protocol::net::client::PacketFactory::Deserialize ( PacketFamily family,
PacketAction action,
data::EoReader & reader )
static

Creates a client packet with the specified family and action, and deserializes it from the reader.

Parameters
familythe packet family.
actionthe packet action.
readerthe reader that the packet data will be read from.
Returns
the packet, or nullptr if no client packet has the specified family and action.