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

Login reply. More...

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

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

Classes

class  ReplyCodeDataWrongUser
 Data associated with reply_code value WrongUser. More...
class  ReplyCodeDataWrongUserPassword
 Data associated with reply_code value WrongUserPassword. More...
class  ReplyCodeDataOk
 Data associated with reply_code value Ok. More...
class  ReplyCodeDataBanned
 Data associated with reply_code value Banned. More...
class  ReplyCodeDataLoggedIn
 Data associated with reply_code value LoggedIn. More...
class  ReplyCodeDataBusy
 Data associated with reply_code value Busy. More...

Public Types

using ReplyCodeData = std::variant<std::monostate, ReplyCodeDataWrongUser, ReplyCodeDataWrongUserPassword, ReplyCodeDataOk, ReplyCodeDataBanned, ReplyCodeDataLoggedIn, ReplyCodeDataBusy>
 Data associated with different values of the reply_code field.

Public Member Functions

const ReplyCodeDataWrongUser * AsWrongUser () const noexcept
 Gets the data associated with reply_code value WrongUser.
ReplyCodeDataWrongUser * AsWrongUser () noexcept
 Gets the data associated with reply_code value WrongUser.
const ReplyCodeDataWrongUserPassword * AsWrongUserPassword () const noexcept
 Gets the data associated with reply_code value WrongUserPassword.
ReplyCodeDataWrongUserPassword * AsWrongUserPassword () noexcept
 Gets the data associated with reply_code value WrongUserPassword.
const ReplyCodeDataOk * AsOk () const noexcept
 Gets the data associated with reply_code value Ok.
ReplyCodeDataOk * AsOk () noexcept
 Gets the data associated with reply_code value Ok.
const ReplyCodeDataBanned * AsBanned () const noexcept
 Gets the data associated with reply_code value Banned.
ReplyCodeDataBanned * AsBanned () noexcept
 Gets the data associated with reply_code value Banned.
const ReplyCodeDataLoggedIn * AsLoggedIn () const noexcept
 Gets the data associated with reply_code value LoggedIn.
ReplyCodeDataLoggedIn * AsLoggedIn () noexcept
 Gets the data associated with reply_code value LoggedIn.
const ReplyCodeDataBusy * AsBusy () const noexcept
 Gets the data associated with reply_code value Busy.
ReplyCodeDataBusy * AsBusy () noexcept
 Gets the data associated with reply_code value Busy.
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 LoginReplyServerPacket &other) const
 Compares this object with another for equality.
