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

Reply to selecting a character / entering game. More...

#include <eolib/protocol/net/server/packets.hpp>

Inherits eolib::protocol::net::Packet.

Classes

class  WelcomeCodeDataSelectCharacter
 Data associated with welcome_code value SelectCharacter. More...
class  WelcomeCodeDataEnterGame
 Data associated with welcome_code value EnterGame. More...

Public Types

using WelcomeCodeData = std::variant<std::monostate, WelcomeCodeDataSelectCharacter, WelcomeCodeDataEnterGame>
 Data associated with different values of the welcome_code field.

Public Member Functions

const WelcomeCodeDataSelectCharacter * AsSelectCharacter () const noexcept
 Gets the data associated with welcome_code value SelectCharacter.
WelcomeCodeDataSelectCharacter * AsSelectCharacter () noexcept
 Gets the data associated with welcome_code value SelectCharacter.
const WelcomeCodeDataEnterGame * AsEnterGame () const noexcept
 Gets the data associated with welcome_code value EnterGame.
WelcomeCodeDataEnterGame * AsEnterGame () noexcept
 Gets the data associated with welcome_code value EnterGame.
PacketFamily Family () const noexcept override
 Gets the packet family associated with this packet.
PacketAction Action () const noexcept override
 Gets the packet action associated with this packet.
int ByteSize () const noexcept override
 Gets the size of the data that this object was deserialized from.
void Serialize (data::EoWriter &writer) const override
 Serializes this object to the provided writer.
void Deserialize (data::EoReader &reader) override
 Deserializes this object from the provided reader, replacing its current data.
std::string ToString () const override
 Gets a human-readable representation of this object, for debugging purposes.
bool operator== (const WelcomeReplyServerPacket &other) const
 Compares this object with another for equality.
bool operator!= (const WelcomeReplyServerPacket &other) const
 Compares this object with another for inequality.
Public Member Functions inherited from eolib::protocol::Serializable
virtual ~Serializable ()=default

Static Public Member Functions

static WelcomeReplyServerPacket ForSelectCharacter (WelcomeCodeDataSelectCharacter data)
 Creates a new WelcomeReplyServerPacket with welcome_code set to SelectCharacter.
static WelcomeReplyServerPacket ForEnterGame (WelcomeCodeDataEnterGame data)
 Creates a new WelcomeReplyServerPacket with welcome_code set to EnterGame.
static WelcomeReplyServerPacket ForServerBusy ()
 Creates a new WelcomeReplyServerPacket with welcome_code set to ServerBusy.
static WelcomeReplyServerPacket ForLoggedIn ()
 Creates a new WelcomeReplyServerPacket with welcome_code set to LoggedIn.

Public Attributes

WelcomeCode welcome_code {}
WelcomeCodeData welcome_code_data {}
 Data associated with the welcome_code field.

Static Public Attributes

static constexpr PacketFamily FAMILY = PacketFamily::Welcome
 The packet family associated with this packet.
static constexpr PacketAction ACTION = PacketAction::Reply
 The packet action associated with this packet.

Additional Inherited Members

Protected Member Functions inherited from eolib::protocol::Serializable
 Serializable ()=default
 Serializable (const Serializable &)=default
 Serializable (Serializable &&)=default
Serializable & operator= (const Serializable &)=default
Serializable & operator= (Serializable &&)=default

Detailed Description

Reply to selecting a character / entering game.

Member Typedef Documentation

◆ WelcomeCodeData

Data associated with different values of the welcome_code field.

Member Function Documentation

◆ AsSelectCharacter() [1/2]

const WelcomeCodeDataSelectCharacter * eolib::protocol::net::server::WelcomeReplyServerPacket::AsSelectCharacter ( ) const
inlinenoexcept

Gets the data associated with welcome_code value SelectCharacter.

Returns
the data, or nullptr if welcome_code_data holds the data for a different value.

◆ AsSelectCharacter() [2/2]

WelcomeCodeDataSelectCharacter * eolib::protocol::net::server::WelcomeReplyServerPacket::AsSelectCharacter ( )
inlinenoexcept

Gets the data associated with welcome_code value SelectCharacter.

Returns
the data, or nullptr if welcome_code_data holds the data for a different value.

◆ AsEnterGame() [1/2]

const WelcomeCodeDataEnterGame * eolib::protocol::net::server::WelcomeReplyServerPacket::AsEnterGame ( ) const
inlinenoexcept

Gets the data associated with welcome_code value EnterGame.

Returns
the data, or nullptr if welcome_code_data holds the data for a different value.

◆ AsEnterGame() [2/2]

