update:导入逻辑进度更新。

This commit is contained in:
2024-05-19 16:50:22 +08:00
parent 2bc368c781
commit 00b15c46b8
4 changed files with 40 additions and 8 deletions

View File

@@ -127,7 +127,7 @@ bool CXmlOpr::check_same_struct(const std::string& data)
return false;
}
const auto* attribute = own_ele->FirstAttribute();
int own_cnt = 0;
int own_cnt = 0;
while (attribute) {
++own_cnt;
if (import_ele->FindAttribute(attribute->Name()) == nullptr) {
@@ -137,7 +137,7 @@ bool CXmlOpr::check_same_struct(const std::string& data)
}
const auto* attr_import = import_ele->FirstAttribute();
int import_cnt = 0;
int import_cnt = 0;
while (attr_import) {
++import_cnt;
attr_import = attr_import->Next();
@@ -150,10 +150,27 @@ bool CXmlOpr::check_same_struct(const std::string& data)
return true;
}
bool CXmlOpr::import_newer_data(const std::vector<std::string>& vec)
// Warning: 不检查 xml 格式合法性,请自行调用 check_valid_xml_data
// 且导入前每条数据请自行使用 check_same_struct 检测。
bool CXmlOpr::import_newer_data(const std::vector<std::string>& vec, std::size_t success_count)
{
return false;
success_count = 0;
auto* last_item = parent_node_->LastChildElement(opr_base_.the_node.c_str());
if (last_item == nullptr) {
return false;
}
for (const auto& data : vec) {
tinyxml2::XMLDocument doc;
doc.Parse(data.c_str());
auto* item = doc.FirstChildElement(opr_base_.the_node.c_str());
if (item == nullptr) {
continue;
}
++success_count;
auto* nitem = copy_element(item);
insert_brother_node(last_item, nitem);
}
return true;
}
void CXmlOpr::del_element(Element_t* ele)