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
b5d8241d
Commit
b5d8241d
authored
May 21, 2012
by
Jesse Beder
Browse files
Added block seq indentation
parent
d86cfc1c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
src/emitter.cpp
src/emitter.cpp
+7
-0
src/emitterstate.cpp
src/emitterstate.cpp
+7
-2
src/emitterstate.h
src/emitterstate.h
+1
-0
util/sandbox.cpp
util/sandbox.cpp
+3
-0
No files found.
src/emitter.cpp
View file @
b5d8241d
...
@@ -312,6 +312,13 @@ namespace YAML
...
@@ -312,6 +312,13 @@ namespace YAML
void
Emitter
::
BlockSeqPrepareNode
()
void
Emitter
::
BlockSeqPrepareNode
()
{
{
const
unsigned
curIndent
=
m_pState
->
CurIndent
();
if
(
m_stream
.
col
()
>
curIndent
)
{
m_stream
<<
"
\n
"
;
}
m_stream
<<
IndentTo
(
curIndent
);
m_stream
<<
"-"
;
m_stream
<<
IndentTo
(
curIndent
+
m_pState
->
CurGroupIndent
());
}
}
void
Emitter
::
FlowMapPrepareNode
()
void
Emitter
::
FlowMapPrepareNode
()
...
...
src/emitterstate.cpp
View file @
b5d8241d
...
@@ -61,8 +61,8 @@ namespace YAML
...
@@ -61,8 +61,8 @@ namespace YAML
{
{
BeginNode
();
BeginNode
();
unsigned
last
Indent
=
(
m_groups
.
empty
()
?
0
:
m_groups
.
top
().
indent
);
const
int
lastGroup
Indent
=
(
m_groups
.
empty
()
?
0
:
m_groups
.
top
().
indent
);
m_curIndent
+=
lastIndent
;
m_curIndent
+=
last
Group
Indent
;
std
::
auto_ptr
<
Group
>
pGroup
(
new
Group
(
type
));
std
::
auto_ptr
<
Group
>
pGroup
(
new
Group
(
type
));
...
@@ -114,6 +114,11 @@ namespace YAML
...
@@ -114,6 +114,11 @@ namespace YAML
return
(
m_groups
.
top
().
flow
==
Flow
?
FlowType
::
Flow
:
FlowType
::
Block
);
return
(
m_groups
.
top
().
flow
==
Flow
?
FlowType
::
Flow
:
FlowType
::
Block
);
}
}
int
EmitterState
::
CurGroupIndent
()
const
{
return
m_groups
.
empty
()
?
0
:
m_groups
.
top
().
indent
;
}
void
EmitterState
::
ClearModifiedSettings
()
void
EmitterState
::
ClearModifiedSettings
()
{
{
m_modifiedSettings
.
clear
();
m_modifiedSettings
.
clear
();
...
...
src/emitterstate.h
View file @
b5d8241d
...
@@ -39,6 +39,7 @@ namespace YAML
...
@@ -39,6 +39,7 @@ namespace YAML
GroupType
::
value
CurGroupType
()
const
;
GroupType
::
value
CurGroupType
()
const
;
FlowType
::
value
CurGroupFlowType
()
const
;
FlowType
::
value
CurGroupFlowType
()
const
;
int
CurGroupIndent
()
const
;
int
CurIndent
()
const
{
return
m_curIndent
;
}
int
CurIndent
()
const
{
return
m_curIndent
;
}
bool
HasAnchor
()
const
{
return
m_hasAnchor
;
}
bool
HasAnchor
()
const
{
return
m_hasAnchor
;
}
bool
HasTag
()
const
{
return
m_hasTag
;
}
bool
HasTag
()
const
{
return
m_hasTag
;
}
...
...
util/sandbox.cpp
View file @
b5d8241d
...
@@ -4,7 +4,10 @@
...
@@ -4,7 +4,10 @@
int
main
()
int
main
()
{
{
YAML
::
Emitter
out
;
YAML
::
Emitter
out
;
out
<<
YAML
::
BeginSeq
;
out
<<
"foo"
;
out
<<
"foo"
;
out
<<
"bar"
;
out
<<
YAML
::
EndSeq
;
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