Add function headers to models
This commit is contained in:
@@ -6,7 +6,6 @@ File: Log.cpp
|
|||||||
*/
|
*/
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
//Getters and setters
|
|
||||||
const util::Timestamp& Log::getTimestamp() const
|
const util::Timestamp& Log::getTimestamp() const
|
||||||
{
|
{
|
||||||
return m_timestamp;
|
return m_timestamp;
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ double Payroll::getEmployerPFContribution() const
|
|||||||
return m_employerPFContribution;
|
return m_employerPFContribution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Payroll::getHeaders()
|
||||||
|
{
|
||||||
|
return "PayrollId,EmployeeId,BasicSalary,HouseRentAllowance,FoodAllowance,EmployeePFContribution,EmployerPFContribution";
|
||||||
|
}
|
||||||
|
|
||||||
void Payroll::setBasicSalary(double basicSalary)
|
void Payroll::setBasicSalary(double basicSalary)
|
||||||
{
|
{
|
||||||
m_basicSalary = basicSalary;
|
m_basicSalary = basicSalary;
|
||||||
@@ -98,6 +103,14 @@ void Payroll::setEmployerPFContribution(double value)
|
|||||||
m_employerPFContribution = 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::string Payroll::serialize() const
|
||||||
{
|
{
|
||||||
std::ostringstream serializedPayroll;
|
std::ostringstream serializedPayroll;
|
||||||
@@ -111,6 +124,14 @@ std::string Payroll::serialize() const
|
|||||||
return serializedPayroll.str();
|
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)
|
Payroll* Payroll::deserialize(const std::string& record)
|
||||||
{
|
{
|
||||||
std::string id, employeeId;
|
std::string id, employeeId;
|
||||||
@@ -144,9 +165,4 @@ Payroll* Payroll::deserialize(const std::string& record)
|
|||||||
{
|
{
|
||||||
throw std::runtime_error("Failed to deserialize Payroll object");
|
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 getFoodAllowance() const;
|
||||||
double getEmployeePFContribution() const;
|
double getEmployeePFContribution() const;
|
||||||
double getEmployerPFContribution() const;
|
double getEmployerPFContribution() const;
|
||||||
|
static std::string getHeaders();
|
||||||
void setBasicSalary(double);
|
void setBasicSalary(double);
|
||||||
void setHouseRentAllowance(double);
|
void setHouseRentAllowance(double);
|
||||||
void setFoodAllowance(double);
|
void setFoodAllowance(double);
|
||||||
@@ -61,5 +62,4 @@ public:
|
|||||||
void setEmployerPFContribution(double);
|
void setEmployerPFContribution(double);
|
||||||
std::string serialize() const;
|
std::string serialize() const;
|
||||||
static Payroll* deserialize(const std::string&);
|
static Payroll* deserialize(const std::string&);
|
||||||
static std::string getHeaders();
|
|
||||||
};
|
};
|
||||||
@@ -57,6 +57,19 @@ const std::string& Payslip::getEmployeeId() const
|
|||||||
return m_employeeId;
|
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::string Payslip::serialize() const
|
||||||
{
|
{
|
||||||
std::ostringstream serializedPayslip;
|
std::ostringstream serializedPayslip;
|
||||||
@@ -67,6 +80,14 @@ std::string Payslip::serialize() const
|
|||||||
return serializedPayslip.str();
|
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)
|
Payslip* Payslip::deserialize(const std::string& record)
|
||||||
{
|
{
|
||||||
std::string id, employeeId, timestampString;
|
std::string id, employeeId, timestampString;
|
||||||
@@ -92,9 +113,4 @@ Payslip* Payslip::deserialize(const std::string& record)
|
|||||||
{
|
{
|
||||||
throw std::runtime_error("Failed to deserialize Payslip object");
|
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);
|
util::Timestamp timestamp);
|
||||||
const std::string& getId() const;
|
const std::string& getId() const;
|
||||||
double getSalary() const;
|
double getSalary() const;
|
||||||
|
static std::string getHeaders();
|
||||||
void setPayslipId(const std::string& id);
|
void setPayslipId(const std::string& id);
|
||||||
void setSalary(double salary);
|
void setSalary(double salary);
|
||||||
const util::Timestamp& getTimestamp() const;
|
const util::Timestamp& getTimestamp() const;
|
||||||
const std::string& getEmployeeId() const;
|
const std::string& getEmployeeId() const;
|
||||||
std::string serialize() const;
|
std::string serialize() const;
|
||||||
static Payslip* deserialize(const std::string&);
|
static Payslip* deserialize(const std::string&);
|
||||||
static std::string getHeaders();
|
|
||||||
};
|
};
|
||||||
@@ -33,6 +33,14 @@ void Room::setRoomName(const std::string& name)
|
|||||||
m_name = 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)
|
void Room::addBooking(Booking* booking)
|
||||||
{
|
{
|
||||||
if (booking)
|
if (booking)
|
||||||
|
|||||||
@@ -36,5 +36,4 @@ public:
|
|||||||
accountStatus) {
|
accountStatus) {
|
||||||
}
|
}
|
||||||
~TalentExecutive() = default;
|
~TalentExecutive() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,5 +35,4 @@ public:
|
|||||||
Enums::EmployeeType::TEAM,
|
Enums::EmployeeType::TEAM,
|
||||||
accountStatus) {}
|
accountStatus) {}
|
||||||
~TeamExecutive() = default;
|
~TeamExecutive() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user