修复空story崩溃问题
This commit is contained in:
parent
5a4369d7cc
commit
c58b022b21
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
<LocalDebuggerCommandArguments>--path "E:\novel-set" --dest F:\novelout</LocalDebuggerCommandArguments>
|
<LocalDebuggerCommandArguments>--path "E:\CustomNovels\科学+修仙+创造世界" --dest F:\novelout</LocalDebuggerCommandArguments>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LocalDebuggerCommandArguments>--path "D:\Projects\Cpp\WsNovelParser\x64\test_file" --dest E:\</LocalDebuggerCommandArguments>
|
<LocalDebuggerCommandArguments>--path "D:\Projects\Cpp\WsNovelParser\x64\test_file" --dest E:\</LocalDebuggerCommandArguments>
|
||||||
|
|
|
@ -393,11 +393,14 @@ std::shared_ptr<FragmentNode> FragmentLayerCheck::_sets_fill(std::shared_ptr<con
|
||||||
auto ptr = _sets_fill(nis);
|
auto ptr = _sets_fill(nis);
|
||||||
if (ptr) list << ptr;
|
if (ptr) list << ptr;
|
||||||
}
|
}
|
||||||
for (auto nitr = ++list.begin(); nitr != list.end(); nitr++)
|
|
||||||
(*(nitr-1))->appendNext(*nitr);
|
|
||||||
|
|
||||||
if (list.size())
|
if (list.size()) {
|
||||||
|
for (auto nitr = ++list.begin(); nitr != list.end(); nitr++) {
|
||||||
|
auto prev = *(nitr - 1);
|
||||||
|
prev->appendNext(*nitr);
|
||||||
|
}
|
||||||
this->_story_start << list.first();
|
this->_story_start << list.first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -427,7 +430,6 @@ void FragmentLayerCheck::node_relayer(std::shared_ptr<FragmentNode> node, int cu
|
||||||
for (auto nis : node->referNodes())
|
for (auto nis : node->referNodes())
|
||||||
node_relayer(nis, curr_num + 1);
|
node_relayer(nis, curr_num + 1);
|
||||||
}
|
}
|
||||||
qDebug() << node->bind()->element()->signature() << node->layerNumber();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -455,15 +457,16 @@ void FragmentLayerCheck::story_layer_check(std::shared_ptr<const ast_gen::Elemen
|
||||||
std::copy_if(fragms_list.begin(), fragms_list.end(), std::back_inserter(real_elms),
|
std::copy_if(fragms_list.begin(), fragms_list.end(), std::back_inserter(real_elms),
|
||||||
[](std::shared_ptr<const ast_gen::ElementAccess> ins) { return ins->element()->typeMark() == (int) NovelNode::FragmentSlice; });
|
[](std::shared_ptr<const ast_gen::ElementAccess> ins) { return ins->element()->typeMark() == (int) NovelNode::FragmentSlice; });
|
||||||
|
|
||||||
for (auto curr = ++real_elms.begin(); curr != real_elms.end(); ++curr) {
|
if (real_elms.size())
|
||||||
auto prev_it = curr - 1;
|
for (auto curr = ++real_elms.begin(); curr != real_elms.end(); ++curr) {
|
||||||
auto curr_it = curr;
|
auto prev_it = curr - 1;
|
||||||
for (; curr_it != real_elms.end(); ++curr_it) {
|
auto curr_it = curr;
|
||||||
auto curr_sign = (*curr_it)->element()->signature();
|
for (; curr_it != real_elms.end(); ++curr_it) {
|
||||||
auto prev_sign = (*prev_it)->element()->signature();
|
auto curr_sign = (*curr_it)->element()->signature();
|
||||||
sibling_element_compair(story_nm, _node_set[prev_sign], _node_set[curr_sign]);
|
auto prev_sign = (*prev_it)->element()->signature();
|
||||||
|
sibling_element_compair(story_nm, _node_set[prev_sign], _node_set[curr_sign]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FragmentLayerCheck::sibling_element_compair(const QString& story, std::shared_ptr<const FragmentNode> prev, std::shared_ptr<const FragmentNode> curr) {
|
void FragmentLayerCheck::sibling_element_compair(const QString& story, std::shared_ptr<const FragmentNode> prev, std::shared_ptr<const FragmentNode> curr) {
|
||||||
|
@ -479,8 +482,8 @@ void FragmentLayerCheck::sibling_element_compair(const QString& story, std::shar
|
||||||
if (!curr_childs.size() || !prev_childs.size())
|
if (!curr_childs.size() || !prev_childs.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto max_e0 = *std::max_element(prev_childs.begin(), prev_childs.end(),
|
auto max_e0 = *std::max_element(prev_childs.begin(), prev_childs.end(),
|
||||||
[](std::shared_ptr<const FragmentNode> a, std::shared_ptr<const FragmentNode> b){
|
[](std::shared_ptr<const FragmentNode> a, std::shared_ptr<const FragmentNode> b) {
|
||||||
return a->layerNumber() < b->layerNumber();
|
return a->layerNumber() < b->layerNumber();
|
||||||
});
|
});
|
||||||
auto min_e1 = *std::min_element(curr_childs.begin(), curr_childs.end(),
|
auto min_e1 = *std::min_element(curr_childs.begin(), curr_childs.end(),
|
||||||
|
|
Loading…
Reference in New Issue