Commit a626424b authored by Jesse Beder's avatar Jesse Beder
Browse files

Split the block map prepare into key/value

parent 80823583
......@@ -92,6 +92,8 @@ namespace YAML
void BlockSeqPrepareNode(EmitterNodeType::value child);
void FlowMapPrepareNode(EmitterNodeType::value child);
void BlockMapPrepareNode(EmitterNodeType::value child);
void BlockMapPrepareKey(EmitterNodeType::value child);
void BlockMapPrepareValue(EmitterNodeType::value child);
void SpaceOrIndentTo(bool requireSpace, unsigned indent);
......
......@@ -357,30 +357,29 @@ namespace YAML
}
void Emitter::BlockMapPrepareNode(EmitterNodeType::value child)
{
const std::size_t childCount = m_pState->CurGroupChildCount();
if(childCount % 2 == 0)
BlockMapPrepareKey(child);
else
BlockMapPrepareValue(child);
}
void Emitter::BlockMapPrepareKey(EmitterNodeType::value child)
{
const unsigned curIndent = m_pState->CurIndent();
const unsigned nextIndent = curIndent + m_pState->CurGroupIndent();
const std::size_t childCount = m_pState->CurGroupChildCount();
if(!m_pState->HasBegunNode()) {
if(childCount % 2 == 0) {
// key
if(childCount > 0) {
m_stream << "\n";
}
if(false /* long key */) {
}
} else {
// value
if(false /* was long key */) {
} else {
m_stream << ":";
}
}
}
if(childCount % 2 == 0) {
// key
switch(child) {
case EmitterNodeType::None:
break;
......@@ -394,8 +393,18 @@ namespace YAML
case EmitterNodeType::BlockMap:
break;
}
}
void Emitter::BlockMapPrepareValue(EmitterNodeType::value child)
{
const unsigned curIndent = m_pState->CurIndent();
const unsigned nextIndent = curIndent + m_pState->CurGroupIndent();
if(false /* was long key */) {
} else {
// value
m_stream << ":";
}
switch(child) {
case EmitterNodeType::None:
break;
......@@ -411,7 +420,6 @@ namespace YAML
break;
}
}
}
// SpaceOrIndentTo
// . Prepares for some more content by proper spacing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment