Added long key flow map

This commit is contained in:
Jesse Beder
2012-05-22 16:41:03 -05:00
parent 676e0b94ac
commit f4278fe39f

View File

@@ -422,10 +422,59 @@ namespace YAML
void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child)
{ {
const unsigned lastIndent = m_pState->LastIndent();
if(!m_pState->HasBegunNode()) {
if(m_stream.comment())
m_stream << "\n";
m_stream << IndentTo(lastIndent);
if(m_pState->CurGroupChildCount() == 0)
m_stream << "{ ?";
else
m_stream << ", ?";
}
switch(child) {
case EmitterNodeType::None:
break;
case EmitterNodeType::Property:
case EmitterNodeType::Scalar:
case EmitterNodeType::FlowSeq:
case EmitterNodeType::FlowMap:
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, lastIndent);
break;
case EmitterNodeType::BlockSeq:
case EmitterNodeType::BlockMap:
assert(false);
break;
}
} }
void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child)
{ {
const unsigned lastIndent = m_pState->LastIndent();
if(!m_pState->HasBegunNode()) {
if(m_stream.comment())
m_stream << "\n";
m_stream << IndentTo(lastIndent);
m_stream << ":";
}
switch(child) {
case EmitterNodeType::None:
break;
case EmitterNodeType::Property:
case EmitterNodeType::Scalar:
case EmitterNodeType::FlowSeq:
case EmitterNodeType::FlowMap:
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, lastIndent);
break;
case EmitterNodeType::BlockSeq:
case EmitterNodeType::BlockMap:
assert(false);
break;
}
} }
void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child)