Represents a dialog between two users.
More...
#include <dialog.hpp>
|
| 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< Message > | getAllMessages () 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
|
|
Represents a dialog between two users.
◆ Dialog()
Dialog::Dialog |
( |
std::string | from, |
|
|
std::string | to ) |
Constructs a Dialog object.
- Parameters
-
from | The username of the sender. |
to | The username of the receiver. |
◆ deleteMessage()
bool Dialog::deleteMessage |
( |
size_t | index | ) |
|
delete a message from the dialog
- Parameters
-
index | the 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
-
message | The message to be sent. |
sender | the message sender |
- Returns
- true if the message was sent successfully, false otherwise
The documentation for this class was generated from the following file: