From 3ad8cca9f6fecfb4c1f70f0a8c9d4b860f4c2df3 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 12 Jun 2025 21:03:17 +0800 Subject: internal!: refactored to smart pointer --- src/commandHandler.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/commandHandler.hpp') diff --git a/src/commandHandler.hpp b/src/commandHandler.hpp index bce93d2..89d19d6 100644 --- a/src/commandHandler.hpp +++ b/src/commandHandler.hpp @@ -34,8 +34,8 @@ class CCommandHandler { bool validCommand(const std::string &command) const; // return false if command struct is invalid bool registerCommand(const SCommand &command); - SResult newCommand(const std::string &command, const std::string &args, CSession *const user) const; - void handleCommand(std::string input, CSession *const user = nullptr) const; + SResult newCommand(const std::string &command, const std::string &args, std::shared_ptr session) const; + void handleCommand(std::string input, std::shared_ptr user = nullptr) const; template struct SMakeCommandArgs { @@ -63,9 +63,9 @@ class CCommandHandler { } private: - const SCommand *getCommand(const std::string &command) const; - SResult exeCommand(const SCommand &command, const std::string &args) const; + std::shared_ptr getCommand(const std::string &command) const; + SResult exeCommand(const std::shared_ptr command, const std::string &args) const; - std::vector m_vCommands; + std::vector> m_vCommands; }; inline std::unique_ptr g_pCommandHandler; -- cgit v1.2.3