Split block map simple/long key for both key/value

This commit is contained in:
Jesse Beder
2012-05-22 14:20:50 -05:00
parent 952fe51c73
commit 41e4cd3308
5 changed files with 109 additions and 27 deletions

View File

@@ -58,12 +58,26 @@ namespace YAML
m_hasNonContent = true;
}
void EmitterState::SetLongKey()
{
assert(!m_groups.empty());
if(m_groups.empty())
return;
assert(m_groups.top().type == GroupType::Map);
assert(m_groups.top().flowType == FlowType::Block);
m_groups.top().longKey = true;
}
void EmitterState::StartedNode()
{
if(m_groups.empty())
if(m_groups.empty()) {
m_docCount++;
else
} else {
m_groups.top().childCount++;
if(m_groups.top().childCount % 2 == 0)
m_groups.top().longKey = false;
}
m_hasAnchor = false;
m_hasTag = false;
@@ -166,6 +180,11 @@ namespace YAML
return m_groups.empty() ? m_docCount : m_groups.top().childCount;
}
bool EmitterState::CurGroupLongKey() const
{
return m_groups.empty() ? false : m_groups.top().longKey;
}
void EmitterState::ClearModifiedSettings()
{
m_modifiedSettings.clear();