#ifndef MALL_APP_HPP #define MALL_APP_HPP #include "product.hpp" #include "shopping_cart.hpp" #include "order.hpp" #include #include /** * @brief 商城应用类,协调商品、购物车、订单的管理与交互。 */ class App { public: /** * @brief 构造函数,初始化预置商品。 */ App(); /** * @brief 启动商城控制台交互。 */ void run(); private: std::vector products_; ///< 商品库 ShoppingCart cart_; ///< 当前购物车 std::vector> 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::const_iterator selectProduct() const; /** @brief 打印菜单选项 */ static void printMenu(); }; #endif // MALL_APP_HPP