summaryrefslogtreecommitdiff
path: root/src/command
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-06-13 20:19:22 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-06-13 20:23:03 +0800
commit8ee8e55ff2b085762dad5ab41269448e7a91757f (patch)
treeec1ed6b4944ca1fc4f1adbf67a255912e23a516c /src/command
parent23492ea6f58762914a91516be6a9c180969178a2 (diff)
internal: shortened smart pointer types
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commandHandler.cpp2
-rw-r--r--src/command/commandHandler.hpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/src/command/commandHandler.cpp b/src/command/commandHandler.cpp
index 4aa6723..3baeeb1 100644
--- a/src/command/commandHandler.cpp
+++ b/src/command/commandHandler.cpp
@@ -2,7 +2,7 @@
#include "../debug/log.hpp"
#include "../core/session.hpp"
#include <algorithm>
-#include <memory>
+#include "../misc/memory.hpp"
CCommandHandler::CCommandHandler() {
log(LOG, "CommandHandler: initialized");
diff --git a/src/command/commandHandler.hpp b/src/command/commandHandler.hpp
index 7fc20d5..5a8636f 100644
--- a/src/command/commandHandler.hpp
+++ b/src/command/commandHandler.hpp
@@ -3,7 +3,7 @@
#include "../core/session.hpp"
#include <any>
#include <functional>
-#include <memory>
+#include "../misc/memory.hpp"
#include <netinet/in.h>
#include <string>
#include <vector>
@@ -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, std::shared_ptr<CSession> session) const;
- void handleCommand(std::string input, std::shared_ptr<CSession> user = nullptr) const;
+ SResult newCommand(const std::string &command, const std::string &args, SP<CSession> session) const;
+ void handleCommand(std::string input, SP<CSession> user = nullptr) const;
template <typename T>
struct SMakeCommandArgs {
@@ -63,9 +63,9 @@ class CCommandHandler {
}
private:
- std::shared_ptr<CCommandHandler::SCommand> getCommand(const std::string &command) const;
- SResult exeCommand(const std::shared_ptr<SCommand> command, const std::string &args) const;
+ SP<CCommandHandler::SCommand> getCommand(const std::string &command) const;
+ SResult exeCommand(const SP<SCommand> command, const std::string &args) const;
- std::vector<std::shared_ptr<SCommand>> m_vCommands;
+ std::vector<SP<SCommand>> m_vCommands;
};
-inline std::unique_ptr<CCommandHandler> g_pCommandHandler;
+inline UP<CCommandHandler> g_pCommandHandler;