diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-06-12 21:03:17 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-06-13 20:22:13 +0800 |
| commit | 3ad8cca9f6fecfb4c1f70f0a8c9d4b860f4c2df3 (patch) | |
| tree | 0e8dc3ed30eac7188714726e188a92ccfe2aa715 /src/commandHandler.hpp | |
| parent | e9f9065e4347ed5e99092612dd90fd85b622ad1c (diff) | |
internal!: refactored to smart pointer
Diffstat (limited to 'src/commandHandler.hpp')
| -rw-r--r-- | src/commandHandler.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
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<CSession> session) const; + void handleCommand(std::string input, std::shared_ptr<CSession> user = nullptr) const; template <typename T> 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<CCommandHandler::SCommand> getCommand(const std::string &command) const; + SResult exeCommand(const std::shared_ptr<SCommand> command, const std::string &args) const; - std::vector<SCommand> m_vCommands; + std::vector<std::shared_ptr<SCommand>> m_vCommands; }; inline std::unique_ptr<CCommandHandler> g_pCommandHandler; |