WelcomeCodeDataEnterGame * eolib::protocol::net::server::WelcomeReplyServerPacket::AsEnterGame ( )
inlinenoexcept

Gets the data associated with welcome_code value EnterGame.

Returns
the data, or nullptr if welcome_code_data holds the data for a different value.

◆ ForSelectCharacter()

WelcomeReplyServerPacket eolib::protocol::net::server::WelcomeReplyServerPacket::ForSelectCharacter ( WelcomeCodeDataSelectCharacter data)
static

Creates a new WelcomeReplyServerPacket with welcome_code set to SelectCharacter.

Parameters
datathe data associated with welcome_code SelectCharacter.
Returns
the created object.

◆ ForEnterGame()

WelcomeReplyServerPacket eolib::protocol::net::server::WelcomeReplyServerPacket::ForEnterGame ( WelcomeCodeDataEnterGame data)
static

Creates a new WelcomeReplyServerPacket with welcome_code set to EnterGame.

Parameters
datathe data associated with welcome_code EnterGame.
Returns
the created object.

◆ ForServerBusy()

WelcomeReplyServerPacket eolib::protocol::net::server::WelcomeReplyServerPacket::ForServerBusy ( )
static

Creates a new WelcomeReplyServerPacket with welcome_code set to ServerBusy.

Returns
the created object.

◆ ForLoggedIn()

WelcomeReplyServerPacket eolib::protocol::net::server::WelcomeReplyServerPacket::ForLoggedIn ( )
static

Creates a new WelcomeReplyServerPacket with welcome_code set to LoggedIn.

Returns
the created object.

◆ Family()

PacketFamily eolib::protocol::net::server::WelcomeReplyServerPacket::Family ( ) const
inlineoverridevirtualnoexcept

Gets the packet family associated with this packet.

Returns
the packet family.

Implements eolib::protocol::net::Packet.

◆ Action()

PacketAction eolib::protocol::net::server::WelcomeReplyServerPacket::Action ( ) const
inlineoverridevirtualnoexcept

Gets the packet action associated with this packet.

Returns
the packet action.

Implements eolib::protocol::net::Packet.

◆ ByteSize()

int eolib::protocol::net::server::WelcomeReplyServerPacket::ByteSize ( ) const
overridevirtualnoexcept

Gets the size of the data that this object was deserialized from.

Returns
the deserialized size in bytes, or 0 for an object that was not deserialized.

Implements eolib::protocol::Serializable.

◆ Serialize()

void eolib::protocol::net::server::WelcomeReplyServerPacket::Serialize ( data::EoWriter & writer) const
overridevirtual

Serializes this object to the provided writer.

Parameters
writerthe writer that the data will be written to.
Exceptions
SerializationErrorif the object's data is invalid for serialization.

Implements eolib::protocol::Serializable.

◆ Deserialize()

void eolib::protocol::net::server::WelcomeReplyServerPacket::Deserialize ( data::EoReader & reader)
overridevirtual

Deserializes this object from the provided reader, replacing its current data.

Parameters
readerthe reader that the data will be read from.

Implements eolib::protocol::Serializable.

◆ ToString()

std::string eolib::protocol::net::server::WelcomeReplyServerPacket::ToString ( ) const
overridevirtual

Gets a human-readable representation of this object, for debugging purposes.

Returns
the object's fields and values, as a string.

Implements eolib::protocol::Serializable.

◆ operator==()

bool eolib::protocol::net::server::WelcomeReplyServerPacket::operator== ( const WelcomeReplyServerPacket & other) const

Compares this object with another for equality.

The deserialized byte size is not compared.

Parameters
otherthe object to compare with.
Returns
true if all fields are equal, otherwise false.

◆ operator!=()

bool eolib::protocol::net::server::WelcomeReplyServerPacket::operator!= ( const WelcomeReplyServerPacket & other) const

Compares this object with another for inequality.

The deserialized byte size is not compared.

Parameters
otherthe object to compare with.
Returns
true if any field differs, otherwise false.

Member Data Documentation

◆ FAMILY

PacketFamily eolib::protocol::net::server::WelcomeReplyServerPacket::FAMILY = PacketFamily::Welcome
staticconstexpr

The packet family associated with this packet.

◆ ACTION

PacketAction eolib::protocol::net::server::WelcomeReplyServerPacket::ACTION = PacketAction::Reply
staticconstexpr

The packet action associated with this packet.

◆ welcome_code

WelcomeCode eolib::protocol::net::server::WelcomeReplyServerPacket::welcome_code {}

◆ welcome_code_data

WelcomeCodeData eolib::protocol::net::server::WelcomeReplyServerPacket::welcome_code_data {}

Data associated with the welcome_code field.