User class definitions
This commit is contained in:
@@ -1 +1,11 @@
|
|||||||
#include "Customer.h"
|
#include "Customer.h"
|
||||||
|
|
||||||
|
void Customer::addOrder(std::shared_ptr<Order> orderPointer)
|
||||||
|
{
|
||||||
|
m_orders[orderPointer->getId()] = orderPointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
orders& Customer::getOrders()
|
||||||
|
{
|
||||||
|
return m_orders;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,17 +4,18 @@ Date: 17-02-2026
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Order.h"
|
#include "Order.h"
|
||||||
|
|
||||||
using orders = std::vector<Order*>;
|
using orders = std::map<int, std::shared_ptr<Order>>;
|
||||||
|
|
||||||
class Customer : public User
|
class Customer : public User
|
||||||
{
|
{
|
||||||
orders m_orders;
|
orders m_orders;
|
||||||
private:
|
private:
|
||||||
void addOrder(Order*);
|
void addOrder(std::shared_ptr<Order>);
|
||||||
orders& getOrders();
|
orders& getOrders();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,11 @@
|
|||||||
|
/*
|
||||||
|
Author: Joel Mathew Thomas
|
||||||
|
Date: 18-02-2026
|
||||||
|
*/
|
||||||
|
|
||||||
#include "DeliveryPartner.h"
|
#include "DeliveryPartner.h"
|
||||||
|
|
||||||
|
void DeliveryPartner::acceptDeliveryAssignment(std::shared_ptr<DeliveryAssignment> deliveryAssignmentPointer)
|
||||||
|
{
|
||||||
|
m_deliveryAssignments[deliveryAssignmentPointer->getId()] = deliveryAssignmentPointer;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,18 +4,19 @@ Date: 17-02-2026
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "DeliveryAssignment.h"
|
#include "DeliveryAssignment.h"
|
||||||
|
|
||||||
using deliveryAssignments = std::vector<DeliveryAssignment*>;
|
using deliveryAssignments = std::map<int, std::shared_ptr<DeliveryAssignment>>;
|
||||||
|
|
||||||
class DeliveryPartner : public User
|
class DeliveryPartner : public User
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
deliveryAssignments m_deliveryAssignments;
|
deliveryAssignments m_deliveryAssignments;
|
||||||
public:
|
public:
|
||||||
void acceptDeliveryAssignment(DeliveryAssignment*);
|
void acceptDeliveryAssignment(std::shared_ptr<DeliveryAssignment>);
|
||||||
deliveryAssignments& getAssignedDeliveries();
|
deliveryAssignments& getAssignedDeliveries();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public:
|
|||||||
m_status(OrderStatus::CREATED)
|
m_status(OrderStatus::CREATED)
|
||||||
{}
|
{}
|
||||||
~Order();
|
~Order();
|
||||||
|
int getId() const;
|
||||||
void addItem();
|
void addItem();
|
||||||
void removeItem();
|
void removeItem();
|
||||||
items& getItems();
|
items& getItems();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public:
|
|||||||
m_status(true)
|
m_status(true)
|
||||||
{}
|
{}
|
||||||
~Restaurant();
|
~Restaurant();
|
||||||
|
int getId() const;
|
||||||
menuItems& getMenuItems();
|
menuItems& getMenuItems();
|
||||||
orders& getOrders();
|
orders& getOrders();
|
||||||
bool getStatus() const;
|
bool getStatus() const;
|
||||||
|
|||||||
@@ -1 +1,16 @@
|
|||||||
|
/*
|
||||||
|
Author: Joel Mathew Thomas
|
||||||
|
Date: 18-02-2026
|
||||||
|
*/
|
||||||
|
|
||||||
#include "RestaurantOwner.h"
|
#include "RestaurantOwner.h"
|
||||||
|
|
||||||
|
void RestaurantOwner::addRestaurant(std::shared_ptr<Restaurant> restaurantPointer)
|
||||||
|
{
|
||||||
|
m_restaurants[restaurantPointer->getId()] = restaurantPointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
restaurants& RestaurantOwner::getRestaurants()
|
||||||
|
{
|
||||||
|
return m_restaurants;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,18 +4,19 @@ Date: 17-02-2026
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Restaurant.h"
|
#include "Restaurant.h"
|
||||||
#include "MenuItem.h"
|
#include "MenuItem.h"
|
||||||
|
|
||||||
using restaurants = std::vector<Restaurant*>;
|
using restaurants = std::map<int, std::shared_ptr<Restaurant>>;
|
||||||
|
|
||||||
class RestaurantOwner : public User
|
class RestaurantOwner : public User
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
restaurants m_restaurants;
|
restaurants m_restaurants;
|
||||||
public:
|
public:
|
||||||
void addRestaurant(Restaurant*);
|
void addRestaurant(std::shared_ptr<Restaurant>);
|
||||||
restaurants& getRestaurants();
|
restaurants& getRestaurants();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1 +1,36 @@
|
|||||||
|
/*
|
||||||
|
Author: Joel Mathew Thomas
|
||||||
|
Date: 18-02-2026
|
||||||
|
*/
|
||||||
|
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
|
|
||||||
|
int User::getId() const
|
||||||
|
{
|
||||||
|
return m_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string User::getUsername() const
|
||||||
|
{
|
||||||
|
return m_username;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string User::getName() const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string User::getPhone() const
|
||||||
|
{
|
||||||
|
return m_phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string User::getEmail() const
|
||||||
|
{
|
||||||
|
return m_email;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool User::login(const std::string& password) const
|
||||||
|
{
|
||||||
|
return password == m_password;
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,35 +10,37 @@ class User
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int m_id;
|
int m_id;
|
||||||
|
std::string m_username;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
std::string m_phone;
|
std::string m_phone;
|
||||||
std::string m_password;
|
std::string m_password;
|
||||||
std::string m_email;
|
std::string m_email;
|
||||||
bool m_isAuthenticated;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
User()
|
User():
|
||||||
: m_id(0),
|
m_username(""),
|
||||||
m_name(""),
|
m_name(""),
|
||||||
m_phone(""),
|
m_phone(""),
|
||||||
m_password(""),
|
m_password(""),
|
||||||
m_email(""),
|
m_email("")
|
||||||
m_isAuthenticated(false)
|
|
||||||
{}
|
{}
|
||||||
User(int id,
|
User(int id,
|
||||||
|
const std::string& username,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& phone,
|
const std::string& phone,
|
||||||
const std::string& password,
|
const std::string& password,
|
||||||
const std::string& email)
|
const std::string& email):
|
||||||
: m_id(id),
|
m_username(""),
|
||||||
m_name(name),
|
m_name(username),
|
||||||
m_phone(phone),
|
m_phone(phone),
|
||||||
m_password(password),
|
m_password(password),
|
||||||
m_email(email),
|
m_email(email)
|
||||||
m_isAuthenticated(false)
|
|
||||||
{}
|
{}
|
||||||
virtual ~User() = default;
|
virtual ~User() = default;
|
||||||
void login();
|
std::string getUsername() const;
|
||||||
void logout();
|
std::string getName() const;
|
||||||
|
std::string getPhone() const;
|
||||||
|
std::string getEmail() const;
|
||||||
|
bool login(const std::string&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user