Add function headers to models
This commit is contained in:
@@ -6,7 +6,6 @@ File: Log.cpp
|
||||
*/
|
||||
#include "Log.h"
|
||||
|
||||
//Getters and setters
|
||||
const util::Timestamp& Log::getTimestamp() const
|
||||
{
|
||||
return m_timestamp;
|
||||
|
||||
@@ -73,6 +73,11 @@ double Payroll::getEmployerPFContribution() const
|
||||
return m_employerPFContribution;
|
||||
}
|
||||
|
||||
std::string Payroll::getHeaders()
|
||||
{
|
||||
return "PayrollId,EmployeeId,BasicSalary,HouseRentAllowance,FoodAllowance,EmployeePFContribution,EmployerPFContribution";
|
||||
}
|
||||
|
||||
void Payroll::setBasicSalary(double basicSalary)
|
||||
{
|
||||
m_basicSalary = basicSalary;
|
||||
@@ -98,6 +103,14 @@ void Payroll::setEmployerPFContribution(double value)
|
||||
m_employerPFContribution = value;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: serialize
|
||||
Description: Converts the payroll object into a comma-separated string.
|
||||
Parameters:
|
||||
None
|
||||
Returns:
|
||||
A serialized string representation of the payroll.
|
||||
*/
|
||||
std::string Payroll::serialize() const
|
||||
{
|
||||
std::ostringstream serializedPayroll;
|
||||
@@ -111,6 +124,14 @@ std::string Payroll::serialize() const
|
||||
return serializedPayroll.str();
|
||||
}
|
||||
|
||||
/*
|
||||
Function: deserialize
|
||||
Description: Creates a Payroll object from a serialized comma-separated string.
|
||||
Parameters:
|
||||
record - Serialized payroll data.
|
||||
Returns:
|
||||
Pointer to a Payroll object.
|
||||
*/
|
||||
Payroll* Payroll::deserialize(const std::string& record)
|
||||
{
|
||||
std::string id, employeeId;
|
||||
@@ -145,8 +166,3 @@ Payroll* Payroll::deserialize(const std::string& record)
|
||||
throw std::runtime_error("Failed to deserialize Payroll object");
|
||||
}
|
||||
}
|
||||
|
||||
std::string Payroll::getHeaders()
|
||||
{
|
||||
return "PayrollId,EmployeeId,BasicSalary,HouseRentAllowance,FoodAllowance,EmployeePFContribution,EmployerPFContribution";
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
double getFoodAllowance() const;
|
||||
double getEmployeePFContribution() const;
|
||||
double getEmployerPFContribution() const;
|
||||
static std::string getHeaders();
|
||||
void setBasicSalary(double);
|
||||
void setHouseRentAllowance(double);
|
||||
void setFoodAllowance(double);
|
||||
@@ -61,5 +62,4 @@ public:
|
||||
void setEmployerPFContribution(double);
|
||||
std::string serialize() const;
|
||||
static Payroll* deserialize(const std::string&);
|
||||
static std::string getHeaders();
|
||||
};
|
||||
@@ -57,6 +57,19 @@ const std::string& Payslip::getEmployeeId() const
|
||||
return m_employeeId;
|
||||
}
|
||||
|
||||
std::string Payslip::getHeaders()
|
||||
{
|
||||
return "PayslipId,EmployeeId,Salary,Timestamp";
|
||||
}
|
||||
|
||||
/*
|
||||
Function: serialize
|
||||
Description: Converts the payslip object into a comma-separated string.
|
||||
Parameters:
|
||||
None
|
||||
Returns:
|
||||
A serialized string representation of the payslip.
|
||||
*/
|
||||
std::string Payslip::serialize() const
|
||||
{
|
||||
std::ostringstream serializedPayslip;
|
||||
@@ -67,6 +80,14 @@ std::string Payslip::serialize() const
|
||||
return serializedPayslip.str();
|
||||
}
|
||||
|
||||
/*
|
||||
Function: deserialize
|
||||
Description: Creates a Payslip object from a serialized comma-separated string.
|
||||
Parameters:
|
||||
record - Serialized payslip data.
|
||||
Returns:
|
||||
Pointer to a Payslip object.
|
||||
*/
|
||||
Payslip* Payslip::deserialize(const std::string& record)
|
||||
{
|
||||
std::string id, employeeId, timestampString;
|
||||
@@ -93,8 +114,3 @@ Payslip* Payslip::deserialize(const std::string& record)
|
||||
throw std::runtime_error("Failed to deserialize Payslip object");
|
||||
}
|
||||
}
|
||||
|
||||
std::string Payslip::getHeaders()
|
||||
{
|
||||
return "PayslipId,EmployeeId,Salary,Timestamp";
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ public:
|
||||
util::Timestamp timestamp);
|
||||
const std::string& getId() const;
|
||||
double getSalary() const;
|
||||
static std::string getHeaders();
|
||||
void setPayslipId(const std::string& id);
|
||||
void setSalary(double salary);
|
||||
const util::Timestamp& getTimestamp() const;
|
||||
const std::string& getEmployeeId() const;
|
||||
std::string serialize() const;
|
||||
static Payslip* deserialize(const std::string&);
|
||||
static std::string getHeaders();
|
||||
};
|
||||
@@ -33,6 +33,14 @@ void Room::setRoomName(const std::string& name)
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: addBooking
|
||||
Description: Adds a valid booking to the room’s booking list using the booking ID as the key.
|
||||
Parameters:
|
||||
booking - A pointer to a Booking object to be added to the room.
|
||||
Returns:
|
||||
void
|
||||
*/
|
||||
void Room::addBooking(Booking* booking)
|
||||
{
|
||||
if (booking)
|
||||
|
||||
@@ -37,4 +37,3 @@ public:
|
||||
}
|
||||
~TalentExecutive() = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,4 +36,3 @@ public:
|
||||
accountStatus) {}
|
||||
~TeamExecutive() = default;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user