bool operator!= (const LoginReplyServerPacket &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 LoginReplyServerPacket ForWrongUser ()
 Creates a new LoginReplyServerPacket with reply_code set to WrongUser.
static LoginReplyServerPacket ForWrongUserPassword ()
 Creates a new LoginReplyServerPacket with reply_code set to WrongUserPassword.
static LoginReplyServerPacket ForOk (ReplyCodeDataOk data)
 Creates a new LoginReplyServerPacket with reply_code set to Ok.
static LoginReplyServerPacket ForBanned ()
 Creates a new LoginReplyServerPacket with reply_code set to Banned.
static LoginReplyServerPacket ForLoggedIn ()
 Creates a new LoginReplyServerPacket with reply_code set to LoggedIn.
static LoginReplyServerPacket ForBusy ()
 Creates a new LoginReplyServerPacket with reply_code set to Busy.

Public Attributes

LoginReply reply_code {}
ReplyCodeData reply_code_data {}
 Data associated with the reply_code field.

Static Public Attributes

static constexpr PacketFamily FAMILY = PacketFamily::Login
 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

Login reply.

Member Typedef Documentation

◆ ReplyCodeData

Member Function Documentation

◆ AsWrongUser() [1/2]

const ReplyCodeDataWrongUser * eolib::protocol::net::server::LoginReplyServerPacket::AsWrongUser ( ) const
inlinenoexcept

Gets the data associated with reply_code value WrongUser.

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

◆ AsWrongUser() [2/2]

ReplyCodeDataWrongUser * eolib::protocol::net::server::LoginReplyServerPacket::AsWrongUser ( )
inlinenoexcept

Gets the data associated with reply_code value WrongUser.

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

◆ AsWrongUserPassword() [1/2]

const ReplyCodeDataWrongUserPassword * eolib::protocol::net::server::LoginReplyServerPacket::AsWrongUserPassword ( ) const
inlinenoexcept

Gets the data associated with reply_code value WrongUserPassword.

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

◆ AsWrongUserPassword() [2/2]

ReplyCodeDataWrongUserPassword * eolib::protocol::net::server::LoginReplyServerPacket::AsWrongUserPassword ( )
inlinenoexcept

Gets the data associated with reply_code value WrongUserPassword.

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

◆ AsOk() [1/2]

const ReplyCodeDataOk * eolib::protocol::net::server::LoginReplyServerPacket::AsOk ( ) const
inlinenoexcept

Gets the data associated with reply_code value Ok.

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

◆ AsOk() [2/2]

ReplyCodeDataOk * eolib::protocol::net::server::LoginReplyServerPacket::AsOk ( )
inlinenoexcept

Gets the data associated with reply_code value Ok.

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

◆ AsBanned() [1/2]

const ReplyCodeDataBanned * eolib::protocol::net::server::LoginReplyServerPacket::AsBanned ( ) const
inlinenoexcept

Gets the data associated with reply_code value Banned.

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

◆ AsBanned() [2/2]

ReplyCodeDataBanned * eolib::protocol::net::server::LoginReplyServerPacket::AsBanned ( )
inlinenoexcept

Gets the data associated with reply_code value Banned.

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

◆ AsLoggedIn() [1/2]

const ReplyCodeDataLoggedIn * eolib::protocol::net::server::LoginReplyServerPacket::AsLoggedIn ( ) const
inlinenoexcept

Gets the data associated with reply_code value LoggedIn.

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

◆ AsLoggedIn() [2/2]

ReplyCodeDataLoggedIn * eolib::protocol::net::server::LoginReplyServerPacket::AsLoggedIn ( )
inlinenoexcept

Gets the data associated with reply_code value LoggedIn.

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

◆ AsBusy() [1/2]

const ReplyCodeDataBusy * eolib::protocol::net::server::LoginReplyServerPacket::AsBusy ( ) const
inlinenoexcept

Gets the data associated with reply_code value Busy.

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

◆ AsBusy() [2/2]

ReplyCodeDataBusy * eolib::protocol::net::server::LoginReplyServerPacket::AsBusy ( )
inlinenoexcept

Gets the data associated with reply_code value Busy.

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

◆ ForWrongUser()

LoginReplyServerPacket eolib::protocol::net::server::LoginReplyServerPacket::ForWrongUser ( )
static

Creates a new LoginReplyServerPacket with reply_code set to WrongUser.

Returns
the created object.

◆ ForWrongUserPassword()

LoginReplyServerPacket eolib::protocol::net::server::LoginReplyServerPacket::ForWrongUserPassword ( )
static

Creates a new LoginReplyServerPacket with reply_code set to WrongUserPassword.

Returns
the created object.

◆ ForOk()

LoginReplyServerPacket eolib::protocol::net::server::LoginReplyServerPacket::ForOk ( ReplyCodeDataOk data)
static

Creates a new LoginReplyServerPacket with reply_code set to Ok.

Parameters
datathe data associated with reply_code Ok.
Returns
the created object.

◆ ForBanned()

LoginReplyServerPacket eolib::protocol::net::server::LoginReplyServerPacket::ForBanned ( )
static

Creates a new LoginReplyServerPacket with reply_code set to Banned.

Returns
the created object.

◆ ForLoggedIn()

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

Creates a new LoginReplyServerPacket with reply_code set to LoggedIn.

Returns
the created object.

◆ ForBusy()

LoginReplyServerPacket eolib::protocol::net::server::LoginReplyServerPacket::ForBusy ( )
static

Creates a new LoginReplyServerPacket with reply_code set to Busy.

Returns
the created object.

◆ Family()

PacketFamily eolib::protocol::net::server::LoginReplyServerPacket::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::LoginReplyServerPacket::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::LoginReplyServerPacket::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::LoginReplyServerPacket::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::LoginReplyServerPacket::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::LoginReplyServerPacket::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::LoginReplyServerPacket::operator== ( const LoginReplyServerPacket & 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::LoginReplyServerPacket::operator!= ( const LoginReplyServerPacket & 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::LoginReplyServerPacket::FAMILY = PacketFamily::Login
staticconstexpr

The packet family associated with this packet.

◆ ACTION

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

The packet action associated with this packet.

◆ reply_code

LoginReply eolib::protocol::net::server::LoginReplyServerPacket::reply_code {}

◆ reply_code_data

ReplyCodeData eolib::protocol::net::server::LoginReplyServerPacket::reply_code_data {}

Data associated with the reply_code field.