summaryrefslogtreecommitdiff
path: root/src/commandHandler.hpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-06-12 21:03:17 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-06-13 20:22:13 +0800
commit3ad8cca9f6fecfb4c1f70f0a8c9d4b860f4c2df3 (patch)
tree0e8dc3ed30eac7188714726e188a92ccfe2aa715 /src/commandHandler.hpp
parente9f9065e4347ed5e99092612dd90fd85b622ad1c (diff)
internal!: refactored to smart pointer
Diffstat (limited to 'src/commandHandler.hpp')
-rw-r--r--src/commandHandler.hpp10
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;