Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
4ffb93c1
Commit
4ffb93c1
authored
Oct 22, 2009
by
Jesse Beder
Browse files
Switch to flow map when emitting an empty block map
parent
ae06a40f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
src/emitter.cpp
src/emitter.cpp
+10
-4
No files found.
src/emitter.cpp
View file @
4ffb93c1
...
@@ -410,12 +410,18 @@ namespace YAML
...
@@ -410,12 +410,18 @@ namespace YAML
EMITTER_STATE
curState
=
m_pState
->
GetCurState
();
EMITTER_STATE
curState
=
m_pState
->
GetCurState
();
FLOW_TYPE
flowType
=
m_pState
->
GetCurGroupFlowType
();
FLOW_TYPE
flowType
=
m_pState
->
GetCurGroupFlowType
();
if
(
flowType
==
FT_BLOCK
)
if
(
flowType
==
FT_BLOCK
)
{
assert
(
curState
==
ES_DONE_WITH_BLOCK_MAP_VALUE
);
// Note: block sequences are *not* allowed to be empty, but we convert it
else
if
(
flowType
==
FT_FLOW
)
{
// to a flow sequence if it is
m_stream
<<
"}"
;
assert
(
curState
==
ES_DONE_WITH_BLOCK_MAP_VALUE
||
curState
==
ES_WAITING_FOR_BLOCK_MAP_ENTRY
);
if
(
curState
==
ES_WAITING_FOR_BLOCK_MAP_ENTRY
)
{
unsigned
curIndent
=
m_pState
->
GetCurIndent
();
m_stream
<<
IndentTo
(
curIndent
)
<<
"{}"
;
}
}
else
if
(
flowType
==
FT_FLOW
)
{
// Note: flow maps are allowed to be empty
// Note: flow maps are allowed to be empty
assert
(
curState
==
ES_DONE_WITH_FLOW_MAP_VALUE
||
curState
==
ES_WAITING_FOR_FLOW_MAP_ENTRY
);
assert
(
curState
==
ES_DONE_WITH_FLOW_MAP_VALUE
||
curState
==
ES_WAITING_FOR_FLOW_MAP_ENTRY
);
m_stream
<<
"}"
;
}
else
}
else
assert
(
false
);
assert
(
false
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment