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
cf198080
Commit
cf198080
authored
Sep 09, 2011
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sequence iterator works\!
parent
190a5567
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
27 deletions
+10
-27
include/yaml-cpp/value/detail/iterator.h
+3
-3
include/yaml-cpp/value/detail/iterator_fwd.h
+0
-1
include/yaml-cpp/value/value.h
+1
-0
util/value.cpp
+6
-23
No files found.
include/yaml-cpp/value/detail/iterator.h
View file @
cf198080
...
@@ -29,7 +29,7 @@ namespace YAML
...
@@ -29,7 +29,7 @@ namespace YAML
explicit
iterator_base
(
shared_memory_holder
pMemory
,
MapIter
mapIt
)
:
m_type
(
iterator_type
::
Map
),
m_pMemory
(
pMemory
),
m_mapIt
(
mapIt
)
{}
explicit
iterator_base
(
shared_memory_holder
pMemory
,
MapIter
mapIt
)
:
m_type
(
iterator_type
::
Map
),
m_pMemory
(
pMemory
),
m_mapIt
(
mapIt
)
{}
template
<
typename
W
,
typename
I
,
typename
J
>
template
<
typename
W
,
typename
I
,
typename
J
>
explicit
iterator_base
(
const
iterator_base
<
W
,
I
,
J
>&
rhs
,
typename
boost
::
enable_if
<
boost
::
is_convertible
<
W
*
,
V
*>
,
enabler
>::
type
=
enabler
())
iterator_base
(
const
iterator_base
<
W
,
I
,
J
>&
rhs
,
typename
boost
::
enable_if
<
boost
::
is_convertible
<
W
*
,
V
*>
,
enabler
>::
type
=
enabler
())
:
m_type
(
rhs
.
m_type
),
m_pMemory
(
rhs
.
m_pMemory
),
m_seqIt
(
rhs
.
m_seqIt
),
m_mapIt
(
rhs
.
m_mapIt
)
{}
:
m_type
(
rhs
.
m_type
),
m_pMemory
(
rhs
.
m_pMemory
),
m_seqIt
(
rhs
.
m_seqIt
),
m_mapIt
(
rhs
.
m_mapIt
)
{}
private
:
private
:
...
@@ -65,10 +65,10 @@ namespace YAML
...
@@ -65,10 +65,10 @@ namespace YAML
}
}
}
}
V
dereference
()
{
V
dereference
()
const
{
switch
(
m_type
)
{
switch
(
m_type
)
{
case
iterator_type
:
:
None
:
return
V
();
case
iterator_type
:
:
None
:
return
V
();
case
iterator_type
:
:
Sequence
:
return
V
(
Value
(
*
m_seqIt
,
m_pMemory
));
case
iterator_type
:
:
Sequence
:
return
V
(
Value
(
*
*
m_seqIt
,
m_pMemory
));
case
iterator_type
:
:
Map
:
return
V
(
Value
(
*
m_mapIt
->
first
,
m_pMemory
),
Value
(
*
m_mapIt
->
second
,
m_pMemory
));
case
iterator_type
:
:
Map
:
return
V
(
Value
(
*
m_mapIt
->
first
,
m_pMemory
),
Value
(
*
m_mapIt
->
second
,
m_pMemory
));
}
}
return
V
();
return
V
();
...
...
include/yaml-cpp/value/detail/iterator_fwd.h
View file @
cf198080
...
@@ -31,7 +31,6 @@ namespace YAML
...
@@ -31,7 +31,6 @@ namespace YAML
}
}
typedef
detail
::
iterator_base
<
detail
::
iterator_value
,
detail
::
node_seq_iterator
,
detail
::
node_map_iterator
>
iterator
;
typedef
detail
::
iterator_base
<
detail
::
iterator_value
,
detail
::
node_seq_iterator
,
detail
::
node_map_iterator
>
iterator
;
typedef
detail
::
iterator_base
<
const
detail
::
iterator_value
,
detail
::
node_seq_const_iterator
,
detail
::
node_map_const_iterator
>
const_iterator
;
typedef
detail
::
iterator_base
<
const
detail
::
iterator_value
,
detail
::
node_seq_const_iterator
,
detail
::
node_map_const_iterator
>
const_iterator
;
}
}
...
...
include/yaml-cpp/value/value.h
View file @
cf198080
...
@@ -18,6 +18,7 @@ namespace YAML
...
@@ -18,6 +18,7 @@ namespace YAML
{
{
public
:
public
:
friend
class
detail
::
node_data
;
friend
class
detail
::
node_data
;
template
<
typename
,
typename
,
typename
>
friend
class
detail
::
iterator_base
;
Value
();
Value
();
explicit
Value
(
ValueType
::
value
type
);
explicit
Value
(
ValueType
::
value
type
);
...
...
util/value.cpp
View file @
cf198080
...
@@ -3,30 +3,13 @@
...
@@ -3,30 +3,13 @@
int
main
()
int
main
()
{
{
YAML
::
Value
value
;
YAML
::
Value
value
(
YAML
::
ValueType
::
Sequence
);
value
[
"key"
]
=
"value"
;
for
(
int
i
=
0
;
i
<
5
;
i
++
)
std
::
cout
<<
value
[
"key"
].
as
<
std
::
string
>
()
<<
"
\n
"
;
value
.
append
(
i
);
value
[
"key"
][
"key"
]
=
"value"
;
std
::
cout
<<
value
[
"key"
][
"key"
].
as
<
std
::
string
>
()
<<
"
\n
"
;
value
[
5
]
=
"monkey"
;
std
::
cout
<<
value
[
5
].
as
<
std
::
string
>
()
<<
"
\n
"
;
value
[
"monkey"
]
=
5
;
std
::
cout
<<
value
[
"monkey"
].
as
<
int
>
()
<<
"
\n
"
;
std
::
map
<
int
,
std
::
string
>
names
;
for
(
YAML
::
const_iterator
it
=
value
.
begin
();
it
!=
value
.
end
();
++
it
)
{
names
[
1
]
=
"one"
;
std
::
cout
<<
it
->
as
<
int
>
()
<<
"
\n
"
;
names
[
2
]
=
"two"
;
}
names
[
3
]
=
"three"
;
names
[
4
]
=
"four"
;
value
[
"names"
]
=
names
;
value
[
"this"
]
=
value
;
value
[
"this"
][
"change"
]
=
value
;
value
[
"seq"
]
=
YAML
::
Value
(
YAML
::
ValueType
::
Sequence
);
value
[
"seq"
].
append
(
2
);
value
[
"seq"
].
append
(
3
);
value
[
"seq"
].
append
(
"five"
);
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