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

Represents a message exchanged between two users. More...

#include <message.hpp>

Public Member Functions

 Message (std::string from, std::string to, std::string message)
 construct a Message object
 
 ~Message ()
 destroy the Message object
 
std::string getFromUser () const
 Gets the username of the sender.
 
std::string getToUser () const
 Gets the username of the receiver.
 
std::string getMessage () const
 Gets the content of the message.
 
std::string toString () const
 Converts the message to a string representation.
 
std::chrono::system_clock::time_point getTimestamp () const
 Gets the timestamp of when the message was sent.
 
std::string getFormatTimestamp () const
 Converts the timestamp to a string representation.
 

Detailed Description

Represents a message exchanged between two users.

Constructor & Destructor Documentation

◆ Message()

Message::Message ( std::string from,
std::string to,
std::string message )

construct a Message object

Parameters
fromthe username of the sender
tothe username of the receiver
messagethe content of the message

Member Function Documentation

◆ getFormatTimestamp()

std::string Message::getFormatTimestamp ( ) const
nodiscard

Converts the timestamp to a string representation.

Returns
A string representation of the timestamp.

◆ getFromUser()

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

Gets the username of the sender.

Returns
The username of the sender.

◆ getMessage()

std::string Message::getMessage ( ) const
nodiscard

Gets the content of the message.

Returns
The content of the message.

◆ getTimestamp()

std::chrono::system_clock::time_point Message::getTimestamp ( ) const
nodiscard

Gets the timestamp of when the message was sent.

Returns
The timestamp of the message.

◆ getToUser()

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

Gets the username of the receiver.

Returns
The username of the receiver.

◆ toString()

std::string Message::toString ( ) const
nodiscard

Converts the message to a string representation.

Returns
A string representation of the message.

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