Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
20b62978
Commit
20b62978
authored
Feb 23, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix top-level merging for new config syntax
parent
401fc89e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
libcaf_core/caf/detail/ini_consumer.hpp
libcaf_core/caf/detail/ini_consumer.hpp
+1
-1
libcaf_core/src/ini_consumer.cpp
libcaf_core/src/ini_consumer.cpp
+17
-8
No files found.
libcaf_core/caf/detail/ini_consumer.hpp
View file @
20b62978
...
@@ -209,7 +209,7 @@ private:
...
@@ -209,7 +209,7 @@ private:
config_option_set
&
options_
;
config_option_set
&
options_
;
settings
&
cfg_
;
settings
&
cfg_
;
std
::
string
current_key
;
std
::
string
current_key
_
;
std
::
vector
<
error
>
warnings_
;
std
::
vector
<
error
>
warnings_
;
};
};
...
...
libcaf_core/src/ini_consumer.cpp
View file @
20b62978
...
@@ -42,7 +42,6 @@ ini_list_consumer abstract_ini_consumer::begin_list() {
...
@@ -42,7 +42,6 @@ ini_list_consumer abstract_ini_consumer::begin_list() {
return
{
this
};
return
{
this
};
}
}
// -- map_consumer -------------------------------------------------------------
// -- map_consumer -------------------------------------------------------------
ini_map_consumer
::
ini_map_consumer
(
abstract_ini_consumer
*
parent
)
ini_map_consumer
::
ini_map_consumer
(
abstract_ini_consumer
*
parent
)
...
@@ -156,23 +155,28 @@ ini_consumer* ini_category_consumer::dparent() {
...
@@ -156,23 +155,28 @@ ini_consumer* ini_category_consumer::dparent() {
ini_consumer
::
ini_consumer
(
config_option_set
&
options
,
settings
&
cfg
)
ini_consumer
::
ini_consumer
(
config_option_set
&
options
,
settings
&
cfg
)
:
options_
(
options
),
:
options_
(
options
),
cfg_
(
cfg
),
cfg_
(
cfg
),
current_key
(
"global"
)
{
current_key
_
(
"global"
)
{
// nop
// nop
}
}
ini_category_consumer
ini_consumer
::
begin_map
()
{
ini_category_consumer
ini_consumer
::
begin_map
()
{
return
{
this
,
current_key
};
return
{
this
,
current_key
_
};
}
}
void
ini_consumer
::
key
(
std
::
string
name
)
{
void
ini_consumer
::
key
(
std
::
string
name
)
{
current_key
=
std
::
move
(
name
);
current_key
_
=
std
::
move
(
name
);
}
}
void
ini_consumer
::
value_impl
(
config_value
&&
x
)
{
void
ini_consumer
::
value_impl
(
config_value
&&
x
)
{
using
dict_type
=
config_value
::
dictionary
;
using
dict_type
=
config_value
::
dictionary
;
auto
dict
=
get_if
<
dict_type
>
(
&
x
);
auto
dict
=
get_if
<
dict_type
>
(
&
x
);
if
(
current_key
!=
"global"
)
{
if
(
dict
==
nullptr
)
{
auto
&
dst
=
cfg_
.
emplace
(
current_key
,
dict_type
{}).
first
->
second
;
warnings_
.
emplace_back
(
make_error
(
pec
::
type_mismatch
,
"expected a dictionary at top level"
));
return
;
}
if
(
current_key_
!=
"global"
)
{
auto
&
dst
=
cfg_
.
emplace
(
current_key_
,
dict_type
{}).
first
->
second
;
if
(
dict
!=
nullptr
&&
!
dict
->
empty
()
&&
holds_alternative
<
dict_type
>
(
dst
))
{
if
(
dict
!=
nullptr
&&
!
dict
->
empty
()
&&
holds_alternative
<
dict_type
>
(
dst
))
{
auto
&
dst_dict
=
get
<
dict_type
>
(
dst
);
auto
&
dst_dict
=
get
<
dict_type
>
(
dst
);
// We need to "merge" values into the destination, because it can already
// We need to "merge" values into the destination, because it can already
...
@@ -181,8 +185,13 @@ void ini_consumer::value_impl(config_value&& x) {
...
@@ -181,8 +185,13 @@ void ini_consumer::value_impl(config_value&& x) {
dst_dict
.
insert_or_assign
(
entry
.
first
,
std
::
move
(
entry
.
second
));
dst_dict
.
insert_or_assign
(
entry
.
first
,
std
::
move
(
entry
.
second
));
}
}
}
else
{
}
else
{
for
(
auto
&
entry
:
*
dict
)
std
::
string
prev_key
;
cfg_
.
insert_or_assign
(
entry
.
first
,
std
::
move
(
entry
.
second
));
swap
(
current_key_
,
prev_key
);
for
(
auto
&
entry
:
*
dict
)
{
current_key_
=
std
::
move
(
entry
.
first
);
value_impl
(
std
::
move
(
entry
.
second
));
}
swap
(
prev_key
,
current_key_
);
}
}
}
}
...
...
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