mirror of
https://github.com/libAthena/athena.git
synced 2025-06-18 04:23:47 +00:00
YAMLDocReader sequence fix
This commit is contained in:
parent
821e9c505e
commit
ae14d51607
@ -549,6 +549,8 @@ public:
|
||||
{
|
||||
int& seqIdx = m_seqTrackerStack.back();
|
||||
m_subStack.push_back(curSub->m_seqChildren[seqIdx++].get());
|
||||
if (m_subStack.back()->m_type == YAML_SEQUENCE_NODE)
|
||||
m_seqTrackerStack.push_back(0);
|
||||
return true;
|
||||
}
|
||||
for (const auto& item : curSub->m_mapChildren)
|
||||
@ -556,6 +558,8 @@ public:
|
||||
if (!item.first.compare(name))
|
||||
{
|
||||
m_subStack.push_back(item.second.get());
|
||||
if (m_subStack.back()->m_type == YAML_SEQUENCE_NODE)
|
||||
m_seqTrackerStack.push_back(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -565,8 +569,12 @@ public:
|
||||
void leaveSubRecord()
|
||||
{
|
||||
if (m_subStack.size() > 1)
|
||||
{
|
||||
if (m_subStack.back()->m_type == YAML_SEQUENCE_NODE)
|
||||
m_seqTrackerStack.pop_back();
|
||||
m_subStack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void enumerate(const char* name, T& record)
|
||||
@ -579,6 +587,15 @@ public:
|
||||
bool enterSubVector(const char* name, size_t& countOut)
|
||||
{
|
||||
YAMLNode* curSub = m_subStack.back();
|
||||
if (!name && curSub->m_type == YAML_SEQUENCE_NODE)
|
||||
{
|
||||
m_subStack.push_back(curSub);
|
||||
m_seqTrackerStack.push_back(0);
|
||||
countOut = curSub->m_seqChildren.size();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& item : curSub->m_mapChildren)
|
||||
{
|
||||
if (!item.first.compare(name))
|
||||
@ -598,6 +615,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
countOut = 0;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user