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
65d80ebc
"vscode:/vscode.git/clone" did not exist on "a341b536a88272230bbc66554f97bf3b4b3ecf94"
Commit
65d80ebc
authored
May 21, 2012
by
Jesse Beder
Browse files
Started prepare node
parent
923ccc8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
4 deletions
+68
-4
include/yaml-cpp/emitter.h
include/yaml-cpp/emitter.h
+7
-0
src/emitter.cpp
src/emitter.cpp
+61
-0
util/sandbox.cpp
util/sandbox.cpp
+0
-4
No files found.
include/yaml-cpp/emitter.h
View file @
65d80ebc
...
...
@@ -85,6 +85,13 @@ namespace YAML
void
EmitKindTag
();
void
EmitTag
(
bool
verbatim
,
const
_Tag
&
tag
);
void
PrepareNode
();
void
PrepareTopNode
();
void
FlowSeqPrepareNode
();
void
BlockSeqPrepareNode
();
void
FlowMapPrepareNode
();
void
BlockMapPrepareNode
();
const
char
*
ComputeFullBoolName
(
bool
b
)
const
;
bool
CanEmitNewline
()
const
;
...
...
src/emitter.cpp
View file @
65d80ebc
...
...
@@ -210,6 +210,8 @@ namespace YAML
if
(
!
good
())
return
;
PrepareNode
();
m_pState
->
BeginGroup
(
GroupType
::
Seq
);
}
...
...
@@ -228,6 +230,8 @@ namespace YAML
if
(
!
good
())
return
;
PrepareNode
();
m_pState
->
BeginGroup
(
GroupType
::
Map
);
}
...
...
@@ -252,6 +256,61 @@ namespace YAML
return
false
;
}
// Put the stream in a state so we can simply write the next node
// E.g., if we're in a sequence, write the "- "
void
Emitter
::
PrepareNode
()
{
switch
(
m_pState
->
CurGroupType
())
{
case
GroupType
::
None
:
PrepareTopNode
();
break
;
case
GroupType
::
Seq
:
switch
(
m_pState
->
CurGroupFlowType
())
{
case
FlowType
::
Flow
:
FlowSeqPrepareNode
();
break
;
case
FlowType
::
Block
:
BlockSeqPrepareNode
();
break
;
case
FlowType
::
None
:
assert
(
false
);
}
break
;
case
GroupType
::
Map
:
switch
(
m_pState
->
CurGroupFlowType
())
{
case
FlowType
::
Flow
:
FlowMapPrepareNode
();
break
;
case
FlowType
::
Block
:
BlockMapPrepareNode
();
break
;
case
FlowType
::
None
:
assert
(
false
);
}
break
;
}
}
void
Emitter
::
PrepareTopNode
()
{
}
void
Emitter
::
FlowSeqPrepareNode
()
{
}
void
Emitter
::
BlockSeqPrepareNode
()
{
}
void
Emitter
::
FlowMapPrepareNode
()
{
}
void
Emitter
::
BlockMapPrepareNode
()
{
}
// *******************************************************************************************
// overloads of Write
...
...
@@ -260,6 +319,8 @@ namespace YAML
if
(
!
good
())
return
*
this
;
PrepareNode
();
m_pState
->
BeginScalar
();
return
*
this
;
...
...
util/sandbox.cpp
View file @
65d80ebc
...
...
@@ -4,11 +4,7 @@
int
main
()
{
YAML
::
Emitter
out
;
out
<<
YAML
::
BeginDoc
;
out
<<
YAML
::
BeginSeq
;
out
<<
"foo"
;
out
<<
YAML
::
EndSeq
;
out
<<
YAML
::
EndDoc
;
std
::
cout
<<
out
.
c_str
()
<<
"
\n
"
;
return
0
;
...
...
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