refactor: change memory management and fix related code
- Switched shared_ptr to raw pointers - Added cleanup logic in DataStore - Fixed Factory object creation - Updated function signatures to match changes - Small refactors and formatting fixes
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
@@ -22,7 +21,7 @@ void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController)
|
||||
|
||||
inline void viewPayslipHistory(ZenvyController* m_zenvyController)
|
||||
{
|
||||
auto employeePayslips = m_zenvyController->getCurrentEmployee()->getEmployeePayslips();
|
||||
auto& employeePayslips = m_zenvyController->getCurrentEmployee()->getEmployeePayslips();
|
||||
util::clear();
|
||||
if (employeePayslips.empty())
|
||||
{
|
||||
@@ -147,7 +146,7 @@ inline void updateProfile(ZenvyController* m_zenvyController)
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string selectEmployeeId(std::vector<const Employee*>& allEmployees)
|
||||
inline std::string selectEmployeeId(const std::vector<const Employee*>& allEmployees)
|
||||
{
|
||||
int choice;
|
||||
std::map<int, const Employee*> employeeList;
|
||||
@@ -353,7 +352,7 @@ inline void viewPayslip(ZenvyController* m_zenvyController)
|
||||
if (payroll && payslip)
|
||||
{
|
||||
util::clear();
|
||||
std::cout << "Payslip for " << employee->getEmployeeName() << " (" << year << "-" << std::setw(2) << std::setfill('0') << month << ")\n\n";
|
||||
std::cout << "Payslip for " << employee->getEmployeeName() << " (" << year << "-" << std::setw(2) << month << ")\n\n";
|
||||
std::cout << "Basic Salary : " << payroll->getBasicSalary() << "\n";
|
||||
std::cout << "House Rent Allowance : " << payroll->getHouseRentAllowance() << "\n";
|
||||
std::cout << "Food Allowance : " << payroll->getFoodAllowance() << "\n";
|
||||
|
||||
Reference in New Issue
Block a user