pairpal
Loading...
Searching...
No Matches
Dialog Class Reference

Represents a dialog between two users. More...

#include <dialog.hpp>

Public Member Functions

 Dialog (std::string from, std::string to)
 Constructs a Dialog object.
 
 ~Dialog ()
 Destroy the Dialog object.
 
std::string getFromUser () const
 get the username of the sender
 
std::string getToUser () const
 get the username of the receiver
 
std::vector< MessagegetAllMessages () const
 get all messages in the dialog
 
bool sendMessage (const std::string &sender, std::string message)
 Sends a message in the dialog.
 
void displayMessages () const
 
bool deleteMessage (size_t index)
 delete a message from the dialog
 

Detailed Description

Represents a dialog between two users.

Constructor & Destructor Documentation

◆ Dialog()

Dialog::Dialog ( std::string from,
std::string to )

Constructs a Dialog object.

Parameters
fromThe username of the sender.
toThe username of the receiver.

Member Function Documentation

◆ deleteMessage()

bool Dialog::deleteMessage ( size_t index)

delete a message from the dialog

Parameters
indexthe index of the message to delete
Returns
true if the message was deleted successfully, false otherwise

◆ getAllMessages()

std::vector< Message > Dialog::getAllMessages ( ) const
nodiscard

get all messages in the dialog

Returns
a vector containing all messages

◆ getFromUser()

std::string Dialog::getFromUser ( ) const
nodiscard

get the username of the sender

Returns
the username of the sender

◆ getToUser()

std::string Dialog::getToUser ( ) const
nodiscard

get the username of the receiver

Returns
the username of the receiver

◆ sendMessage()

bool Dialog::sendMessage ( const std::string & sender,
std::string message )

Sends a message in the dialog.

Parameters
messageThe message to be sent.
senderthe message sender
Returns
true if the message was sent successfully, false otherwise

The documentation for this class was generated from the following file: