Skip to content

Commit

Permalink
refactor: get_task_list -> get_node_list
Browse files Browse the repository at this point in the history
@binding-developers
  • Loading branch information
MistEO committed Jan 15, 2025
1 parent 43cfccb commit 1959a79
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/MaaFramework/Instance/MaaResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions source/MaaFramework/API/MaaResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
9 changes: 6 additions & 3 deletions source/MaaFramework/API/MaaTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct MaaResource
virtual void clear_custom_action() = 0;

virtual std::string get_hash() const = 0;
virtual std::vector<std::string> get_task_list() const = 0;
virtual std::vector<std::string> get_node_list() const = 0;
};

struct MaaController
Expand Down Expand Up @@ -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<std::string>& next) = 0;

Expand Down
2 changes: 1 addition & 1 deletion source/MaaFramework/Resource/PipelineResMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ bool PipelineResMgr::check_next_list(const PipelineData::NextList& next_list, co
return true;
}

std::vector<std::string> PipelineResMgr::get_task_list() const
std::vector<std::string> PipelineResMgr::get_node_list() const
{
auto k = pipeline_data_map_ | std::views::keys;
return std::vector(k.begin(), k.end());
Expand Down
2 changes: 1 addition & 1 deletion source/MaaFramework/Resource/PipelineResMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PipelineResMgr : public NonCopyable

const PipelineDataMap& get_pipeline_data_map() const { return pipeline_data_map_; }

std::vector<std::string> get_task_list() const;
std::vector<std::string> get_node_list() const;

public:
static bool parse_task(
Expand Down
4 changes: 2 additions & 2 deletions source/MaaFramework/Resource/ResourceMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ std::string ResourceMgr::get_hash() const
return hash_cache_;
}

std::vector<std::string> ResourceMgr::get_task_list() const
std::vector<std::string> ResourceMgr::get_node_list() const
{
return pipeline_res_.get_task_list();
return pipeline_res_.get_node_list();
}

void ResourceMgr::post_stop()
Expand Down
2 changes: 1 addition & 1 deletion source/MaaFramework/Resource/ResourceMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ResourceMgr : public MaaResource
virtual void clear_custom_action() override;

virtual std::string get_hash() const override;
virtual std::vector<std::string> get_task_list() const override;
virtual std::vector<std::string> get_node_list() const override;

public:
void post_stop();
Expand Down
2 changes: 1 addition & 1 deletion source/binding/NodeJS/src/instance/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ std::optional<std::string> resource_get_hash(Napi::External<ResourceInfo> info)
std::optional<std::vector<std::string>> resource_get_task_list(Napi::External<ResourceInfo> 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(); });
}
Expand Down

4 comments on commit 1959a79

@MistEO
Copy link
Member Author

@MistEO MistEO commented on 1959a79 Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaaXYZ/binding-developers 这个也改一哈_(:з」∠)_

虽然但是这个是不是只有 VSC 插件用到了

@neko-para
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我感觉插件也没用(

@MistEO
Copy link
Member Author

@MistEO MistEO commented on 1959a79 Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前是哪里用的来着

@neko-para
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

忘了,不过应该是用来反射的反正

Please sign in to comment.