2025-06-25 14:34:26 +00:00
|
|
|
#include "ComponentsInfoPull.h"
|
2025-06-08 12:17:02 +00:00
|
|
|
|
|
|
|
ComponentsInfoPull::ComponentsInfoPull() {}
|
|
|
|
|
|
|
|
void ComponentsInfoPull::bindEntity(std::weak_ptr<WsEntity> ins)
|
|
|
|
{
|
|
|
|
this->_bind_entity = ins;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ComponentsInfoPull::name() const
|
|
|
|
{
|
|
|
|
return NAME(ComponentsInfoPull);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <QVariant>
|
|
|
|
#include <QJsonArray>
|
2025-06-28 17:38:37 +00:00
|
|
|
void ComponentsInfoPull::execute(
|
2025-06-10 06:21:55 +00:00
|
|
|
std::shared_ptr<const ComponentDatasQuery> in, QList<std::shared_ptr<ComponentDatasQueryResult>>& out)
|
2025-06-08 12:17:02 +00:00
|
|
|
{
|
2025-06-10 06:21:55 +00:00
|
|
|
auto rst = std::make_shared<ComponentDatasQueryResult>();
|
2025-06-08 12:17:02 +00:00
|
|
|
rst->reset(in->targetEntity(), in->sourceEntity());
|
|
|
|
|
|
|
|
auto bind_e = this->_bind_entity.lock();
|
|
|
|
rst->_entity_json["entity_templet"] = bind_e->templetName();
|
|
|
|
rst->_entity_json["entity_id"] = QJsonValue::fromVariant(QVariant::fromValue(bind_e->entityID()));
|
|
|
|
rst->_entity_json["entity_name"] = bind_e->name();
|
|
|
|
|
2025-07-11 16:30:19 +00:00
|
|
|
QList<std::shared_ptr<WsComponent>> comp_list;
|
2025-06-08 12:17:02 +00:00
|
|
|
auto host_conv = std::dynamic_pointer_cast<ComponentSet>(bind_e);
|
|
|
|
comp_list = host_conv->components();
|
|
|
|
|
|
|
|
auto array = QJsonArray();
|
|
|
|
for (auto ins : comp_list) {
|
2025-06-10 18:05:00 +00:00
|
|
|
if(ins->name() == this->name())
|
|
|
|
continue;
|
|
|
|
|
2025-06-08 12:17:02 +00:00
|
|
|
auto info_comp = QJsonObject();
|
|
|
|
info_comp["component_type"] = ins->name();
|
|
|
|
ins->saveTo(info_comp);
|
|
|
|
array.append(info_comp);
|
|
|
|
}
|
|
|
|
rst->_entity_json["component_list"] = array;
|
|
|
|
out << rst;
|
|
|
|
}
|
|
|
|
|
2025-06-10 13:00:30 +00:00
|
|
|
#include <internal_impl.h>
|
2025-06-28 17:38:37 +00:00
|
|
|
void ComponentsInfoPull::execute(
|
2025-06-10 12:39:10 +00:00
|
|
|
std::shared_ptr<const ProcedureSignatureQuery> in, QList<std::shared_ptr<ProcedureSignatureQueryResult>>& out)
|
2025-06-08 12:17:02 +00:00
|
|
|
{
|
2025-06-10 15:44:38 +00:00
|
|
|
auto ent_ins = std::dynamic_pointer_cast<ComponentSet>(this->_bind_entity.lock());
|
2025-06-10 13:00:30 +00:00
|
|
|
auto comps = ent_ins->components();
|
2025-06-10 12:39:10 +00:00
|
|
|
|
2025-06-10 13:00:30 +00:00
|
|
|
auto result = std::make_shared<ProcedureSignatureQueryResult>();
|
|
|
|
result->reset(in->targetEntity(), in->sourceEntity());
|
|
|
|
for (auto cp : comps) {
|
2025-06-28 17:38:37 +00:00
|
|
|
result->_signature_list.append(cp->respondSignatures());
|
2025-06-10 13:00:30 +00:00
|
|
|
}
|
|
|
|
out << result;
|
2025-06-08 12:17:02 +00:00
|
|
|
}
|
|
|
|
|
2025-06-28 17:38:37 +00:00
|
|
|
std::shared_ptr<Serializable> ComponentsInfoPull::newDefault() const
|
2025-06-08 12:17:02 +00:00
|
|
|
{
|
2025-06-10 12:39:10 +00:00
|
|
|
return std::make_shared<ComponentsInfoPull>();
|
2025-06-08 12:17:02 +00:00
|
|
|
}
|
|
|
|
|
2025-06-10 12:39:10 +00:00
|
|
|
void ComponentsInfoPull::recoveryFrom(const QJsonObject& obj) {}
|
2025-06-08 12:17:02 +00:00
|
|
|
|
2025-06-10 12:39:10 +00:00
|
|
|
void ComponentsInfoPull::saveTo(QJsonObject& obj) const {}
|