Merged PR 949: Add files and function header documentation

This commit is contained in:
2026-04-08 17:32:07 +05:30
98 changed files with 1206 additions and 55 deletions
@@ -1,4 +1,12 @@
/*
* File: Trenser.Zenvy.cpp
* Description: Zenvy Main
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "UserInterface.h"
int main()
{
UserInterface userInterFace;
@@ -1,16 +1,53 @@
/*
* File: ZenvyController.cpp
* Description : Controls data flow between UI and Service Layers.
* Author: Trenser
* Created : 01-04-2026
*/
#include "ZenvyController.h"
//Authentication
/*
* Function: login
* Description: authenticates the employee based on email and password
* Parameters:
* email - email of the employee
* password - password of the employee
* Returns:
* Tuple - login status, employee type, employee designation
* login status - success or failed
* employee type - type of the employee logged in
* employee designation - designation if employee type is GENERAL.
*/
AuthenticationDTO ZenvyController::login(const std::string& email, const std::string& password)
{
return m_authenticationManagementService->login(email, password);
}
/*
* Function: changePassword
* Description: updates the password of the currently authenticated employee.
* Parameters:
* password - the new password to be set for the employee
* Returns:
* void - no return value
*/
void ZenvyController::logout()
{
m_authenticationManagementService->logout();
}
/*
* Function: changePassword
* Description: updates the password of the currently authenticated employee.
* Parameters:
* password - the new password to be set for the employee
* Returns:
* void - no return value
*/
void ZenvyController::changePassword(const std::string& password)
{
m_authenticationManagementService->changePassword(password);
@@ -1,3 +1,10 @@
/*
* File: ZenvyController.h
* Description : Controls data flow between UI and Service Layers.
* Author: Trenser
* Created : 01-04-2026
*/
#pragma once
#include <memory>
#include <utility>
@@ -1,31 +1,92 @@
/*
* File: DataStore.cpp
* Description: Central Storage for all the System Data.
* Author: Trenser
* Created: 01-04-2026
*/
#include "DataStore.h"
/*
* Function: getInstance
* Description: provides a singleton instance of the DataStore.
* Parameters:
* None
* Returns:
* DataStore& - reference to the single DataStore object.
*/
DataStore& DataStore::getInstance()
{
static DataStore dataStore;
return dataStore;
}
/*
* Function: getLogs
* Description: retrieves the log map containing system logs.
* Parameters:
* None
* Returns:
* logMap& - reference to the log map.
*/
logMap& DataStore::getLogs()
{
return m_logs;
}
/*
* Function: getAuthenticatedEmployee
* Description: returns the currently authenticated employee.
* Parameters:
* None
* Returns:
* std::shared_ptr<Employee>& - reference to the authenticated employee object.
*/
std::shared_ptr<Employee>& DataStore::getAuthenticatedEmployee()
{
return m_authenticatedEmployee;
}
/*
* Function: setAuthenticatedEmployee
* Description: sets the currently authenticated employee.
* Parameters:
* authenticatedEmployee - shared pointer to the employee object to be set as authenticated.
* Returns:
* void - no return value.
*/
void DataStore::setAuthenticatedEmployee(std::shared_ptr<Employee> authenticatedEmployee)
{
m_authenticatedEmployee = authenticatedEmployee;
}
/*
* Function: getEmployees
* Description: retrieves the employee map containing all employees.
* Parameters:
* None
* Returns:
* employeeMap& - reference to the employee map.
*/
employeeMap& DataStore::getEmployees()
{
return m_employees;
}
/*
* Function: getAuthenticatedUser
* Description: alias for getAuthenticatedEmployee, returns the currently authenticated employee.
* Parameters:
* None
* Returns:
* std::shared_ptr<Employee>& - reference to the authenticated employee object.
*/
std::shared_ptr<Employee>& DataStore::getAuthenticatedUser()
{
return m_authenticatedEmployee;
@@ -1,3 +1,10 @@
/*
* File: DataStore.h
* Description: Central Storage for all the System Data.
* Author: Trenser
* Created: 01-04-2026
*/
#pragma once
#include <memory>
#include <map>
@@ -1,3 +1,10 @@
/*
* File: Factory.h
* Description: Provides a generic factory utility to create shared_ptr instances of objects.
* Author: Ajmal J S
* Created: 01-04-2026
*/
#pragma once
#include <memory>
#include <utility>
@@ -5,6 +12,17 @@
class Factory
{
public:
/*
* Function: getObject
* Description: Creates and returns a shared_ptr to an object of type T.
* Parameters:
* T - the type of object to be created
* Args - constructor arguments forwarded to T's constructor
* Returns:
* std::shared_ptr<T> - a shared pointer managing the newly created object
*/
template<typename T, typename... Args>
static std::shared_ptr<T> getObject(Args&&... args)
{
@@ -1 +1,7 @@
/*
* File: Admin.cpp
* Description: Admin model class
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Admin.h"
@@ -1,3 +1,10 @@
/*
* File: Admin.h
* Description: Admin model class
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
@@ -1,3 +1,9 @@
/*
* File: Announcement.cpp
* Description: The Announcement class that stores an announcements ID, timestamp, and message with getter and setter functions for controlled access.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Announcement.h"
const std::string& Announcement::getAnnouncementId() const
@@ -1,3 +1,9 @@
/*
* File: Attendance.cpp
* Description: The Attendance class manages attendance records by storing login and logout times.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Attendance.h"
const std::string& Attendance::getAttendanceId() const
@@ -1,3 +1,9 @@
/*
* File: Attendance.h
* Description: The Attendance class represents an attendance record by storing an ID, login and logout timestamps.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
@@ -1,3 +1,9 @@
/*
* File: Booking.cpp
* Description: The Booking class stores booking details and calculates the duration between start and end times.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Booking.h"
const std::string& Booking::getBookingId() const
@@ -1,3 +1,9 @@
/*
* File: Booking.h
* Description: The Booking class represents a time?based booking with employee and team details and supports duration calculation.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include <memory>
@@ -1,3 +1,9 @@
/*
* File: Candidate.cpp
* Description: The Candidate class manages candidate details and status using getter and setter methods.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Candidate.h"
const std::string& Candidate::getCandidateId() const
@@ -1,3 +1,9 @@
/*
* File: Candidate.h
* Description: The Candidate class stores and manages a candidates information.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -1,3 +1,9 @@
/*
* File: Employee.cpp
* Description: The Employee class stores and manages employee details along with related work records.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Employee.h"
const std::string& Employee::getEmployeeId() const
@@ -1,3 +1,9 @@
/*
* File: Employee.h
* Description: The Employee class manages employee information and associated work records such as payroll, attendance, leaves, and payslips.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include <memory>
@@ -1 +1,7 @@
/*
* File: Faq.h
* Description: Faq model class.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include "Faq.h"
+6
View File
@@ -1,3 +1,9 @@
/*
* File: Faq.h
* Description: Faq model class.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
class Faq
@@ -1 +1,7 @@
/*
* File: FinanceExecutive.h
* Description: FinanceExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "FinanceExecutive.h"
@@ -1,3 +1,9 @@
/*
* File: FinanceExecutive.h
* Description: FinanceExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
@@ -1,3 +1,9 @@
/*
* File: GeneralEmployee.h
* Description: The GeneralEmployee class represents a general employee with a specific designation.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
#include "Enums.h"
@@ -1 +1,7 @@
/*
* File: HRManager.cpp
* Description: HRManager model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "HRManager.h"
@@ -1,3 +1,9 @@
/*
* File: HRManager.h
* Description: HRManager model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
@@ -1 +1,7 @@
/*
* File: ITExecutive.cpp
* Description: ITExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "ITExecutive.h"
@@ -1,3 +1,9 @@
/*
* File: ITExecutive.h
* Description: ITExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
@@ -1,5 +1,13 @@
/*
File: JobListing.cpp
* Description : Represents a job opening along with its details and applied candidates.
* Author : Trenser
* Created : 01 - Apr - 2026
*/
#include "JobListing.h"
//Getters and setters
const std::string& JobListing::getJobId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: JobListing.h
* Description : Represents a job opening along with its details and applied candidates.
* Author : Trenser
* Created : 01 - Apr - 2026
*/
#pragma once
#include <string>
#include <map>
@@ -1,5 +1,13 @@
/*
File: Leave.cpp
* Description : Stores information related to an employees leave application.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "Leave.h"
//Getters and setters
const std::string& Leave::getLeaveId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: Leave.h
* Description : Stores information related to an employees leave application.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -1,5 +1,13 @@
/*
File: Log.cpp
* Description : Represents a log entry containing a timestamp and an associated message.
* Author : Trenser
* Created : 01 - Apr - 2026
*/
#include "Log.h"
//Getters and setters
const util::Timestamp& Log::getTimestamp() const
{
return m_timestamp;
+7
View File
@@ -1,3 +1,10 @@
/*
File: Log.h
* Description : Represents a log entry containing a timestamp and an associated message.
* Author : Trenser
* Created : 01 - Apr - 2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
@@ -1,5 +1,13 @@
/*
File: Notification.cpp
* Description : Represents an employee notification with message and status details.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "Notification.h"
//Getters and setters
const std::string& Notification::getNotificationId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: Notification.h
* Description : Represents an employee notification with message and status details.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -1,5 +1,13 @@
/*
File: Payroll.cpp
* Description : Stores payroll and salary breakdown details for an employee.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "Payroll.h"
//Getters and setters
const std::string& Payroll::getPayrollId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: Payroll.h
* Description : Stores payroll and salary breakdown details for an employee.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include <string>
@@ -1,5 +1,13 @@
/*
File: Payslip.cpp
* Description : Models a payslip entity that stores salary information.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "Payslip.h"
//Getters and setters
const std::string& Payslip::getPayslipId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: Payslip.h
* Description : Models a payslip entity that stores salary information.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include <string>
@@ -1,5 +1,13 @@
/*
File: Room.cpp
* Description : Models a room entity that maintains room details and manages its bookings.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "Room.h"
//Getters and setters
const std::string& Room::getRoomId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: Room.h
* Description : Models a room entity that maintains room details and manages its bookings.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include <string>
#include <map>
@@ -1 +1,8 @@
/*
File: TalentExecutive.cpp
* Description : Represents information related to a talent executive in the system.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "TalentExecutive.h"
@@ -1,3 +1,10 @@
/*
File: TalentExecutive.h
* Description : Represents information related to a talent executive in the system.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include "Employee.h"
@@ -1,5 +1,13 @@
/*
File: Team.cpp
* Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "Team.h"
//Getters and setters
const std::string& Team::getTeamId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: Team.h
* Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include <string>
#include <map>
@@ -1 +1,8 @@
/*
File: TeamExecutive.cpp
* Description : Represents information related to a team executive within the system.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "TeamExecutive.h"
@@ -1,3 +1,10 @@
/*
File: TeamExecutive.h
* Description : Represents information related to a team executive within the system.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include "Employee.h"
@@ -1,5 +1,13 @@
/*
File: Ticket.cpp
* Description : Represents a support ticket with its associated details and status.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#include "Ticket.h"
//Getters and setters
const std::string& Ticket::getTicketId() const
{
return m_id;
@@ -1,3 +1,10 @@
/*
File: Ticket.h
* Description : Represents a support ticket with its associated details and status.
* Author : Trenser
* Created : 31 - Mar - 2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -1 +1,8 @@
/*
* File: ApplicationConfig.cpp
* Description: Global Application Config
* Author: Trenser
* Created: 06-Apr-2026
*/
#include "ApplicationConfig.h"
@@ -1,3 +1,10 @@
/*
* File: ApplicationConfig.h
* Description: Global Application Config
* Author: Trenser
* Created: 06-Apr-2026
*/
#pragma once
namespace Config
@@ -1 +1,8 @@
/*
* File: AttendanceManagementService.cpp
* Description: Handles Attendance related operations
* Author: Trenser
* Created: 30-Apr-2026
*/
#include "AttendanceManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: AttendanceManagementService.h
* Description: Handles Attendance related operations
* Author: Trenser
* Created: 30-Apr-2026
*/
#pragma once
class AttendanceManagementService
{
@@ -1,7 +1,25 @@
/*
* File: AuthenticationManagementService.cpp
* Description: Handles authentication related operations
* Author: Trenser
* Created: 30-Mar-2026
*/
#include <stdexcept>
#include "AuthenticationManagementService.h"
#include "ApplicationConfig.h"
/*
* Function: login
* Description: Authenticates a user using email and password, determines login status,
* employee type, and designation, and sets the authenticated employee
* in the data store.
* Parameters:
* email - employee email address
* password - employee password
* Returns:
* AuthenticationDTO containing login status, employee type, and employee designation
*/
AuthenticationDTO AuthenticationManagementService::login(const std::string& email, const std::string& password)
{
employeeMap& employees = m_dataStore.getEmployees();
@@ -47,6 +65,16 @@ AuthenticationDTO AuthenticationManagementService::login(const std::string& emai
return std::make_tuple(loginStatus, employeeType, employeeDesignation);
}
/*
* Function: changePassword
* Description: Updates the password of the currently authenticated user.
* Parameters:
* password - new password to be set
* Returns:
* None
* Throws:
* runtime_error if no authenticated user is found
*/
void AuthenticationManagementService::changePassword(const std::string& password)
{
std::shared_ptr<Employee> authenticatedUser = m_dataStore.getAuthenticatedUser();
@@ -60,6 +88,16 @@ void AuthenticationManagementService::changePassword(const std::string& password
}
}
/*
* Function: logout
* Description: Logs out the currently authenticated user by clearing authentication data.
* Parameters:
* None
* Returns:
* None
* Throws:
* runtime_error if no user is currently logged in
*/
void AuthenticationManagementService::logout() {
if (m_dataStore.getAuthenticatedUser()) {
m_dataStore.getAuthenticatedUser() = nullptr;
@@ -1,3 +1,10 @@
/*
* File: AuthenticationManagementService.h
* Description: Handles authentication related operations
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
#include <string>
#include <map>
@@ -19,4 +26,3 @@ public:
void logout();
void changePassword(const std::string&);
};
@@ -1 +1,8 @@
/*
* File: BookingManagementService.cpp
* Description: Handle operations related to booking meetings
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "BookingManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: BookingManagementService.h
* Description: Handle operations related to booking meetings
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class BookingManagementService
{
@@ -1 +1,8 @@
/*
* File: EmployeeManagementService.cpp
* Description: Handle operations related to employees
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "EmployeeManagememtService.h"
@@ -1,3 +1,10 @@
/*
* File: EmployeeManagementService.h
* Description: Handle operations related to employees
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class EmployeeManagememtService
{
@@ -1 +1,8 @@
/*
* File: LeaveManagementService.cpp
* Description: Handle operations related to leaves
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "LeaveManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: LeaveManagementService.h
* Description: Handle operations related to leaves
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class LeaveManagementService
{
@@ -1,3 +1,10 @@
/*
* File: Log.cpp
* Description: Handle operations related to logging
* Author: Trenser
* Created: 01-Apr-2026
*/
#include "LogService.h"
#include "Log.h"
#include "Factory.h"
@@ -1,3 +1,10 @@
/*
* File: Log.h
* Description: Handle operations related to logging
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include "Log.h"
@@ -1 +1,8 @@
/*
* File: NotificationManagementService.cpp
* Description: Handle operations related to notifications
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "NotificationManagementService.h"
@@ -1,5 +1,11 @@
/*
* File: NotificationManagementService.h
* Description: Handle operations related to notifications
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class NotificationManagementService
{
};
@@ -1 +1,8 @@
/*
* File: PayslipManagementService.cpp
* Description: Handle operations related to employee payslips
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "PayslipManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: PayslipManagementService.h
* Description: Handle operations related to employee payslips
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class PayslipManagementService
{
@@ -1 +1,8 @@
/*
* File: TalentAcquisitionManagementService.cpp
* Description: Handle operations related to Talent Acquisition
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TalentAcquisitionManagementService.h"
@@ -1,5 +1,11 @@
/*
* File: TalentAcquisitionManagementService.h
* Description: Handle operations related to Talent Acquisition
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class TalentAcquisitionManagementService
{
};
@@ -1 +1,8 @@
/*
* File: TeamManagementService.cpp
* Description: Handle operations related to Team Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TeamManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: TeamManagementService.h
* Description: Handle operations related to Team Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class TeamManagementService
{
@@ -1 +1,8 @@
/*
* File: TicketManagementService.h
* Description: Handle operations related to Ticket Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TicketManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: TicketManagementService.h
* Description: Handle operations related to Ticket Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class TicketManagementService
{
@@ -1,3 +1,10 @@
/*
* File: Enums.h
* Description: Defines strongly typed enumerations for statuses, types, and designations used across the HRMS system.
* Author: Smitha
* Created: 01-04-2026
*/
#pragma once
namespace Enums {
@@ -1,5 +1,11 @@
#pragma once
/*
* File: InputHelper.h
* Description: Handles input validation and error handling
* Author: Smitha
* Created: 08-Apr-2026
*/
#pragma once
#include <iostream>
#include <limits>
#include <string>
@@ -7,6 +13,15 @@
namespace util
{
/*
* Function: read
* Description: Reads input from console into a variable of type T.
* Parameters:
* value - reference to a variable of type T where the input will be stored
* Returns:
* void - throws runtime_error if input is invalid
*/
template <typename T>
inline void read(T& value)
{
@@ -18,11 +33,27 @@ namespace util
}
}
/*
* Function: read
* Description: Reads a line of text input from console into a string.
* Parameters:
* value - reference to a string where the input will be stored
* Returns:
* void - no return value
*/
inline void read(std::string& value)
{
std::getline(std::cin >> std::ws, value);
}
/*
* Function: pressEnter
* Description: Pauses execution until the user presses Enter.
* Parameters: None
* Returns: void - no return value
*/
inline void pressEnter()
{
system("pause");
@@ -1,5 +1,20 @@
/*
* File: OutputHelper.cpp
* Description: Provides functions to help with console output.
* Author: Trenser
* Created: 01-04-2026
*/
#include "outputHelper.h"
/*
* Function: clear
* Description: Clears the console screen output.
* Parameters: None
* Returns:
* void - no return value
*/
void util::clear()
{
std::cout << "\x1B[2J\x1B[H" << std::flush;
@@ -1,3 +1,10 @@
/*
* File: OutputHelper.h
* Description: Provides functions to help with console output.
* Author: Trenser
* Created: 01-04-2026
*/
#pragma once
#include <iostream>
@@ -1,18 +1,56 @@
/*
* File: Timestamp.cpp
* Description: Provides a utility class for representing and manipulating time values.
* Supports conversion between string and time formats, duration calculations
* (hours, minutes, seconds), date extraction, and comparison operators.
* Author: Trenser
* Created: 01-Apr-2026
*/
#include <sstream>
#include <iomanip>
#include <stdexcept>
#include "Timestamp.h"
/*
* Function: Timestamp
* Description: Default constructor that initializes the timestamp to the current system time.
* Parameters:
* None
* Returns:
* Timestamp object
*/
util::Timestamp::Timestamp()
{
m_time = std::time(nullptr);
}
/*
* Function: Timestamp (overloaded)
* Description: Constructor that initializes the timestamp with a given time value.
* Parameters:
* timeValue - time_t value representing a specific time
* Returns:
* Timestamp object
*/
util::Timestamp::Timestamp(std::time_t timeValue)
{
m_time = timeValue;
}
/*
* Function: fromString
* Description: Creates a Timestamp object from a formatted string.
* Parameters:
* timeString - string in the format "YYYY-MM-DD HH:MM:SS"
* Returns:
* Timestamp object representing the parsed time
* Throws:
* runtime_error if the string format is invalid
*/
util::Timestamp util::Timestamp::fromString(const std::string& timeString)
{
std::tm timeStruct = {};
@@ -26,6 +64,15 @@ util::Timestamp util::Timestamp::fromString(const std::string& timeString)
return Timestamp(parsedTimestamp);
}
/*
* Function: toString
* Description: Converts the Timestamp object into a formatted string.
* Parameters:
* None
* Returns:
* string - formatted as "YYYY-MM-DD HH:MM:SS"
*/
std::string util::Timestamp::toString() const
{
std::tm timeStruct = {};
@@ -35,11 +82,30 @@ std::string util::Timestamp::toString() const
return outputStream.str();
}
/*
* Function: getDurationInSeconds
* Description: Calculates the duration between two timestamps in seconds.
* Parameters:
* startTimestamp - starting time
* endTimestamp - ending time
* Returns:
* double - duration in seconds
*/
double util::Timestamp::getDurationInSeconds(const Timestamp& startTimestamp, const Timestamp& endTimestamp)
{
return std::difftime(endTimestamp.m_time, startTimestamp.m_time);
}
/*
* Function: getDateAsInt
* Description: Returns the date portion of the timestamp as an integer in YYYYMMDD format.
* Parameters:
* None
* Returns:
* int - date as YYYYMMDD
*/
int util::Timestamp::getDateAsInt() const
{
std::tm timeStruct{};
@@ -50,36 +116,101 @@ int util::Timestamp::getDateAsInt() const
return year * 10000 + month * 100 + day;
}
/*
* Function: getDurationInMinutes
* Description: Calculates the duration between two timestamps in minutes.
* Parameters:
* startTimestamp - starting time
* endTimestamp - ending time
* Returns:
* double - duration in minutes
*/
double util::Timestamp::getDurationInMinutes(const Timestamp& startTimestamp, const Timestamp& endTimestamp)
{
return getDurationInSeconds(startTimestamp, endTimestamp) / 60.0;
}
/*
* Function: getDurationInHours
* Description: Calculates the duration between two timestamps in hours.
* Parameters:
* startTimestamp - starting time
* endTimestamp - ending time
* Returns:
* double - duration in hours
*/
double util::Timestamp::getDurationInHours(const Timestamp& startTimestamp, const Timestamp& endTimestamp)
{
return getDurationInSeconds(startTimestamp, endTimestamp) / 3600.0;
}
/*
* Function: operator<
* Description: Compares two timestamps to check if one is earlier than the other.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is earlier
*/
bool util::Timestamp::operator<(const Timestamp& other) const
{
return m_time < other.m_time;
}
/*
* Function: operator>
* Description: Compares two timestamps to check if one is later than the other.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is later
*/
bool util::Timestamp::operator>(const Timestamp& other) const
{
return m_time > other.m_time;
}
/*
* Function: operator<=
* Description: Compares two timestamps to check if one is earlier or equal.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is earlier or equal
*/
bool util::Timestamp::operator<=(const Timestamp& other) const
{
return m_time <= other.m_time;
}
/*
* Function: operator>=
* Description: Compares two timestamps to check if one is later or equal.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is later or equal
*/
bool util::Timestamp::operator>=(const Timestamp& other) const
{
return m_time >= other.m_time;
}
/*
* Function: operator==
* Description: Compares two timestamps for equality.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if both timestamps are equal
*/
bool util::Timestamp::operator==(const Timestamp& other) const
{
return m_time == other.m_time;
@@ -1,3 +1,12 @@
/*
* File: Timestamp.h
* Description: Provides a utility class for representing and manipulating time values.
* Supports conversion between string and time formats, duration calculations
* (hours, minutes, seconds), date extraction, and comparison operators.
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include <ctime>
#include <string>
@@ -1,8 +1,24 @@
/*
* File: Validator.cpp
* Description: Validates inputs like phone number, email, password
* Author: Trenser
* Created: 01-Apr-2026
*/
#include <string>
#include <cctype>
#include "Validator.h"
#include "ApplicationConfig.h"
/*
* Function: isPhoneNumberValid
* Description: Validates whether the given string is a valid phone number.
* Parameters:
* phoneNumber - string containing the phone number to validate
* Returns:
* bool - true if the phone number is valid (10 digits, all numeric), false otherwise
*/
bool util::isPhoneNumberValid(const std::string& phoneNumber) {
if (phoneNumber.size() != 10)
{
@@ -16,6 +32,15 @@ bool util::isPhoneNumberValid(const std::string& phoneNumber) {
);
}
/*
* Function: isEmailValid
* Description: Validates whether the given string is a properly formatted email address.
* Parameters:
* email - string containing the email address to validate
* Returns:
* bool - true if the email contains exactly one '@' character and is not at the start or end, false otherwise
*/
bool util::isEmailValid(const std::string& email) {
size_t index = email.find('@');
if (index == std::string::npos) return false;
@@ -30,6 +55,19 @@ bool util::isEmailValid(const std::string& email) {
return true;
}
/*
* Function: isPasswordValid
* Description: Validates whether the given string meets password requirements.
* Parameters:
* password - string containing the password to validate
* Returns:
* bool - true if the password is valid, false otherwise
* Notes:
* - Must not equal the default password
* - Must be at least 8 characters long
* - Must contain at least one uppercase letter, one lowercase letter, one digit, and one special character
* - Must not contain whitespace
*/
bool util::isPasswordValid(const std::string& password)
{
@@ -1,3 +1,10 @@
/*
* File: Validator.h
* Description: Validates inputs like phone number, email, password
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include<string>
#include<algorithm>
@@ -1,8 +1,24 @@
/*
* File: AdminMenu.cpp
* Description: Handles user-related operations such as creation, authentication, and validation.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "AdminMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: AdminMenu::run
* Description: Starts and manages the administrator menu loop. Continuously displays
* options to the administrator until logout is selected or an exception occurs.
* Parameters:
* None
* Returns:
* None
*/
void AdminMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +43,15 @@ void AdminMenu::run()
}
}
/*
* Function: AdminMenu::handleOperation
* Description: Processes the administrators menu choice and executes the corresponding action.
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the administrator chooses to logout
*/
bool AdminMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: AdminMenu.h
* Description: Declaration of the AdminMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,8 +1,23 @@
/*
* File: EmployeeMenu.cpp
* Description: Implements the EmployeeMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "EmployeeMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: EmployeeMenu::run
* Description: Starts the employee menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void EmployeeMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +42,15 @@ void EmployeeMenu::run()
}
}
/*
* Function: EmployeeMenu::handleOperation
* Description: Handles the employees menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the employee chooses to logout
*/
bool EmployeeMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: EmployeeMenu.h
* Description: Declaration of the EmployeeMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,8 +1,23 @@
/*
* File: FinanceExecutiveMenu.cpp
* Description: Implements the FinanceExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "FinanceExecutiveMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: FinanceExecutiveMenu::run
* Description: Starts the finance executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void FinanceExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +42,15 @@ void FinanceExecutiveMenu::run()
}
}
/*
* Function: FinanceExecutiveMenu::handleOperation
* Description: Handles the finance executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the finance executive chooses to logout
*/
bool FinanceExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: FinanceExecutiveMenu.h
* Description: Declaration of the FinanceExecutiveMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,8 +1,23 @@
/*
* File: HRManagerMenu.cpp
* Description: Implements the HRManagerMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "HRManagerMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: HRManagerMenu::run
* Description: Starts the HR manager menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void HRManagerMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +42,15 @@ void HRManagerMenu::run()
}
}
/*
* Function: HRManagerMenu::handleOperation
* Description: Handles the HR managers menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the HR manager chooses to logout
*/
bool HRManagerMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: HRManagerMenu.h
* Description: Declaration of the EmployeeMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,8 +1,23 @@
/*
* File: ITExecutiveMenu.cpp
* Description: Implements the ITExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "ITExecutiveMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: ITExecutiveMenu::run
* Description: Starts the IT executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void ITExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +42,15 @@ void ITExecutiveMenu::run()
}
}
/*
* Function: ITExecutiveMenu::handleOperation
* Description: Handles the IT executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the IT executive chooses to logout
*/
bool ITExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: ITExecutiveMenu.h
* Description: Declaration of the ITExecutiveMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,8 +1,23 @@
/*
* File: TalentExecutiveMenu.cpp
* Description: Implements the TalentExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "TalentExecutiveMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: TalentExecutiveMenu::run
* Description: Starts the talent executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void TalentExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +42,15 @@ void TalentExecutiveMenu::run()
}
}
/*
* Function: TalentExecutiveMenu::handleOperation
* Description: Handles the talent executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the talent executive chooses to logout
*/
bool TalentExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: TalentExecutiveMenu.h
* Description: Declaration of the TalentExecutiveMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,8 +1,23 @@
/*
* File: TeamExecutiveMenu.cpp
* Description: Implements the TeamExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "TeamExecutiveMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: TeamExecutiveMenu::run
* Description: Starts the team executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void TeamExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +42,15 @@ void TeamExecutiveMenu::run()
}
}
/*
* Function: TeamExecutiveMenu::handleOperation
* Description: Handles the team executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the team executive chooses to logout
*/
bool TeamExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: TeamExecutiveMenu.h
* Description: Declaration of the TeamExecutiveMenu and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,8 +1,23 @@
/*
* File: TeamLeadMenu.cpp
* Description: Implements the TeamLeadMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "TeamLeadMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
/*
* Function: TeamLeadMenu::run
* Description: Starts the team lead menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void TeamLeadMenu::run()
{
bool isMenuActive = true;
@@ -27,6 +42,15 @@ void TeamLeadMenu::run()
}
}
/*
* Function: TeamLeadMenu::handleOperation
* Description: Handles the team leads menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the team lead chooses to logout
*/
bool TeamLeadMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: TeamLeadMenu.h
* Description: Declaration of the TeamLeadMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
@@ -1,3 +1,10 @@
/*
* File: UserInterface.cpp
* Description: Implements the UserInterface class functions including menu loop, login handling, and routing to appropriate role-based menus.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include <utility>
#include <memory>
@@ -16,6 +23,14 @@
#include "OutputHelper.h"
#include "Validator.h"
/*
* Function: UserInterface::run
* Description: Starts the user interface loop and displays login/exit options until exit is selected
* Parameters:
* None
* Returns:
* None
*/
void UserInterface::run()
{
bool isMenuActive = true;
@@ -40,6 +55,15 @@ void UserInterface::run()
}
}
/*
* Function: UserInterface::handleOperation
* Description: Handles the users menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the interface should remain active
* false - if the user chooses to exit
*/
bool UserInterface::handleOperation(int choice)
{
switch (choice)
@@ -57,6 +81,14 @@ bool UserInterface::handleOperation(int choice)
return true;
}
/*
* Function: UserInterface::login
* Description: Authenticates the user by email and password, validates login status, and routes to the appropriate menu
* Parameters:
* None
* Returns:
* None
*/
void UserInterface::login()
{
std::string email, password;
@@ -1,3 +1,10 @@
/*
* File: UserInterface.h
* Description: Declaration of the UserInterface class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include <memory>
#include <utility>