b98062d45c
<UserStory> 1957: Model Refactoring </UserStory> UserStory #1957 <Changes> 1. Added SerializedRecords.h dependency and forward declaration for SerializedInventoryItem to support fixed-size record storage. 2. Replaced CSV-based serialization in InventoryItem with serialize() method returning SerializedInventoryItem structure. 3. Replaced CSV-based deserialization logic with deserialize() method that reconstructs InventoryItem directly from SerializedInventoryItem record. 4. Removed legacy CSV parsing, header generation, and exception handling tied to string-based serialization. 5. Updated InventoryItem class interface in InventoryItem.h to use SerializedInventoryItem types instead of std::string serialization APIs. </Changes> <Test> N/A </Test> <Review> Sreeja Reghukumar </Review>
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
/*
|
|
File: InventoryItem.h
|
|
Description: Declares the InventoryItem class which represents parts in the Vehicle Service Management System.
|
|
Each item has a unique ID, part name, quantity, price, and status.
|
|
Author: Trenser
|
|
Date: 19-May-2026
|
|
*/
|
|
|
|
#pragma once
|
|
#include <string>
|
|
#include "Enums.h"
|
|
|
|
struct SerializedInventoryItem;
|
|
|
|
class InventoryItem
|
|
{
|
|
private:
|
|
static int m_uid;
|
|
std::string m_id;
|
|
std::string m_partName;
|
|
int m_quantity;
|
|
double m_price;
|
|
util::State m_status;
|
|
public:
|
|
InventoryItem();
|
|
InventoryItem(const std::string& partName, int quantity, double price);
|
|
InventoryItem(const std::string& id, const std::string& partName, int quantity, double price, util::State status);
|
|
const std::string& getId() const;
|
|
const std::string& getPartName() const;
|
|
int getQuantity() const;
|
|
double getPrice() const;
|
|
util::State getState() const;
|
|
void setId(const std::string& id);
|
|
void setPartName(const std::string& partName);
|
|
void setQuantity(int quantity);
|
|
void setPrice(double price);
|
|
void setState(util::State status);
|
|
SerializedInventoryItem serialize() const;
|
|
static InventoryItem* deserialize(const SerializedInventoryItem&);
|
|
}; |