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
7478c1eb
Commit
7478c1eb
authored
Jun 17, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add config_value_map convenience alias
parent
1f24d6d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
libcaf_core/caf/config_value.hpp
libcaf_core/caf/config_value.hpp
+10
-8
No files found.
libcaf_core/caf/config_value.hpp
View file @
7478c1eb
...
@@ -158,6 +158,10 @@ private:
...
@@ -158,6 +158,10 @@ private:
variant_type
data_
;
variant_type
data_
;
};
};
/// Organizes config values into categories.
/// @relates config_value
using
config_value_map
=
std
::
map
<
std
::
string
,
config_value
::
dictionary
>
;
/// @relates config_value
/// @relates config_value
template
<
class
T
>
template
<
class
T
>
struct
config_value_access
;
struct
config_value_access
;
...
@@ -453,8 +457,7 @@ std::string get_or(const config_value::dictionary& xs, const std::string& name,
...
@@ -453,8 +457,7 @@ std::string get_or(const config_value::dictionary& xs, const std::string& name,
/// Tries to retrieve the value associated to `name` from `xs`.
/// Tries to retrieve the value associated to `name` from `xs`.
/// @relates config_value
/// @relates config_value
template
<
class
T
>
template
<
class
T
>
optional
<
T
>
get_if
(
const
std
::
map
<
std
::
string
,
config_value
::
dictionary
>*
xs
,
optional
<
T
>
get_if
(
const
config_value_map
*
xs
,
const
std
::
string
&
name
)
{
const
std
::
string
&
name
)
{
// Get the category.
// Get the category.
auto
pos
=
name
.
find
(
'.'
);
auto
pos
=
name
.
find
(
'.'
);
if
(
pos
==
std
::
string
::
npos
)
{
if
(
pos
==
std
::
string
::
npos
)
{
...
@@ -472,8 +475,7 @@ optional<T> get_if(const std::map<std::string, config_value::dictionary>* xs,
...
@@ -472,8 +475,7 @@ optional<T> get_if(const std::map<std::string, config_value::dictionary>* xs,
/// Retrieves the value associated to `name` from `xs`.
/// Retrieves the value associated to `name` from `xs`.
/// @relates config_value
/// @relates config_value
template
<
class
T
>
template
<
class
T
>
T
get
(
const
std
::
map
<
std
::
string
,
config_value
::
dictionary
>&
xs
,
T
get
(
const
config_value_map
&
xs
,
const
std
::
string
&
name
)
{
const
std
::
string
&
name
)
{
auto
result
=
get_if
<
T
>
(
&
xs
,
name
);
auto
result
=
get_if
<
T
>
(
&
xs
,
name
);
if
(
result
)
if
(
result
)
return
std
::
move
(
*
result
);
return
std
::
move
(
*
result
);
...
@@ -484,8 +486,8 @@ T get(const std::map<std::string, config_value::dictionary>& xs,
...
@@ -484,8 +486,8 @@ T get(const std::map<std::string, config_value::dictionary>& xs,
/// `default_value`.
/// `default_value`.
/// @relates config_value
/// @relates config_value
template
<
class
T
,
class
E
=
detail
::
enable_if_t
<!
std
::
is_pointer
<
T
>
::
value
>>
template
<
class
T
,
class
E
=
detail
::
enable_if_t
<!
std
::
is_pointer
<
T
>
::
value
>>
T
get_or
(
const
std
::
map
<
std
::
string
,
config_value
::
dictionary
>&
xs
,
T
get_or
(
const
config_value_map
&
xs
,
const
std
::
string
&
name
,
const
std
::
string
&
name
,
const
T
&
default_value
)
{
const
T
&
default_value
)
{
auto
result
=
get_if
<
T
>
(
&
xs
,
name
);
auto
result
=
get_if
<
T
>
(
&
xs
,
name
);
if
(
result
)
if
(
result
)
return
std
::
move
(
*
result
);
return
std
::
move
(
*
result
);
...
@@ -495,8 +497,8 @@ T get_or(const std::map<std::string, config_value::dictionary>& xs,
...
@@ -495,8 +497,8 @@ T get_or(const std::map<std::string, config_value::dictionary>& xs,
/// Retrieves the value associated to `name` from `xs` or returns
/// Retrieves the value associated to `name` from `xs` or returns
/// `default_value`.
/// `default_value`.
/// @relates config_value
/// @relates config_value
std
::
string
get_or
(
const
std
::
map
<
std
::
string
,
config_value
::
dictionary
>&
xs
,
std
::
string
get_or
(
const
config_value_map
&
xs
,
const
std
::
string
&
name
,
const
std
::
string
&
name
,
const
char
*
default_value
);
const
char
*
default_value
);
/// Tries to retrieve the value associated to `name` from `cfg`.
/// Tries to retrieve the value associated to `name` from `cfg`.
/// @relates config_value
/// @relates config_value
...
...
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