Add documentation headers across system modules
This commit is contained in:
@@ -17,6 +17,19 @@ Notification::Notification(const std::string& recipientUserId, User* recipient,
|
||||
m_message(message),
|
||||
m_createdAt(createdAt) {}
|
||||
|
||||
/*
|
||||
Function: Notification (parameterized constructor with ID)
|
||||
Description: Initializes a notification with an existing ID, recipient details,
|
||||
title, message, and creation timestamp. Updates UID tracking based on ID.
|
||||
Parameters:
|
||||
- id: const std::string&, unique notification ID
|
||||
- recipientUserId: const std::string&, ID of the recipient user
|
||||
- title: const std::string&, notification title
|
||||
- message: const std::string&, notification message
|
||||
- createdAt: const util::Timestamp&, timestamp of creation
|
||||
Returns:
|
||||
- A new Notification object
|
||||
*/
|
||||
Notification::Notification(const std::string& id, const std::string& recipientUserId, const std::string& title, const std::string& message, const util::Timestamp& createdAt)
|
||||
: m_id(id),
|
||||
m_recipientUserId(recipientUserId),
|
||||
@@ -92,6 +105,14 @@ void Notification::setCreatedAt(const util::Timestamp& createdAt)
|
||||
m_createdAt = createdAt;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: serialize
|
||||
Description: Serializes the notification into a CSV-formatted string.
|
||||
Parameters:
|
||||
- None
|
||||
Returns:
|
||||
- std::string: Serialized notification record
|
||||
*/
|
||||
std::string Notification::serialize() const
|
||||
{
|
||||
std::ostringstream serializedNotification;
|
||||
@@ -103,6 +124,16 @@ std::string Notification::serialize() const
|
||||
return serializedNotification.str();
|
||||
}
|
||||
|
||||
/*
|
||||
Function: deserialize
|
||||
Description: Deserializes a CSV-formatted string into a Notification object.
|
||||
Parameters:
|
||||
- record: const std::string&, serialized notification record
|
||||
Returns:
|
||||
- Notification*: Pointer to the deserialized Notification object
|
||||
Throws:
|
||||
- std::runtime_error if timestamp parsing fails
|
||||
*/
|
||||
Notification* Notification::deserialize(const std::string& record)
|
||||
{
|
||||
std::string id, recipientUserId, title, message, createdAtTimestampString;
|
||||
@@ -130,6 +161,14 @@ Notification* Notification::deserialize(const std::string& record)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Function: getHeaders
|
||||
Description: Retrieves the CSV headers for notification serialization.
|
||||
Parameters:
|
||||
- None
|
||||
Returns:
|
||||
- std::string: Header string ("ID,RecipientID,Title,Message,Timestamp")
|
||||
*/
|
||||
std::string Notification::getHeaders()
|
||||
{
|
||||
return "ID,RecipientID,Title,Message,Timestamp";
|
||||
|
||||
Reference in New Issue
Block a user