From 1959a79390c7abddc73a097a2debb4d2efe05e3b Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 15 Jan 2025 17:00:35 +0800 Subject: [PATCH] refactor: get_task_list -> get_node_list @binding-developers --- include/MaaFramework/Instance/MaaResource.h | 2 +- source/MaaFramework/API/MaaResource.cpp | 4 ++-- source/MaaFramework/API/MaaTypes.h | 9 ++++++--- source/MaaFramework/Resource/PipelineResMgr.cpp | 2 +- source/MaaFramework/Resource/PipelineResMgr.h | 2 +- source/MaaFramework/Resource/ResourceMgr.cpp | 4 ++-- source/MaaFramework/Resource/ResourceMgr.h | 2 +- source/binding/NodeJS/src/instance/resource.cpp | 2 +- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/MaaFramework/Instance/MaaResource.h b/include/MaaFramework/Instance/MaaResource.h index 54fee0033..ef80a6541 100644 --- a/include/MaaFramework/Instance/MaaResource.h +++ b/include/MaaFramework/Instance/MaaResource.h @@ -51,7 +51,7 @@ extern "C" MAA_FRAMEWORK_API MaaBool MaaResourceGetHash(const MaaResource* res, /* out */ MaaStringBuffer* buffer); - MAA_FRAMEWORK_API MaaBool MaaResourceGetTaskList(const MaaResource* res, /* out */ MaaStringListBuffer* buffer); + MAA_FRAMEWORK_API MaaBool MaaResourceGetNodeList(const MaaResource* res, /* out */ MaaStringListBuffer* buffer); #ifdef __cplusplus } diff --git a/source/MaaFramework/API/MaaResource.cpp b/source/MaaFramework/API/MaaResource.cpp index ff97e0a59..338adc73f 100644 --- a/source/MaaFramework/API/MaaResource.cpp +++ b/source/MaaFramework/API/MaaResource.cpp @@ -193,14 +193,14 @@ MaaBool MaaResourceGetHash(const MaaResource* res, MaaStringBuffer* buffer) return true; } -MaaBool MaaResourceGetTaskList(const MaaResource* res, /* out */ MaaStringListBuffer* buffer) +MaaBool MaaResourceGetNodeList(const MaaResource* res, /* out */ MaaStringListBuffer* buffer) { if (!res || !buffer) { LogError << "handle is null"; return false; } - auto list = res->get_task_list(); + auto list = res->get_node_list(); buffer->clear(); diff --git a/source/MaaFramework/API/MaaTypes.h b/source/MaaFramework/API/MaaTypes.h index 201cb91ec..efb2b5303 100644 --- a/source/MaaFramework/API/MaaTypes.h +++ b/source/MaaFramework/API/MaaTypes.h @@ -34,7 +34,7 @@ struct MaaResource virtual void clear_custom_action() = 0; virtual std::string get_hash() const = 0; - virtual std::vector get_task_list() const = 0; + virtual std::vector get_node_list() const = 0; }; struct MaaController @@ -102,8 +102,11 @@ struct MaaContext virtual MaaTaskId run_task(const std::string& entry, const json::object& pipeline_override) = 0; virtual MaaRecoId run_recognition(const std::string& entry, const json::object& pipeline_override, const cv::Mat& image) = 0; - virtual MaaNodeId - run_action(const std::string& entry, const json::object& pipeline_override, const cv::Rect& box, const std::string& reco_detail) = 0; + virtual MaaNodeId run_action( + const std::string& entry, + const json::object& pipeline_override, + const cv::Rect& box, + const std::string& reco_detail) = 0; virtual bool override_pipeline(const json::object& pipeline_override) = 0; virtual bool override_next(const std::string& node_name, const std::vector& next) = 0; diff --git a/source/MaaFramework/Resource/PipelineResMgr.cpp b/source/MaaFramework/Resource/PipelineResMgr.cpp index 10891ab74..ae3031eb1 100644 --- a/source/MaaFramework/Resource/PipelineResMgr.cpp +++ b/source/MaaFramework/Resource/PipelineResMgr.cpp @@ -185,7 +185,7 @@ bool PipelineResMgr::check_next_list(const PipelineData::NextList& next_list, co return true; } -std::vector PipelineResMgr::get_task_list() const +std::vector PipelineResMgr::get_node_list() const { auto k = pipeline_data_map_ | std::views::keys; return std::vector(k.begin(), k.end()); diff --git a/source/MaaFramework/Resource/PipelineResMgr.h b/source/MaaFramework/Resource/PipelineResMgr.h index 9e0eba2ac..1c3b65576 100644 --- a/source/MaaFramework/Resource/PipelineResMgr.h +++ b/source/MaaFramework/Resource/PipelineResMgr.h @@ -27,7 +27,7 @@ class PipelineResMgr : public NonCopyable const PipelineDataMap& get_pipeline_data_map() const { return pipeline_data_map_; } - std::vector get_task_list() const; + std::vector get_node_list() const; public: static bool parse_task( diff --git a/source/MaaFramework/Resource/ResourceMgr.cpp b/source/MaaFramework/Resource/ResourceMgr.cpp index 035a86812..f9f3b097c 100644 --- a/source/MaaFramework/Resource/ResourceMgr.cpp +++ b/source/MaaFramework/Resource/ResourceMgr.cpp @@ -106,9 +106,9 @@ std::string ResourceMgr::get_hash() const return hash_cache_; } -std::vector ResourceMgr::get_task_list() const +std::vector ResourceMgr::get_node_list() const { - return pipeline_res_.get_task_list(); + return pipeline_res_.get_node_list(); } void ResourceMgr::post_stop() diff --git a/source/MaaFramework/Resource/ResourceMgr.h b/source/MaaFramework/Resource/ResourceMgr.h index 9838ba322..aa14c2581 100644 --- a/source/MaaFramework/Resource/ResourceMgr.h +++ b/source/MaaFramework/Resource/ResourceMgr.h @@ -51,7 +51,7 @@ class ResourceMgr : public MaaResource virtual void clear_custom_action() override; virtual std::string get_hash() const override; - virtual std::vector get_task_list() const override; + virtual std::vector get_node_list() const override; public: void post_stop(); diff --git a/source/binding/NodeJS/src/instance/resource.cpp b/source/binding/NodeJS/src/instance/resource.cpp index 711d8ab88..6b2ca6653 100644 --- a/source/binding/NodeJS/src/instance/resource.cpp +++ b/source/binding/NodeJS/src/instance/resource.cpp @@ -166,7 +166,7 @@ std::optional resource_get_hash(Napi::External info) std::optional> resource_get_task_list(Napi::External info) { StringListBuffer buffer; - auto ret = MaaResourceGetTaskList(info.Data()->handle, buffer); + auto ret = MaaResourceGetNodeList(info.Data()->handle, buffer); if (ret) { return buffer.as_vector([](StringBufferRefer buf) { return buf.str(); }); }