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
cf198080
"...controlnet/train_controlnet_webdataset.py" did not exist on "4dcab9227a85fb51351361730a4228e1ff549258"
Commit
cf198080
authored
Sep 09, 2011
by
Jesse Beder
Browse files
Sequence iterator works\!
parent
190a5567
Changes
4
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
include/yaml-cpp/value/detail/iterator.h
+3
-3
include/yaml-cpp/value/detail/iterator_fwd.h
include/yaml-cpp/value/detail/iterator_fwd.h
+0
-1
include/yaml-cpp/value/value.h
include/yaml-cpp/value/value.h
+1
-0
util/value.cpp
util/value.cpp
+6
-23
No files found.
include/yaml-cpp/value/detail/iterator.h
View file @
cf198080
...
...
@@ -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
)
{}
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
)
{}
private:
...
...
@@ -65,10 +65,10 @@ namespace YAML
}
}
V
dereference
()
{
V
dereference
()
const
{
switch
(
m_type
)
{
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
));
}
return
V
();
...
...
include/yaml-cpp/value/detail/iterator_fwd.h
View file @
cf198080
...
...
@@ -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
<
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
{
public:
friend
class
detail
::
node_data
;
template
<
typename
,
typename
,
typename
>
friend
class
detail
::
iterator_base
;
Value
();
explicit
Value
(
ValueType
::
value
type
);
...
...
util/value.cpp
View file @
cf198080
...
...
@@ -3,30 +3,13 @@
int
main
()
{
YAML
::
Value
value
;
value
[
"key"
]
=
"value"
;
std
::
cout
<<
value
[
"key"
].
as
<
std
::
string
>
()
<<
"
\n
"
;
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
"
;
YAML
::
Value
value
(
YAML
::
ValueType
::
Sequence
);
for
(
int
i
=
0
;
i
<
5
;
i
++
)
value
.
append
(
i
);
std
::
map
<
int
,
std
::
string
>
names
;
names
[
1
]
=
"one"
;
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"
);
for
(
YAML
::
const_iterator
it
=
value
.
begin
();
it
!=
value
.
end
();
++
it
)
{
std
::
cout
<<
it
->
as
<
int
>
()
<<
"
\n
"
;
}
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