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
50120631
Commit
50120631
authored
Sep 10, 2011
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed node iterator
parent
c3b0ba9d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
12 deletions
+22
-12
include/yaml-cpp/value/detail/iterator.h
+3
-3
include/yaml-cpp/value/detail/node_iterator.h
+9
-5
src/value/valueevents.cpp
+8
-2
src/value/valueevents.h
+2
-2
No files found.
include/yaml-cpp/value/detail/iterator.h
View file @
50120631
...
...
@@ -47,9 +47,9 @@ namespace YAML
value_type
dereference
()
const
{
const
typename
base_type
::
value_type
&
v
=
*
this
->
base
();
if
(
v
.
pNode
)
return
value_type
(
Value
(
*
v
.
pNode
,
m_pMemory
));
if
(
v
.
pKey
&&
v
.
pValue
)
return
value_type
(
Value
(
*
v
.
pKey
,
m_pMemory
),
Value
(
*
v
.
pValue
,
m_pMemory
));
return
value_type
(
Value
(
*
v
,
m_pMemory
));
if
(
v
.
first
&&
v
.
second
)
return
value_type
(
Value
(
*
v
.
first
,
m_pMemory
),
Value
(
*
v
.
second
,
m_pMemory
));
return
value_type
();
}
...
...
include/yaml-cpp/value/detail/node_iterator.h
View file @
50120631
...
...
@@ -21,13 +21,17 @@ namespace YAML
struct
iterator_type
{
enum
value
{
None
,
Sequence
,
Map
};
};
template
<
typename
V
>
struct
node_iterator_value
{
node_iterator_value
()
:
pNode
(
0
),
pKey
(
0
),
pValue
(
0
)
{}
explicit
node_iterator_value
(
V
&
rhs
)
:
pNode
(
&
rhs
),
pKey
(
0
),
pValue
(
0
)
{}
explicit
node_iterator_value
(
V
&
key
,
V
&
value
)
:
pNode
(
0
),
pKey
(
&
key
),
pValue
(
&
value
)
{}
struct
node_iterator_value
:
public
std
::
pair
<
V
*
,
V
*>
{
typedef
std
::
pair
<
V
*
,
V
*>
kv
;
node_iterator_value
()
:
kv
(),
pNode
(
0
)
{}
explicit
node_iterator_value
(
V
&
rhs
)
:
kv
(),
pNode
(
&
rhs
)
{}
explicit
node_iterator_value
(
V
&
key
,
V
&
value
)
:
kv
(
&
key
,
&
value
),
pNode
(
0
)
{}
V
&
operator
*
()
const
{
return
*
pNode
;
}
V
&
operator
->
()
const
{
return
*
pNode
;
}
V
*
pNode
;
V
*
pKey
,
*
pValue
;
};
typedef
std
::
vector
<
node
*>
node_seq
;
...
...
src/value/valueevents.cpp
View file @
50120631
#include "valueevents.h"
#include "yaml-cpp/value.h"
namespace
YAML
{
...
...
@@ -7,7 +8,7 @@ namespace YAML
Visit
(
m_root
);
}
void
V
isit
(
detail
::
node
&
node
)
void
V
alueEvents
::
Visit
(
const
detail
::
node
&
node
)
{
int
&
refCount
=
m_refCount
[
node
.
ref
()];
refCount
++
;
...
...
@@ -15,8 +16,13 @@ namespace YAML
return
;
if
(
node
.
type
()
==
ValueType
::
Sequence
)
{
for
(
detail
::
const_node_iterator
it
=
node
.
begin
();
it
!=
node
.
end
();
++
it
)
Visit
(
**
it
);
}
else
if
(
node
.
type
()
==
ValueType
::
Map
)
{
for
(
detail
::
const_node_iterator
it
=
node
.
begin
();
it
!=
node
.
end
();
++
it
)
{
Visit
(
*
it
->
first
);
Visit
(
*
it
->
second
);
}
}
}
}
src/value/valueevents.h
View file @
50120631
...
...
@@ -7,7 +7,7 @@
#include "yaml-cpp/anchor.h"
#include "yaml-cpp/value/ptr.h"
#include <m
ultiset
>
#include <m
ap
>
#include <vector>
namespace
YAML
...
...
@@ -20,7 +20,7 @@ namespace YAML
ValueEvents
(
const
Value
&
value
);
private
:
void
Visit
(
detail
::
node
&
node
);
void
Visit
(
const
detail
::
node
&
node
);
private
:
detail
::
shared_memory_holder
m_pMemory
;
...
...
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