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

An entry in a quest dialog. More...

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

Inherits eolib::protocol::Serializable.

Classes

 Data associated with entry_type value Link. More...

Public Types

using EntryTypeData = std::variant<std::monostate, EntryTypeDataLink>
 Data associated with different values of the entry_type field.

Public Member Functions

const EntryTypeDataLink * AsLink () const noexcept
 Gets the data associated with entry_type value Link.
EntryTypeDataLink * AsLink () noexcept
 Gets the data associated with entry_type value Link.
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 DialogEntry &other) const
 Compares this object with another for equality.
bool operator!= (const DialogEntry &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 DialogEntry ForText ()
 Creates a new DialogEntry with entry_type set to Text.
static DialogEntry ForLink (EntryTypeDataLink data)
 Creates a new DialogEntry with entry_type set to Link.

Public Attributes

DialogEntryType entry_type {}
EntryTypeData entry_type_data {}
 Data associated with the entry_type field.
std::string line {}

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

An entry in a quest dialog.

Member Typedef Documentation

◆ EntryTypeData

Data associated with different values of the entry_type field.

Member Function Documentation

◆ AsLink() [1/2]

const EntryTypeDataLink * eolib::protocol::net::server::DialogEntry::AsLink ( ) const
inlinenoexcept

Gets the data associated with entry_type value Link.

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

◆ AsLink() [2/2]

EntryTypeDataLink * eolib::protocol::net::server::DialogEntry::AsLink ( )
inlinenoexcept

Gets the data associated with entry_type value Link.

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

◆ ForText()

DialogEntry eolib::protocol::net::server::DialogEntry::ForText ( )
static

Creates a new DialogEntry with entry_type set to Text.

Returns
the created object.

◆ ForLink()

DialogEntry eolib::protocol::net::server::DialogEntry::ForLink ( EntryTypeDataLink data)
static

Creates a new DialogEntry with entry_type set to Link.

Parameters
datathe data associated with entry_type Link.
Returns
the created object.

◆ ByteSize()

int eolib::protocol::net::server::DialogEntry::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::DialogEntry::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::DialogEntry::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::DialogEntry::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::DialogEntry::operator== ( const DialogEntry & 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::DialogEntry::operator!= ( const DialogEntry & 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

◆ entry_type

DialogEntryType eolib::protocol::net::server::DialogEntry::entry_type {}

◆ entry_type_data

EntryTypeData eolib::protocol::net::server::DialogEntry::entry_type_data {}

Data associated with the entry_type field.

◆ line

std::string eolib::protocol::net::server::DialogEntry::line {}