Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
65d80ebc
Commit
65d80ebc
authored
May 21, 2012
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started prepare node
parent
923ccc8f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
4 deletions
+68
-4
include/yaml-cpp/emitter.h
+7
-0
src/emitter.cpp
+61
-0
util/sandbox.cpp
+0
-4
No files found.
include/yaml-cpp/emitter.h
View file @
65d80ebc
...
@@ -85,6 +85,13 @@ namespace YAML
...
@@ -85,6 +85,13 @@ namespace YAML
void
EmitKindTag
();
void
EmitKindTag
();
void
EmitTag
(
bool
verbatim
,
const
_Tag
&
tag
);
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
;
const
char
*
ComputeFullBoolName
(
bool
b
)
const
;
bool
CanEmitNewline
()
const
;
bool
CanEmitNewline
()
const
;
...
...
src/emitter.cpp
View file @
65d80ebc
...
@@ -210,6 +210,8 @@ namespace YAML
...
@@ -210,6 +210,8 @@ namespace YAML
if
(
!
good
())
if
(
!
good
())
return
;
return
;
PrepareNode
();
m_pState
->
BeginGroup
(
GroupType
::
Seq
);
m_pState
->
BeginGroup
(
GroupType
::
Seq
);
}
}
...
@@ -228,6 +230,8 @@ namespace YAML
...
@@ -228,6 +230,8 @@ namespace YAML
if
(
!
good
())
if
(
!
good
())
return
;
return
;
PrepareNode
();
m_pState
->
BeginGroup
(
GroupType
::
Map
);
m_pState
->
BeginGroup
(
GroupType
::
Map
);
}
}
...
@@ -252,6 +256,61 @@ namespace YAML
...
@@ -252,6 +256,61 @@ namespace YAML
return
false
;
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
// overloads of Write
...
@@ -260,6 +319,8 @@ namespace YAML
...
@@ -260,6 +319,8 @@ namespace YAML
if
(
!
good
())
if
(
!
good
())
return
*
this
;
return
*
this
;
PrepareNode
();
m_pState
->
BeginScalar
();
m_pState
->
BeginScalar
();
return
*
this
;
return
*
this
;
...
...
util/sandbox.cpp
View file @
65d80ebc
...
@@ -4,11 +4,7 @@
...
@@ -4,11 +4,7 @@
int
main
()
int
main
()
{
{
YAML
::
Emitter
out
;
YAML
::
Emitter
out
;
out
<<
YAML
::
BeginDoc
;
out
<<
YAML
::
BeginSeq
;
out
<<
"foo"
;
out
<<
"foo"
;
out
<<
YAML
::
EndSeq
;
out
<<
YAML
::
EndDoc
;
std
::
cout
<<
out
.
c_str
()
<<
"
\n
"
;
std
::
cout
<<
out
.
c_str
()
<<
"
\n
"
;
return
0
;
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