shangcheng/include/app.hpp

63 lines
1.3 KiB
C++
Raw Permalink Normal View History

2026-05-06 02:54:13 +00:00
#ifndef MALL_APP_HPP
#define MALL_APP_HPP
#include "product.hpp"
#include "shopping_cart.hpp"
#include "order.hpp"
#include <vector>
#include <memory>
/**
* @brief
*/
class App {
public:
/**
* @brief
*/
App();
/**
* @brief
*/
void run();
private:
std::vector<Product> products_; ///< 商品库
ShoppingCart cart_; ///< 当前购物车
std::vector<std::unique_ptr<Order>> orders_; ///< 历史订单列表
/**
* @brief
*/
void initProducts();
// ---- 菜单功能 ----
/** @brief 显示商品列表 */
void showProducts() const;
/** @brief 添加商品到购物车 */
void addToCart();
/** @brief 查看购物车 */
void showCart() const;
/** @brief 生成订单 */
void checkout();
/** @brief 查看历史订单 */
void showOrders() const;
/**
* @brief
* @return end()
*/
std::vector<Product>::const_iterator selectProduct() const;
/** @brief 打印菜单选项 */
static void printMenu();
};
#endif // MALL_APP_HPP