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
fddc991b
"...composable_kernel_rocm.git" did not exist on "9a9cb884082abf15d929beed83e9ca4518830029"
Commit
fddc991b
authored
Sep 12, 2011
by
Jesse Beder
Browse files
Fixed NodeBuilder bug when an alias was in a map - we weren't pushing that guy as a key
parent
3337df7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
src/node/nodebuilder.cpp
src/node/nodebuilder.cpp
+12
-8
src/node/nodebuilder.h
src/node/nodebuilder.h
+3
-2
No files found.
src/node/nodebuilder.cpp
View file @
fddc991b
...
...
@@ -41,7 +41,7 @@ namespace YAML
void
NodeBuilder
::
OnAlias
(
const
Mark
&
/*mark*/
,
anchor_t
anchor
)
{
detail
::
node
&
node
=
*
m_anchors
[
anchor
];
m_stack
.
push_back
(
&
node
);
Push
(
node
);
Pop
();
}
...
...
@@ -79,16 +79,19 @@ namespace YAML
detail
::
node
&
NodeBuilder
::
Push
(
anchor_t
anchor
)
{
const
bool
needsKey
=
(
!
m_stack
.
empty
()
&&
m_stack
.
back
()
->
type
()
==
NodeType
::
Map
&&
m_keys
.
size
()
<
m_mapDepth
);
detail
::
node
&
node
=
m_pMemory
->
create_node
();
m_stack
.
push_back
(
&
node
);
RegisterAnchor
(
anchor
,
node
);
Push
(
node
);
return
node
;
}
void
NodeBuilder
::
Push
(
detail
::
node
&
node
)
{
const
bool
needsKey
=
(
!
m_stack
.
empty
()
&&
m_stack
.
back
()
->
type
()
==
NodeType
::
Map
&&
m_keys
.
size
()
<
m_mapDepth
);
m_stack
.
push_back
(
&
node
);
if
(
needsKey
)
m_keys
.
push_back
(
Key
(
&
node
,
false
));
return
node
;
m_keys
.
push_back
(
PushedKey
(
&
node
,
false
));
}
void
NodeBuilder
::
Pop
()
...
...
@@ -108,7 +111,8 @@ namespace YAML
if
(
collection
.
type
()
==
NodeType
::
Sequence
)
{
collection
.
append
(
node
,
m_pMemory
);
}
else
if
(
collection
.
type
()
==
NodeType
::
Map
)
{
Key
&
key
=
m_keys
.
back
();
assert
(
!
m_keys
.
empty
());
PushedKey
&
key
=
m_keys
.
back
();
if
(
key
.
second
)
{
collection
.
insert
(
*
key
.
first
,
node
,
m_pMemory
);
m_keys
.
pop_back
();
...
...
src/node/nodebuilder.h
View file @
fddc991b
...
...
@@ -36,6 +36,7 @@ namespace YAML
private:
detail
::
node
&
Push
(
anchor_t
anchor
);
void
Push
(
detail
::
node
&
node
);
void
Pop
();
void
RegisterAnchor
(
anchor_t
anchor
,
detail
::
node
&
node
);
...
...
@@ -47,8 +48,8 @@ namespace YAML
Nodes
m_stack
;
Nodes
m_anchors
;
typedef
std
::
pair
<
detail
::
node
*
,
bool
>
Key
;
std
::
vector
<
Key
>
m_keys
;
typedef
std
::
pair
<
detail
::
node
*
,
bool
>
Pushed
Key
;
std
::
vector
<
Pushed
Key
>
m_keys
;
std
::
size_t
m_mapDepth
;
};
}
...
...
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